You are on page 1of 11

http://www.k12lab.

com/lessonplans/arachnosaurus

ARACHNOSAURUS
By: Karl Wendt and Graduate Students Tufts University Center for Engineering Education and Outreach

Introduction
This project is designed to show you how to create linkages and walking mechanisms. The Arachnosaurus is based on Jansen linkage. Theo Jansen came up with these innovative "walking linkages" to allow his kinetic sculptures to come to life. You will also learn how to create while loops, case structures, and motor and touch sensor controls. Linkages are used to convert one type of motion into another. In the Arachnosaurus project rotary motion is converted into a walking motion using a Jansen linkage. More information on linkages: 1 Uses 2 History 3 Theory 4 Types of linkages

Experimentation Questions

1. Change the position of the linkage connection peg on one of the drive gears. What happens to the motion of the legs? If you add wheels to the front feet and not the back, what happens and why? If you don't use wheels, what happens and why? 2. What are three ways you could make this robot more reliable? What goes wrong and why? How could you fix it? 3. How could you make the tail (rear touch sensor) a part of Arachnosaurus' actions? 4. How could you change the code to make Arachnosaurus grab a pencil from you and deliver it to a friend several feet away?

Teaching Standards
We recommend linking your project's content to the nationally recognized Common Core Standards for literacy in science and math. Learning Opportunities: In this lab students have the opportunity to understand the following: 1. How to create a system that controls movement to accomplish a goal 2. Torque

3. Friction 4. Gears and gear ratios 5. Linkages 6. Computer programming 7. Electronics and motors 8. Statics and structures 9. Teamwork and collaboration 10. Sensors

BUILDING INSTRUCTIONS
This eightlegged dino is going to walk up to a person, open its jaws, flash its eyes, and then turn around and walk away until it encounters another obstacle.

1. Build the jaw assembly and attach the ultrasonic sensor.

2. Create 8 leg linkages like the one shown above.

3. Connect leg linkages to frame and output gears (please note the exact location of the legs is critical to the success of the walking motion. See the Simulation CGI of Theo Jansen 's Mechanism Video for details.

4. Connect motors to the input gears and wire motors and sensors to the ports shown in the programming section.

5. Attach the jaw assembly to the leg assembly and test.

Programming Instructions
1. Start by creating a While Loop. This can be found in the "NXT Programming > Structures" palette. Right click the left node of the stop sign VI and select "Create > Constant." Be sure this constant is set to "False" ("F"). This creates an infinite loop so the program continually repeats everything you place within the loop.

2. Place a case structure inside the while loop.

3. Next we're going to add the ultrasonic sensor to so that Arachnosaurus can "see" where a person or obstacle is in front of it. Add a "Read Ultrasonic" VI ("NXT Programming > NXT I/O" palette) inside the while loop, but outside the case structure. From the drop down menu, choose "Read Ultrasonic." Rightclick the Port input at the top of this VI and choose "Create > Constant." Make sure "Port 2" is selected. Next we need to add a comparison VI. Add the Less Than VI (NXT Programming>Comparison). Create a

constant off the bottom input, and set the constant value to 20. This value tells the NXT when to respond to information from the ultrasonic sensor. The lower the number, the closer Arachnosaurus will get before he throws a tantrum, turns and then walks away. Finally, wire the Less Than VI into the "Case Selector" (green question mark) on the Case Structure.

4. Next create the conditions inside of the True case of the case structure. Make sure the top of the case loop (The inside loop) says "True" at the top. Then, add a Motor Control VI (NXT I/O palette) and wire the pink NXT wire to the sonar VI outside of the case loop. Rightclick the Port input thats at the top of the motor VI, and set the constant to ports B & C. Then, set the motor to off/ break using the dropdown at the bottom of the VI. This will stop Arachnosaurus when it "sees" something that is in front of it.

5. Add 3 while loops inside the True case of the case structure.

6. We are now going to add the blinking red eyes! Add a Read Sensor VI to the top while loop and select Read Light>On from the dropdown. First, we are going to set up the right light sensor or "eye". Rightclick at the top of the light VI to create a Port constant, and select port 3. Then, wire the break motor VI to the light VI inside of the top while loop. To make the lights blink we need to add a wait function. Add a Wait For VI (NXT

I/O palette) next to the light VI. Wire the pink NXT wire of the wait VI to the light VI. Rightclick the Time input of the wait VI to create a constant and of .25 seconds. This will cause the light to stay on for 1/4 of a second. To make it blink we have to turn it off. Next, insert another light VI, after the wait VI. Select Read Light > LED off from the dropdown of the light VI. Insert another wait VI and wire it to the light off VI. Then create a constant off the last wait VI and set it to .25 as well. This will make the light turn off for a quarter of a second. Now to get the lights to turn on and off more than once we have to set the loop iteration.

7. Select the blue i in the box in the lefthand corner of the top while loop and move it to the right side of while loop. Go to NXT programming>comparison>greater than, and insert the greater than VI into the while loop near the blue i. Rightclick the greater than VI, create a constant off the bottom input of the greater than VI and set the constant to 50. Wire the blue i to the top input of the greater VI. This will make the lights turn on and off 50 times before they stop. Next, wire output of the greater than VI to the stop condition at the bottom right of the while loop. This connects the iteration to the end of the loop. Finally, select all the VIs in the top while loop with your mouse by left clicking and dragging a box around them. If you are using a PC press CtrlC, and if you are using a Mac press CmdC and move your curser to the middle while loop. Then, press CtrlV or CmdV to paste the code into the middle while loop. This will copy all of the work you did in the first while

loop. Next you will need to change the port settings on the lights to port 1. Then wire the first light VI to the pink NXT wire coming from the brake and going to the top while loop. This will cause the left light sensor or "eye" to blink too.

8. Now that the "eyes" are programmed, its time to set the false condition in the case loop. Go to the top of the case loop and select the False case. Add a Motor Control VI to the False case. Create a Port constant and select Ports B & C. Then wire the motor to the break VI thats outside of the case structure. Rightclick on the power input of the motor to create a constant and set the constant to 75. This will give Arachnosaurus enough power to move those complicated linkages and walk forward. This section of code will allow Arachnosaurus to walk forward if nothing gets in his way.

9. Now its time to create the code that allows the mouth to open and close and allows Arachnosaurus to turn and walk when he encounters an obstacle. Change the case structure back to the True case. This is what will happen when Arachnosaurus is met with an obstacle. In the bottom while loop, add a Motor Control VI. Create a constant to set the speed of the motor to 45. Then create a Port constant on the same motor VI and set the port to A. Wire this motor VI to the Break motor VI outside of the while loop. Next we will need to set the amount of time the motor should run so that the mouth can open fully. To do this, add a Wait For VI (NXT I/O) next to the motor VI. Create a constant off the Time input, and set the time value to .5. Make sure you set the motor direction to back. Then wire the wait VI to the motor VI. Next insert another motor VI and wire it to the wait VI and set its speed to 45 and its direction to forward. This will make the mouth close again. Now add a greater than VI (Programming >Comparison). Next, wire the bottom terminal of the greater than VI to the blue i in the bottom while loop. Then, create a constant off the top terminal of the greater than VI, and set the constant to 4. Finally, wire the output of the greater than VI to the red stop condition in the lower right of the while loop.

10. You are almost done! To make Arachnosaurus turn around and head away in a different direction after showing his fierce teeth and eyes to the obstacle in his path, we need to reverse the two main drive motors for 12 seconds. Inside the case structure but outside of the bottom while loop, add a forward motor VI, and create Port B constant off the Port input. Then, add motor VI, select Motor On >Reverse from the pulldown, and create Port C constant for this motor control. Finally, insert a wait VI and create a constant time of 12 seconds. You may need to change this number based on how much friction there is between Arachnosaurus' feet and the floor. The more friction, the shorter amount of time is needed to make him turn. You can experiment with adding wheels to add or reduce friction between his feet and the floor. You are all set! Have fun.

You might also like