Arduin Uno -Robot Arm

Hi, before I begin, I would like to mention that I am a beginner in the field of electronics. I am currently wanting to have my next project be a simple robotic arm run on servos. As the “brain” I have an Arduino Uno. I would love to jump fully into the project except I have no idea for what I need. Heres what I had in mind for the finished product.

  1. Run by 5 servos (one for base rotation, three for arm hinges, one for claw. (Tower Pro - Micro . Servo 9g - SG90)
  2. Run by Arduino Uno
  3. Each servo connected to potentiomitor for individual control.

The place where I am stuck is what I would need to get it all to work. I have no idea if I would need a motor/servo shield of any kind or what kind of power supply. If anyone could help point me in the right direction for what I need that would be extremely helpful! Thanks! :grin:

Dead simple. The mechanical aspects of getting the servos to move the thing will be more difficult than the electronics: levers, gears, angles, mass, moments all that stuff.

You’ve got 6 analog pins on an Uno so there’s your limit on pots. Then 6 digital pins to control the servos, but you could have more servos if you control them other than with pots.

Power supply is easy to calc: forum wisdom is to budget 1A per servo, or at least per servo that may move at once. Seeing as you have two arms, you would need two friends to help you get all 6 to move at once.

Secret is to keep clear in your mind, that the Arduino never powers a servo, it merely controls them. So hook the power up to 6 as shown below for 3 servos… Connect the grounds as shown.

servo power.png

Take a look at this example:

 // Controlling a servo position using a potentiometer (variable resistor) 
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott> 

#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
 
int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin 
 
void setup() 
{ 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
} 
 
void loop() 
{ 
  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) 
  myservo.write(val);                  // sets the servo position according to the scaled value 
  delay(15);                           // waits for the servo to get there 
}

@Jimbo,

I’ve seen ads for High-Resolution servos. How is that possible ? Aren’t you always going to be limited
to only 180 positions due to the 0-180 range for the Servo Library ? Is there any way to have more
than that ?

raschemmel: I've seen ads for High-Resolution servos. How is that possible ? Aren't you always going to be limited to only 180 positions due to the 0-180 range for the Servo Library ? Is there any way to have more than that ?

Well with servo.writeMicroseconds() I guess you can use the resolution of the servo?

1500us is 90 degrees, 2000 is 180, so that's 500us per 90 degrees or 5.5us per degree.

So a single microsecond is about 1/5 of a degree if I have the maths correct?

(And don't forget servos aren't owned by the Arduino world: presumably their controllers in their home world of rc and stuff, have resolutions to match the servos?)

no need of shield ,, ! servo + and - is 5Volts ,, and signal pin is used for tx data !! about the potentio thingy ,, i can write a example tool GUI ,, in VB if you like to move the arm ! then when you have fixed moves ,, you can remember them in the arduino then eeprom save each step and play them if needed , you can add a touch resitor,for measure the presure of the claw ! then sett it so it wil never break a thing ! 8) nice project i am also busy builing one but stil need to print some parts ! LOL if you gone use big servo's then use a external 5 volt to give power to the servos

Dexterbot:
if you gone use big servo’s then use a external 5 volt to give power to the servos

ALWAYS use external power… it’s folly to try to use the Arduino 5V output, see my pic earlier.

Dexterbot: then when you have fixed moves ,, you can remember them in the arduino then eeprom save each step and play them if needed

That's not quite as simple as it seems because of the timing issues. Keep that for Phase2....

That's not quite as simple as it seems because of the timing issues. Keep that for Phase2....

yes it is , you devide it and save it , and when reading then times the devided !!

then use no timming but servo write ,, 0-180 easy to be stored ,, or when use timing you do above method

:D i made some antena trackers , so whe wil figure this out !! ;) its a robot arm , not a quadcopter ,, so if you want to use other servos full turning then it wil be a bit different ,, but still you can make it a hard easy job to say ,, 360 = servo.write 4005 and this 360 times ,,, LOL starting from 1 degrees ,, but there wil be a solution !

Dexterbot: yes it is , you devide it and save it , and when reading then times the devided !!

then use no timming but servo write ,, 0-180 easy to be stored ,, or when use timing you do above method

I don't follow that, but let's not dilute the OPs thread with something irrelevant right now. There are a number of threads discussing the storage of "waypoints" so to speak, and their playback.

i mean . you can make a list from position 1 to let say 180 ,,

eeprom servo arm 1 read = 2

if (mem = 2) servo arm 1 = servo.writemicrosecond = 1000 ; if (mem = 3) servo arm 1 = servo.writemicrosecond = 1025 ; and then this 180 times ,, LOL

but this is a weird way to do things ,, but is a starter ! :P

when using microseconds you wil have jitter because of spaces between 2 steps ,, let say i want to go 1 degree ,,i can write micro seconds ,, between 1000 and 1120 so i have 120 diferent ways to go to 1 degree , this wil give some isue on a robot arm i think , what do you think about this Jimboza ?

Dexterbot: what do you think about this Jimboza ?

I think it belongs in a thread of its own: why don't you start one?

It's diluting the OP's thread right now, when he's nowhere near wanting to do that kind of thing. (Or should I say, nowhere near ready to do it, even if he wants to.)

you are right ,, maybe i have to make one ,, but i already solved mine

butt yes he is still working it out , butt its not bad to see there is a solution before buying al kind of stuff , not working , or having a faulty project hanging around costing money and brain damage , :sweat_smile:

he now knows there is a solution and he wil find it on is own OP page butt i wil give the best answer !

YES YOU CAN BUILD IT , butt getting it to work is a different story if there is no start there wil be no finish !

but whe wil see this going , i hope !

and there are hundreds of robot arms sketches , but making you own is a nice way ! so maybe this post is also not needed :drooling_face:

Dexterbot: you are right ,, maybe i have to make one ,, but i already solved mine

All the more reason to post: let others see how you did it.

If you want to control your servos using joysticks that self-centre you may be interested in how it was done in this Thread about a model excavator.

...R

  1. Each servo connected to potentiomitor for individual control.

The “knob” servo example in the IDE is for a pot controlling a servo. I think I’ve seen some arms being controlled via pots on youtube. Note that the 9g servos are not very strong, so the arm may need to be built small with something like craft sticks. These small 9g servos are prone to stripping gears if heavly loaded or operated against the internal hard stop. I made the below servo/pot code to test controlling the servos over a network connection.

//zoomkat multi pot/servo test 3-23-13
//includes dead band for testing and limit servo hunting
//view output using the serial monitor

#include <Servo.h> 
Servo myservo1;  //declare servos
Servo myservo2;
Servo myservo3;
Servo myservo4;
Servo myservo5;

int potpin1 = 0;  //analog input pin A0
int potpin2 = 1;
int potpin3 = 2;
int potpin4 = 3;
int potpin5 = 4;

int newval1, oldval1;  //pot input values
int newval2, oldval2;
int newval3, oldval3;
int newval4, oldval4;
int newval5, oldval5;

void setup() 
{
  Serial.begin(9600);  
  myservo1.attach(2);  
  myservo2.attach(3);
  myservo3.attach(4);
  myservo4.attach(5);
  myservo5.attach(6);
  Serial.println("testing multi pot servo");  
}

void loop()
{ 
  newval1 = analogRead(potpin1);           
  newval1 = map(newval1, 0, 1023, 0, 179); 
  if (newval1 < (oldval1-2) || newval1 > (oldval1+2)){ //dead band 
    myservo1.write(newval1); //position the servo
    Serial.print(newval1); //print the new value for testing 
    Serial.print("a,");
    oldval1=newval1; //set the current old value
  }

  newval2 = analogRead(potpin2);
  newval2 = map(newval2, 0, 1023, 0, 179);
  if (newval2 < (oldval2-2) || newval2 > (oldval2+2)){  
    myservo2.write(newval2);
    Serial.print(newval2);
    Serial.print("b,");
    oldval2=newval2;
  }

  newval3 = analogRead(potpin3);           
  newval3 = map(newval3, 0, 1023, 0, 179); 
  if (newval1 < (oldval1-2) || newval3 > (oldval3+2)){  
    myservo1.write(newval3);
    Serial.print(newval3);
    Serial.print("c,");
    oldval3=newval3;
  }

  newval4 = analogRead(potpin4);           
  newval4 = map(newval4, 0, 1023, 0, 179); 
  if (newval1 < (oldval1-2) || newval4 > (oldval4+2)){  
    myservo1.write(newval4);
    Serial.print(newval4);
    Serial.print("d,");
    oldval4=newval4;
  }

  newval5 = analogRead(potpin5);           
  newval5 = map(newval5, 0, 1023, 0, 179); 
  if (newval1 < (oldval5-2) || newval5 > (oldval5+2)){  
    myservo1.write(newval5);
    Serial.print(newval5);
    Serial.print("e,");
    oldval5=newval5;
  } 
  delay(50);  //to slow loop for testing, adjust as needed
}

Thanks for all of the info! Can’t wait to start the build!