Google+

Sunday, 22 December 2013

Robotic Spider V8

I needed a project that would use all my servos, so I decided to make the do-nothing, worthless spider. If you have fischertechnik and servos to waste, this is the project for you! Really, this flopping spider makes for a great learning project. The main goal of this project is to teach the fundamentals of servos, synchronizing them, programming them, and understand the range and strength of servos. The results are very amusing!

Fischertechnik? What's that?
Legos have bricks, K'NEX has blue and yellow connector rods, but what does fischertechnik have? In truth, it has way too many pieces to give names to! Fischertechnik is definately not as popular as legos or K'NEX, but I like it much better. It's very good for exercising building and construction skills. Here is an excerpt from Wikipedia on fischertechnik
"Fischertechnik is a brand of construction toy. It was invented by Artur Fischer and is produced by fischertechnik GmbH in Waldachtal, Germany. Fans often refer to Fischertechnik as FT or ft. It is used in education for teaching about simple machines, as well as motorization and mechanisms. The company also offers computer interface technology which can be used to teach the theory of automation and robotics."
I will be calling fischertechnik FT as mentioned above.

Here's a video of it walking.



Step 1: Ingredients:

Tools:
  • Hot glue gun
  • Razor blade
  • Philips Screwdriver
  • Drill with 7/32 drill bit
  • Dremel with very tiny drill bit (a little bit smaller than the screws that come with the servo)
Electronics:
  • 6 AA battery pack and alligator clip
  • 8x micro servos and attachments
  • 30+ jumper wires or pin headers.
  • Breadboard
  • Arduino and power
Parts:
  • Fischertechnik

Step 2: Building the Frame

Since I don't know what to call the FT pieces, I'll just show the pictures to building the frame. Make sure to look at the captions.
Assuming you have fischertechnik, you can just tell what pieces I'm using to build this. I'm sorry I can't offer much more of and explanation!


Step 3: Mounting the Servos

Now get out your dremel! The servos conveniently fit between the 'bricks'. Drill a small pilot hole, then using the screws the servo came with, screw them in. If you don't want to screw into you pieces, that OK, just use some hot glue, but, it's always easier disassemble if you use screws. Note: You will want to screw these on BEFORE you put on the arms, or else the arm will be in the way of your screw making it difficult. And why do I know this? I'll let you guess =) Repeat this on the other side. 

Step 4: Mounting the Servos on Servos

You will first need to screw on the circular servo attachment. If the servo is facing away from you, turn it all the way to the right. See pictures.

Now the circular servo arm is different from the other arms; the screw sticks up above the plastic unlike the other ones, which the screw head sinks below the plastic. So, with  this bump in the middle, a flat surface cannot be mounted totally flat, instead it will wobble and pivot around the center. To fix this, I'm taking a 7/32 bit (one size smaller than 1/4 on a standard drill set) and drilling a small indent on the servo that will be glued on top of the base servo. See pictures. Then using hot glue, glue the two servos together.

See video.





Step 5: Mounting the Spidey Legs!

This part is little tricky. I'm going to put a little video up to kinda help you understand how to mount the arms. See the pictures how to make the arms. You will need four of these.  See the video in step 4 for glueing these on. 

Step 6: Seeing it all Together

After you mounted all the arms you will want to check them for full range of motion.

Step 7: Creating a Diagram For Reference

Now, this is the most helpful step of all. Create a diagram like the one shown in the picture, and figure out for each servo which way is 180 deg. and which is 0 deg.. Then number all the servos. These numbers are what you will be using in your Arduino program. 

Step 8: Breadboarding

Pull out all 30 of your jumpers! Wire up everything according to the schematic. Here's how it works. Each servo has 3 output wires, power, ground, and control. Connect the Vcc and GND from servo to the Vcc and GND rails of your breadboard. Connect the 7.5 volts from your battery pack to the GND and Vcc rails of your breadboard. (Since most battery packs are for 6 AA, take out one of the batteries and use a jumper to bypass it. This will then give you 7.5 v instead of 9v.) Then, following your diagram you made earlier, connect the servo control wires (yellow or orange, I've even seen white) onto pins 2-9.  For instance, servo 1 is connected to pin 2 on Arduino. Servo 2 is connect to pin 3 and so on.

Step 9: Aligning the Servos

Now, here is the time to work out the code. The first thing to do is to make a new Arduino project called, Aligning Servos. In this project, you will align all the servos. So, what you need to do is to find out what degrees (1-179) you need to type in to make the up and down servos (the servos on the top with the arms connected) level with the ground. Then, get the left and right servos (the servos on the bottom) level as well, having the stick straight out. Lets examine the code.
Then, look at the second picture in this post to see what this code does for my spider.
#include<Servo.h>

Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
Servo servo5;
Servo servo6;
Servo servo7;
Servo servo8;

void setup()
{
  servo1.attach(2);  // s is on pin 8
  servo2.attach(3);
  servo3.attach(4);
  servo4.attach(5);
  servo5.attach(6);
  servo6.attach(7);
  servo7.attach(8);
  servo8.attach(9);
 
}

void loop()

{
                    // all the motors level fowards and backwards
  servo1.write(15);
  servo2.write(100);
  servo3.write(179);
  servo4.write(95);
  servo5.write(160);
  servo6.write(140);
  servo7.write(15);
  servo8.write(85);


 }


Step 10: Up and Down

You will now need to find out the values for making the legs actually lift the spider off the ground. Make a new project called Up and Down. This project make the legs of the spider move up and down. Notice the opposites will lift up first. See video.

And here is the code I used. Yours may be similar.
#include<Servo.h>

Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
Servo servo5;
Servo servo6;                      
Servo servo7;
Servo servo8;

void setup()
{
  servo1.attach(2);  // s is on pin 8
  servo2.attach(3);
  servo3.attach(4);
  servo4.attach(5);
  servo5.attach(6);
  servo6.attach(7);
  servo7.attach(8);
  servo8.attach(9);
 
}

void loop()

{
  servo2.write(100); // these numbers are to keep the spin servos put.
  servo4.write(95);
  servo6.write(140);
  servo8.write(85);

  servo1.write(50); // M1 Up
  servo7.write(50); // M1 Up
  delay(500);       
  servo1.write(25); // M1 Down
  servo7.write(35); // M7 Down
  
  
  delay(1000);
  
  servo3.write(135); // M3 Up
  servo5.write(120); // M5 Up
  delay(500);
  servo3.write(150); // M3 Down
  servo5.write(140); // M5 Down
  
  delay(1000);
  
  
 }

Step 11: Forwards and Backwards

Now we will need to get the pan servos to pull forward, and push back.
Here is the code I used. Yours may be similar. When your done it should look like this. . .



#include<Servo.h>

Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
Servo servo5;
Servo servo6;
Servo servo7;
Servo servo8;

void setup()
{
  servo1.attach(2); 
  servo2.attach(3);
  servo3.attach(4);
  servo4.attach(5);
  servo5.attach(6);
  servo6.attach(7);
  servo7.attach(8);
  servo8.attach(9);
 
}

void loop()

{
  
  servo2.write(80);  // M2 foward
  servo8.write(120); // M8 foward
  delay(500);
  servo2.write(120); // M2 backwards
  servo8.write(90);  // M8 backwards
  
  delay(1000);
  
  servo4.write(120); // M4 fowards
  servo6.write(110);  // M6 fowards
  delay(500);
  servo4.write(80);  // M4 backwards
  servo6.write(140);  // M6 backwards
  
  delay(1000);
  
}

Step 12: Combining

Now, you  need to combing the forwards and backwards with the up and down to make it walk.

#include<Servo.h>

Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
Servo servo5;
Servo servo6;                     
Servo servo7;
Servo servo8;

void setup()
{
  servo1.attach(2);  // s is on pin 8
  servo2.attach(3);
  servo3.attach(4);
  servo4.attach(5);
  servo5.attach(6);
  servo6.attach(7);
  servo7.attach(8);
  servo8.attach(9);
 
}

void loop()

{
  servo1.write(50); // M1 Up
  servo7.write(50); // M1 Up
  delay(500);
  servo2.write(80);  // M2 foward
  servo8.write(120); // M8 foward
  delay(500);
  servo1.write(25); // M1 Down
  servo7.write(30); // M7 Down
  delay(500);
  servo2.write(120); // M2 backwards
  servo8.write(90);  // M8 backwards
  

  
  servo3.write(140); // M3 Up
  servo5.write(120); // M5 Up
  delay(500);
  servo4.write(120); // M4 fowards
  servo6.write(110);  // M6 fowards
  delay(500);
  servo3.write(160); // M3 Down
  servo5.write(145); // M5 Down
  delay(500);
  servo4.write(80);  // M4 backwards
  servo6.write(140);  // M6 backwards
  
 }


Step 13: Conclusion

Unfortunately, I wanted to call this the robot spider, but I couldn't really, because it doesn't react in any way with it's environment. I guess you could add some sensors or something like that, but this project really isn't mean't for that. I hope you enjoyed my instructable and If you have any questions or comments please post in the comment box below and I will attempt to answer them as best as I can!


No comments:

Post a Comment