servo command

Denzel

Senior Member
I need to control two servos at once for the shoulder of a robotic arm so they need to move at exactly the same time and exactly the same degree turn. Im confused after reading the manual as it sais the servo command stops only when another servo command is reached or the pin is put high or low. does this mean I cannot control two servos at once? or should I connect both servos two one output of the picaxe (28x)? after testing this code:
main:
servo 1,75
pause 500
servo 2,100
pause 500
goto main
with the prog editor simulator it shows that pin 1 stays pulsed while pin 2 is pulsed also???
 

BeanieBots

Moderator
You can control as many servos simultaneoulsy as you have 'normal' output pins.
You can't move them at EXACTLY the same time because each one must be sent the command individually so there there will be at least a one line time delay of ~250uS.
It IS possible to have more than one servo on the same output pin but obviously they will both have identical movements.

Remember, servo is a background task. The pulses will be continuous until specifically stopped.
Forget trying to do anything with servo in the simulator. What would you expect to simulate? It's a hardware interaction.

You can also control more than one servo at the same time with pulsout.
See the Hexapod thread. It moves both sets of legs at the same time by interleaving pulses to each of the servos.
 

Wrenow

Senior Member
When having 2 servos on the same joint that need to move the exact same amount at the same time, you may well run into a problem with variations/tolerances in the individual servos resulting in the servos "fighting" each other. This is usually a bit better if you have 2 servos of the same brand and model, but that is not a sure cure. Futaba and others make servo "balancers" for just this problem. Digital servos, properly programmed, while expensive, are another solution.

You do not need, nor want, a pause between the commands to the different servos, only at the end of the string of servo commands.

Keep in mind that you will have more control using pulsout, but it does not run in the background.

Also, keep in mind that the servo likes an update every 20Ms or it will not hold its position against external forces (might be important with a robotic arm).

Hope that helps,

Wreno
 

Denzel

Senior Member
The two servos are exactly the same brand and model as I bought them specific so that should help.
Ill connect both servos to the same output which will give them identical movement.

Thanks
 

leftyretro

New Member
I don't think that will work. Mounting of the two 'shoulder' servos opposing like that, won't the servo wheels turn in opposite directions and just fight each other? If you rotated one shoulder servo mounting of one servo so that the wheels turned in the same direction then you would have different angle moments on the shoulder arms and that would not work well either?

I think you need to drive each shoulder servo separately and their pulses would have to be calculated separately so that one turns CW and the other CCW but by the same amount.

At least that's how I see it, but maybe I'm all wet.

"it's only complicated if you understand it" :p

Lefty
 

Denzel

Senior Member
yes

Thats correct. The cad drawing is based on the servos wired independantly so that they can be controlled seperately. Because I will now have both servos connected to the same servo the design will need to be modified...
the two servos will be placed as so that one servo will be in the center of the shoulder and the other on the outside of the shoulder so they are in the same position
 

leftyretro

New Member
Heres an example of how the servos would be set up....
OK better. While identical servos should track close enough to work, there can be small tracking variation between even identical servos as differences in position pot and gear clearances, etc can have an effect.

A more correct mechanical design would use just one larger servo rated for the required torque and mechanicly link it a single pivit point. even R/C type servos come in many different sizes, some as small as a thumb nail and some as large as a fist :eek:

Lefty
 

tmack

Member
You could use 2

I am a novice but what comes to my mind is using 1 output pin from the 28x to go into 2 seperate 08m's. Each o8 could sense the pin going high and send its servo in the correct pulse to get its correct direction .This would be at the same time because they are both getting their signal from the same output pin of the 28x. If that makes sense .I think you could put the output pins from the 08s in parallel with other pins from the 28x in case you then wanted the servos to work individually. So if you wanted them to work individually you could send the pulses right from the 28x. If you wanted them to work at the same time you could send each one its seperate signal from the output pin of the 28 then into the seperate 08s at the same time and then to the servo.
 

steliosm

Senior Member
Denzel, since moving a servo is only based to sending pulses out the Pin that the servo is connected to, you basicaly rely on how fast the PicAxe can move from one command to the other.
For your needs you should probably try with two servo commands but witout the 'pause' statement between those two commands.

So, you shoud end up with something like:

main:
' Move one servo up and the other down
servo 1, 75
servo 4, 225

And yes, the movement of the servo's might end but the pins will always send out pulses, since this is how the servo works.
 

Denzel

Senior Member
Thanks

I have taken this all into account. I have purchased two identical metal gear 2 ball bearing servos of 8kg torque for the shoulder which should provide plenty of power and as they are higher quality they are surley more accurate....
I purchased a single 6.5kg torque 2bb servo for the elbow.

thinking about controling the servos seperately I was going to increase the MHz of the 28x but according to the manual the servo command will only work at 4MHz so speeding up commands that way is out of the question so perhaps I will stick with my second setup and wire the two servos from the same output.

thanks
 

Wrenow

Senior Member
OK better. While identical servos should track close enough to work, there can be small tracking variation between even identical servos as differences in position pot and gear clearances, etc can have an effect.

A more correct mechanical design would use just one larger servo rated for the required torque and mechanicly link it a single pivit point. even R/C type servos come in many different sizes, some as small as a thumb nail and some as large as a fist :eek:

Lefty
Exactly right. That is why there are servo balancers available. Also the geared servo http://servocity.com/html/servo_power_gearboxes.html would increase the torque substantially, making it relatively easy to use a single servo.

An example of a servo synchronizer that also does the reversing on his original design is http://servocity.com/html/servo_synchronizer.html.


Wreno
 
Last edited:
Top