Driving servos
By robodaddy
2008-08-18 15:50
2008-08-18 15:50
Here ( http://letsmakerobots.com/node/80 ) Frits had mentioned that either Arduino or PICAXE can control such and such number of servos. I'm pretty new to microcontroller world, so maybe my question will sounds a bit stupid... but I don't really get what we mean by saying "can only control X servos"? Does it actually mean, "platform X can have up to N serial outputs"? Because, AFAIK that's what servos are, aren't they?
Now, I can understand that PICAXE has also limitations due to the built-in Basic interpreter; but why Arduino?
Maybe I'm just misinterpreting the concept of how the servos work though...

To control a servo you need
Thanks, this is really
Servo pulses
A couple of other things to note about R/C servos and the pulses you'll need to generate. The pulse must be sent to the servo roughly 50 times per second, so that's 20ms between pulses. The repition rate is not critical, but it it's too low, the servo will buzz.
You'll need to make sure that every pulse is exactly the same width, when the servo isn't moving. Any variation in pulse width will make the servo move (of course), something known as jitter. So if you have any timing uncertainties (e.g. use of interrupts, memory refresh, DMA activity) in your code, the servo will jitter. This is one reason why microcontrollers make better development machines than full-size PCs for this sort of thing.
I think the hard part of servo driving is to get smooth changes in pulse width from a microcontroller that's doing many other things at the same time (e.g. driving other servos!).
Thanks, anachrocomputer,
Thanks, anachrocomputer, your remarks are always very informative.
Now, even supposing Arduino controls similar (more or less) number of servos - what are real advantages of that platform over PICAXE? Isn't it just common argument between "ready building blocks" and "highly customizable", Windows vs. Linux, C#/.Net vs. C/asm, etc? :)
Does Arduino platform have more memory (can it use more memory) than say PICAXE-40? Is Arduino significantly faster?
Arduino has USB as part of the platform... which is good, but not that important... what else?
I'm not trying to start a "religious war" here, rather trying to understand whether it worth to stick to PICAXE-28 or 40 for a bigger project... or maybe it worth trying Arduino. (Neither C/C++ vs. Basic or Windows vs. Linux is a bid deal for me, I'm fine with any language and/or OS.) PICAXE definitely looks SUPER-easy to work with.
Very interesting post :)For
Very interesting post :)
For what i've read on arduino, there is a library called Servo that will handle most of the work. You just have to call "refresh" every TOT time, once only for all servos. Looks easy to use.
I'll buy some servos asap :P
my servo has done nothing but jitter
Does anyone have an idea about servo/controller compatability as far as voltage? Not knowing anything about servos, i ordered a GWS servo (S03T) that doesn't respond at all to the digital signal from my picaxe board. however, when i connect or disconnect from the V1, I get this little "wiggle" from it.
I'm assuming that the digital out doesn't have enough juice to push the servo?
Servo voltage
According to the data for that servo, you should be able to drive it with normal 5V pulses. Are you running your PICAXE from 5Volts? If you are, then it's possible that there's a mix-up with either which pin you're driving, or the pin setup, or the software that's generating the servo pulses. If you have an oscilloscope, check for pluses of about 1-2ms width, every 20ms or so. If you haven't, then the first thing to do is to make sure that the pin you've chosen is set up as an output (and not as an input). Then, how about a little diagnostic test with an LED? If you slow down your pulse generation code by a factor of, say, 100 then you should see 100-200ms pulses every 2 seconds, which is slow enough to check with an LED/resistor.
But you don't say how you're generating the pulses -- your own pulse-timing code? Or a PICAXE library routine? Or something else?
servo voltage
on picaxe 28 board, i'm connecting it to a digital out. In my Picaxe programmer i enter:
servo 1, 100
servo 1, 80
servo 1, 120
...etc, just to see if i will get anything. I don't. When i connect to a Futaba 3000, it works as intended.
You also need to put some
Try those pauses
check the pin layout like
check the pin layout like anachro mentioned....aside from that, it could be a bad servo.....
I've run 5 different types of servoes form an 08m(as well as an 18x and 14m) without issue. the only thing I've noticed is that the throw is slightly different from one to the other when I was testing them.
You could through a cap in the mix as well(connected between the + and - ) to smooth some of the jitter or use a seperate power source. Using a 470uf cap worked for me.
Make sure you are using the
I was wondering , how do i
You put them on a different
You put them on a different output pin and call them as such:
servo 0, 100
servo 1, 100
servo 2, 100
This would make servos on output pin 0, 1 and 2 and move to position 100.
thanks, do you think thw
Documentation says so, but I
tryed it and it seems to
Maybe... If you need all
Maybe... If you need all three servos to move at once and at their top speed/torque... yes. If speed/torque etc isn't important then no. If you fire your servos at once (Steppenwolf reference somewhat intended) then they may fight for current and not operate as quickly as they would on another power source.
Try them all on the same power source as the processor and then move to P2 if needed.
yea i was thinking the same