Exploring Mechanisms with Lego Mindstorms NXT

7
1 Exploring Mechanisms with Lego Mindstorms NXT There are three mechanisms we will focus on: cranks, gears, and cams. All three take a single rotary movement and convert it into a new form of motion. For each one below there is a corresponding Lego Digital Designer file that you can open on your computer; it will instruct you on how to build each mechanism. Starting up the Lego Digital Designer software Double-click the icon on the desktop labeled Lego Digital Designer. Once the program opens, click the “Free build” icon in the middle window. Crank The crank converts a single rotary movement into a smooth waving motion. To build the crank: In Lego Digital Designer click the File > Open and navigate to the folder on the Desktop labeled “Lego Models”. Open the file Artbotics Crank.lxf In the top-right click the “Building guide mode” icon. This will instruct you on how to build the crank. Follow the steps by clicking the left and right arrows at the top of the screen. This is just one of many ways to build a waving crank. Many qualities of the crank can be adjusted to change the kind of waving motion it will produce: The connector and end bar can vary in size The connector and end bar joint placement can vary The end bar to ground bar joint placement can vary

Transcript of Exploring Mechanisms with Lego Mindstorms NXT

Page 1: Exploring Mechanisms with Lego Mindstorms NXT

1

Exploring Mechanisms with Lego Mindstorms NXT

There are three mechanisms we will focus on: cranks, gears, and cams. All three take a single rotary movement and convert it into a new form of motion. For each one below there is a corresponding Lego Digital Designer file that you can open on your computer; it will instruct you on how to build each mechanism.

Starting up the Lego Digital Designer software

Double-click the icon on the desktop labeled Lego Digital Designer.

Once the program opens, click the “Free build” icon in the middle window.

Crank

The crank converts a single rotary movement into a smooth waving motion. To build the crank:

• In Lego Digital Designer click the File > Open and navigate to the folder on the Desktop labeled “Lego Models”. Open the file Artbotics Crank.lxf

• In the top-right click the “Building guide mode” icon. This will instruct you on how to build the crank. Follow the steps by clicking the left and right arrows at the top of the screen.

This is just one of many ways to build a waving crank. Many qualities of the crank can be adjusted to change the kind of waving motion it will produce:

• The connector and end bar can vary in size

• The connector and end bar joint placement can vary

• The end bar to ground bar joint placement can vary

Page 2: Exploring Mechanisms with Lego Mindstorms NXT

2

Crank Programming Exercise How to control motors

Now that the crank is built we will write a short program to make it move. Plug the motor into port B on the NXT brick. In the Lego Mindstorms NXT software, under the heading “Start New Program”, replace the text Untitled-1 with a name for your first program, and then hit the Go >> button.

1. Drag a Move block and drop it to the right of the starting point of your sequence beam.

2. Select this Move block and in the configuration panel uncheck port C so that only port B is selected. Also adjust the power to 50 and the duration to 3 rotations.

3. Place another Move block to the right of the last Move block. 4. Select this Move block and in the configuration panel uncheck port C so that only port B is selected. Also

adjust the direction to backward, the power to 50, and the duration to 3 rotations.

5. Make sure the NXT brick is turned on and connect the USB to both your computer and the NXT. 6. Locate the download controller in the lower right of your work area and click the

center (play) button. (Download and run)

Action: Your crank should rotate 3 times, then 3 times in the opposite direction.

Final Sequence Beam

Page 3: Exploring Mechanisms with Lego Mindstorms NXT

3

Gears A set of gears converts a single rotary movement into multiple rotary movements with different speeds. To start you can build a set of gears that makes the motor movement faster or slower:

• In Lego Digital Designer click the File > Open and navigate to the folder on the Desktop labeled “Lego Models”. Open the file Artbotics Gears Faster.lxf or Artbotics Gears Slower.lxf

• In the top-right click the “Building guide mode” icon. This will instruct you on how to build the crank. Follow the steps by clicking the left and right arrows at the top of the screen.

This is the gear mechanism built to produce a slower motion than the initial motor movement. There are many ways to build a set of gears to change motor speeds, and within one set of gears both fast and slow movements can be achieved. The motor speed changes because of the number of teeth on interacting gears, known as a gear ratio. In short, a gear with more teeth will move slower than a gear with less teeth, and a gear with less teeth will move faster than a gear with more teeth. This is because the number of teeth and size of the gear change how long it takes it complete one full revolution.

There are three sizes of gears we can use:

Large – 40 teeth Medium – 24 teeth Small – 8 teeth

• A large gear against a medium gear would have a ratio of 40:24, or reduced to 5:3.

• A medium gear against a small gear would have a ratio of 24:8, or reduced to 3:1. • A large gear against a small gear would have a ratio of 40:8, or reduced to 5:1.

Page 4: Exploring Mechanisms with Lego Mindstorms NXT

4

Gears Programming Exercise How to loop and repeat commands

With a set of gears built we will write a short program to make it move. Plug the motor into port B on the NXT brick. You can first try out your set of gears by running the crank program from the previous exercise. To start a new program click File > New, then click File > Save As to name your second program.

1. Drag a Loop block and drop it to the right of the starting point of your sequence beam. Any blocks placed inside of the Loop block will repeat for a specific number of times, forever, for a specific length of time, or based on sensor input.

2. Select this Loop block and in the configuration panel adjust its control from “forever” to “count”, and change the count to 4. This will set the loop to repeat 4 times.

3. Now add a Move block within the Loop block.

4. In the configuration panel uncheck port C so that only port B is selected, set its power to 25, and the

duration to 2 rotations.

Page 5: Exploring Mechanisms with Lego Mindstorms NXT

5

5. Add another Move block within the Loop block, to the right of the first Move block.

6. In the configuration panel uncheck port C so that only port B is selected, set its power to 75, and the duration to 4 rotations.

7. Make sure the NXT brick is turned on and connect the USB to both your computer and the NXT. 8. Save your program; make sure it is named something that will help you identify it.

Click the download button. 9. After downloading the program press the grey button on the NXT to go back within the menu. Navigate and

find your program by its filename using the left and right arrows on the NXT. Once you have found your program, press the orange button to select it, then again to run it.

Action: Your gears should rotate 2 times at a slow speed, 4 times at a faster speed, and then repeat 4 times.

Final Sequence Beam

You can experiment with the Loop block by adjusting its control setting. Try setting it to “forever” or “time”. You can also place Loop blocks inside of Loop blocks, just make sure they aren’t all set to “forever” or your program will be stuck in an endless loop!

This same program can be used to make your crank move; plug it into port B and see what happens.

Page 6: Exploring Mechanisms with Lego Mindstorms NXT

6

Cams

A cam converts rotary movement to linear motion. There is no Lego piece in the Mindstorms NXT kit that will properly function as a cam, so one must be made out of foam core and electrical tape. To build the rest of the cam mechanism:

• In Lego Digital Designer click the File > Open and navigate to the folder on the Desktop labeled “Lego Models”. Open the file Artbotics Cam.lxf

• In the top-right click the “Building guide mode” icon. This will instruct you on how to build the crank. Follow the steps by clicking the left and right arrows at the top of the screen.

A cam is a curved piece that rotates and moves its accompanying follower. There are many different types of cams that can be built:

Circular (Eccentric) Pear Snail

There are two Lego pieces that can be used as cams (shown above). You can also build your own.

To build a cam, cut a shape out of foamcore or cardboard using an exacto knife (only on a cutting mat or over another piece of foamcore or cardboard – not directly on a table!). Seal the outside of the cam using electrical tape; this will make the surface smoother.

Page 7: Exploring Mechanisms with Lego Mindstorms NXT

7

Cams Programming Exercise

With a cam shaft built we will write a short program to make it move. Plug the motor into port B on the NXT brick. Keep in mind that a cam shaft may only function properly when rotating in a certain direction. Experiment with how your cam rotates before deciding on a direction. To start a new program click File > New, then click File > Save As to name your third program.

1. Drag a Loop block and drop it to the right of the starting point of your sequence beam. Adjust its control setting to “forever”.

2. Drag a Move block inside of the Loop block. In the configuration panel uncheck port C so that only port B is selected, set its power to 25, and the duration to 5 seconds.

3. Drag a Wait Time block inside of the Loop block, to the right of the Move block. This will make your program pause for a specified amount of time.

4. In the configuration panel adjust the until setting to 2 seconds.

Action: Your cam should rotate for 5 seconds, stop for 2 seconds, and then repeat forever.

Final Sequence Beam

For more information on Artbotics see artbotics.org

Please send any questions or comments to Adam Norton at [email protected]