Introduction: How to Build a Robotic Arm

update: https://www.youtube.com/watch?v=BILiuqRmLRI

want to build the controller go to here

the video's:

http://www.youtube.com/watch?v=N9z7OQLlhrE

http://www.youtube.com/watch?v=jozshuI246o&feature=youtu.be

http://www.youtube.com/watch?v=onQIzR5C8qk

http://youtu.be/2mlR9QT1glo

https://www.youtube.com/watch?v=NkxTk2-RJ8A

http://youtu.be/FBZaummBF0s

making thee:
http://youtu.be/xH1IZFku0w0


hello everyone,

a while ago i was watching a program about a car factory, and they used robotic arm´s to put the car´s thogetter.
that was the moment were i got the idea of bulduig my one helping hand.
so a time ago i started building on this arm.
and now it is completed.
and i am conna show you how you can build one, or get you some idea´s.

to stared whit i whil sow you were it is build from;
for moving the robotic arm i used 6 servo´s
te body is build from 2mm lexan.
the statif is from a old disco ball (the part were the motor was mounted in)
and i used a distance sensor, and a 10mm led.

the brain is now a arduino, and a power circuit board.
the power it selve come´s from a computer power supply.


in this instructable i whil sow you how to build a robotic arm, and how to use the power supply
i hoop you enjoy it, and if you enjoy please vote for the contest´s

Who doesn't whant a thirt arm on their desk what can help you whit everything you want.
if you ask my it is a real enprovment to your lab.

and it cost less than $100 dollar :)

update in step 4, it now light's up in the dark :)

Step 1: Getting the Parts

oke let´s start building on this thing.
before we can start we need to get some part´s and plan´s.
what you whil need;


-6 servo´s (i used 2x mg946, 2x mg995, 2xf utuba s3003(mg995/mg946 is better then the futuba s3003, but they are much cheaper)) about 10 dollar a piece
-lexan 2mm (and a smal piece of 4mm) if you don´t have any, about 5 dollar for a nice piece
-distance sensor (hc-sr04) about 5 dollar
-10mm led (any color you like) 0,50 dollar
-stative (you need a box or someting like that to put your arm on) saved ;)
-claw(you can buy one on the internet) about 15 dollar

brain:

-arduino uno (i am working on my own comtroller, but arduino works fine) about 15 dollar
-power circuit board ( you need to make this, i come on this later, but it is not that spacial) free, you make it your self :)
-power supply (i used one from a old pc)  free!!
-pc to program the arm (when you are using a arduino you can use arduino developmer tool. whitch you can download from there site www.arduino.cc ) free (if you already have one)

you whil need some wire´s and basic tools
like a solder iron and solder. if you have them or lend them the are free to

now we got al the parts we can start building.

Step 2: Building the Body

Oke lets build the body, before we start i need to say that i have no drawing of it. I just did it out of my head. It principal is pritty simple
You have two rows of lexan to mount the servo's on tose long lexan pieces. And two rows to put the servo's in the rows whit two holes in it. and a U bracked piece on the end. The hand for the arm i jusy bought from the internet. I mounted almost everything whit screws. Becaus when you do somtimg wrong you can change it very eassy
the numbers behind the parts, can you find in the picture.
The lengt if the first part(1) is about 19 cm
And the second part(2) is about 17,5 cm
An the lengt of the front part(3) is 5,5 cm
For the rest it is a bit standaart just look what the besy demencions are for your robot, depents how big or small you want him. for the rest it doesn't realy matter what size you are using.

Now you probely have a idea of building your robitic arm.
The arm needs to rotate 180 degrees total. So we need to ad a servo under the robot. Make a hole in the box and put the servo in there. And screw the arm to the servo. I mount a ring(4) arount the servo so there was no distance between the box and the arm. You can do this if you need it.

To place the distance sensor i used a pice of 2mm lexan and screwed it to the robot hand. I also put a 10 mm led under the hand

You probely need a spring to help to servos for a better movement.

It is hard to explane how to build this, beceaus it is different for everyone. It just depents on the stuff you have/buy. For example if you have bigger servos you need other lexan parts.
And you need to calibrate your robot so it is straight. And whit other parts it is diffrent(so it is not shaking and has a nice movement).
If it is shaking you can ad some weight to the arm. This probely solve the problem

When you build your one body you need to make the servo motor wires longer. Just grap some wire (i used a internet cable whit´s i cut open) and solder 3 pin headers to it. Some heatsinking over it and stick it in the conector. and make a other female connector on the other side. to connect it to the power supply board.

Now we have the body we can move on to the brain :)

Step 3: Using the Robotic Claw

for the installing of the robotic claw, you need;
a servo(can be a futuba s3003 (or another standaard servo) mg995 or mg946 wil work the best))
and you need some screws

so what do you do.
you take a servo bracked and cut it until it fits in the robotic claw.
than you need to use two smal screws to put it in place.

next you take the servo and twist it al the way to the left
now you need to close the claw.

now you are able to put the servo in place with 4 bolds, make sure the servo is al the way twisted to the left
and that the claw is closed when mounting the servo in.
or the claw won't open at all.

now you can plug the servo in to a arduino or a servo tester
if you did it al correct you have now a succes operating robotic claw


make sure that the bolds on the moving parts are not over tightened
or it won't work great.

Step 4: Hardware Update

i made a lite update to the robotic arm.
i insert some lights what lights up in the dark.
i used a simple circuit what is really easy to make.

http://www.youtube.com/watch?v=N9z7OQLlhrE

the only thing you need to do, is to find a place to put you led's in.

circuit;
if you prefer you can change the R1 resistor by a 100k ohm potenionmeter.
so it wil light up with more or less light.
and for R2 i used a 118 ohm resistor what works fine wily using 7 led's

if you whant a contra effect you just change R1 with the LDR and it wily light up in the light
and sut's down in the dark.


so the parts;
-R1 100k ohm ressistor
-R2 118ohm ressistor
-bc547 transistor
-LDR
-7 led's 5mm(can be any color)
-on/off switch

Step 5: The Brain

For the brain i used a arduino. Until i finised my one controller.

I used a conector from a pc module to connect the powerboard whit the power supply
If you connect red and blank to a multiemeter
You wil see 5v (for the servos and the distance sensor)
And whit yellow and black you get 12v (for the arduino)
What i did is pritty simple
I made 5 servo connectors, solder the positive in parall to 5v and negative to ground
I did the same whit the ds sensor

Then i solder some pinheaders and connected the signals pins of the servos to they pinheaders and the 2 middel pins from they sensor also.
Now we can connect it whit the arduino by using some jumpers
it doesnt matter whits pin you connect it on the arduino. As long as you say in your program that you connected it to that pin.

On the powerboard i also ad a led to indicate the power is on. Just add a 100 ohm ressistor to 5v, and the other and of the led to ground. And your done. :)

the 10mm led on the robot is just connected the the arduino, a ressistor of 100 ohm goes from pin 13 to the positive pin from the led and  the negative goes to ground.
you can turn it on and off in you program.

i used 5 servo connector´s for 6 servo´s, beceaus the 2 servo´s on the bottem are using the same signal. you need to solder those wires to getter, and plug them in to the power board

we need some power now, don´t use a adapter for this, it just can´t handel the power what the arm needs.
use a pc power supply, just connect the green wire whit a black wire. and the powersupply run´s and give´s you power.
if you don´t connect these wire´s nothing happend, you need to bind these wire´s together.

the signal pins from the servo motors, can you just plug in to a pwm channel on your arduino. that are the pins whit this before it ~
the distance sensor can you plug in to pin 6 and 7. and the led to 13 and ground. that are al the pins that you need to use.
it doesn´t matter how you cennect the servo´s as long as this symboly ~ stands for the pin number. 

Now you can program the arduino
Make sure you turn the powersupply off before pluging the usb cable in.
And remove the usb when you want to test your code on your robotic arm.
otherwishe the aruido gets 5v from the usb and 12 from the power supply
and the power of the usb goes in to the powersupply and the powersuppply whil sut down (for security ressons).

The phone connector you can see on the picture is just a connector for the distance sensor. But you can use any connector you like. 

like you can see in the scematic, i ad a Potentiometer to control the servo. the only thin you need to do is to repeat this whit 5 signals voor the 6 servo´s. the pot is not nessersery but the code won´t work if you dont ad the Potentiometer´s.
the other 5 Potentiometer can you just plug in to anolog pin 0,1,2,3 and 4

Step 6: Program and Using

You can simply write a code c++
For example you can say

myservo.writeMicroseconds(somthing between the 0 and 3000)

This way you can make a nice movement.
i will uplode a video for more details soon.
And if you are better you can use the distance sensor and let him react to that(see the next step).


I used 5 Potentiometer to control the arm(if you want you can use 1 potentionmeter and two joysticks,if you have them). the scematic can you find in the previos stap. the code can you find here.
just plug everything in and have some fun.

Here are some video's of the arm im working
I hope you like it. And have an idea about making you own.

the video's:
http://www.youtube.com/watch?v=N9z7OQLlhrE

http://www.youtube.com/watch?v=jozshuI246o&feature=youtu.be

http://www.youtube.com/watch?v=onQIzR5C8qk

https://www.youtube.com/watch?v=NkxTk2-RJ8A

http://youtu.be/2mlR9QT1glo

http://youtu.be/FBZaummBF0s

making thee:
http://youtu.be/xH1IZFku0w0

Sorry if my englisch wasn't that good, but i do my best.

In the video's you whil see the robotic arm how it is now. i had to change my desing a couple of times and replace parts. And servo's beceaus the servos i used in The begining, were to weak you need to use a mg995 or mg946, only the servo for the hand and to rotate the arm, can be a cheap servo (futuba s3003), but a mg995 or mg946 would by better

the code.


// Controlling a servo position using a potentiometer (variable resistor)
// modified by Attila Tullner
//10k ohm potentiometer

#include



int led = 13;
Servo myservo1;
Servo myservo2;
Servo myservo3;
Servo myservo4;
Servo myservo5;

int potpin = 0; // analog pin used to connect the potentiometer
int potpin1 =1;
int potpin2 =2;
int potpin3 =3;
int potpin4 =4;
int val; // variable to read the value from the analog pin

void setup()
{
myservo1.attach(3);
myservo2.attach(5);
myservo3.attach(9);
myservo4.attach(10);
myservo5.attach(11);
pinMode(led, OUTPUT);
}

void loop()
{ //servo 1 analog pin 0
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo1.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there

val = analogRead(potpin1); // servo 2 analog pin 1
val = map(val, 0, 1023, 0, 179);
myservo2.write(val);
delay(15);

val = analogRead(potpin2); // servo 3 analog pin 2
val = map(val, 0, 1023, 0, 179);
myservo3.write(val);
delay(15);

val = analogRead(potpin3); // servo 4 analog pin 3
val = map(val, 0, 1023, 0, 179);
myservo4.write(val);
delay(15);

val = analogRead(potpin4); // servo 5 analog pin 4
val = map(val, 0, 1023, 0, 179);
myservo5.write(val);
delay(15);
}

Step 7: Programming With the Distance Sensor

this is probely the greatest thing of the robotic arm
it has a distance sensor, and it can react to that
i wil sow you how you are able to program that by you own.

it is written in c++
the first thing you see is this

#define trigPin 7                            //toevoegen aan code
#define echoPin 6        
#define led 13
#include <Servo.h>

now we are including the servo's, led, and the distance sensor to the code. you don't have to change anything on here.

after that you see this;

Servo myservo1;                             //naam geven
Servo myservo2;
Servo myservo3;
Servo myservo4;     
Servo myservo5;

now have we give al the 5 signals(6 servo's) a name(can be anything you like)

next;

void setup() {
  Serial.begin (9600);
  pinMode(trigPin, OUTPUT);                   //aanstluiting op arduino
  pinMode(echoPin, INPUT);
  pinMode(led, OUTPUT);
  myservo1.attach(3);
  myservo2.attach(5);
  myservo3.attach(9);
  myservo4.attach(10);
  myservo5.attach(11);

}
now we are telling the arduino to which pin the servo's and distance sensor are connected, again you don't have to touch this

next;

void position1(){                          // positie 1

    digitalWrite(led, HIGH);      // led goes on
    myservo2.writeMicroseconds(1300);
    myservo3.writeMicroseconds(1300);
    myservo4.writeMicroseconds(800);
    myservo5.writeMicroseconds(1000);
    }
this is something you can change, i made a position and call this position1. now i  can use this position later on in my code.
if you want an other movement, change the numbers between the () to something between the 0 and 3000.

after;
void position2(){                             //positie 2

      digitalWrite(led,LOW);       // led goes out
      myservo2.writeMicroseconds(1200);
      myservo3.writeMicroseconds(1300);
      myservo4.writeMicroseconds(1400);
      myservo5.writeMicroseconds(2200);
}
this is the same as before only this is my position2, now you can modified the position's and add more if you want.

then you see this;

void loop() {
  long duration, distance;
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;

now the real code start working, don't touch this part this is just something to set the distance sensor up.

and then;

if (distance <= 30) {                     //do positie 1
  position1();
}
  else {
  position2();                              //do positie 2
}

   if (distance < 10) {
      myservo5.writeMicroseconds(2200);       //open klauw
}
  else {

     myservo5.writeMicroseconds(1000);          //sluit klauw
}
-------------------------------------------------------------------------------------
now you can add a movement to a distance. you do that this way.
if(distance <=30){  //you are now saying, if the distance is less or is 30 cm. he goes to position1
position1();    //the arm mow does everything you put between those brakeds { }
}

else{            //  if the distance is greater than 30 cm it does position2
position()2    // it does now everything you put between tose brakeds { }
}

now you can ad this whit every distance you like, and let him do anything you like.


the lest part of the code.

if (distance > 30 || distance <= 0){
    Serial.println("Out of range");             //buiten berijk, als het groter dan 30 of kleiner dan 0 is

  }
  else {
    Serial.print(distance);
    Serial.println(" cm");                     //distance in cm


  }
  delay(500);                                      //wacht 0,5 seconde
}

you don't have to change anything here, the only thing could be that you change "cm" into "inch" but i haven't tried that yet. so i don't now or that will work great.


i hope you now al understand  how you can make your one movement to a distance.

have fun with you robotic arm

Step 8: Future

i work on more code´s to get a better robotic arm, when i have new code´s i wil upload them.
the software can do the big thing, you can let him do anything you like
can be realy handy. but it is on you to desside what to do whit it.
i have now everything mounted inside the box, so no lose wire´s anymore.
you can control the arm now by using some potionenmeters or with the disstance sensor

and if you don't now were this arm is good for. 
think again.

program him so it can brush you theet, or make your coffee
who doesn't whant that, so start building today.
and get a cheap buttler ;)




Step 9: Vote and Search

If you like this instructable.
Please vote for the make your lab, and hacking hardware contest.
and follow my

If you have any comments please leave them behind

i hope you have now some good idea's about building your own robotic arm.

thanks for reading (or just watching the picture's)

Build My Lab Contest

Participated in the
Build My Lab Contest

Hardware Hacking

Participated in the
Hardware Hacking

Make It Glow Contest

Participated in the
Make It Glow Contest