Servos

Status
Not open for further replies.

Jevon

New Member
Help with digitals - This is my first time using servos and I understand how standard analogue servos are controlled. PWM-20ms cycles (50Hz) with the duty cycle determining its position. duty cycle normally 1.5ms for neutral position. Can't seem to find somewhere that explains how a digital servo is controlled. Assuming its PWM. What pwm does it need... freq. and duty cycle?
 
They are controlled the same way. THe onyl difference is how it's working inside- a digital servo uses a microprocessor while a regular (analog) servo uses other circuitry.

The servo responds to the length of the "on-time" of the pulse to determine its position rather than duty cycle or frequency (within limits of course). The off-time doesn't affect anything. YOu just have to make sure to send the "on" pulses frequently enough so the servo doesn't go to sleep.
 
thanks, was hoping it was the same. understand what you mean pulse just needing to be frequent enough.

will give it go now
 
having trouble my servos... they oscillate when given a pulse. the servo oscillate between about 5 degrees...thats not good. Any ideas on how to stop that?
 
tried varying the frequency of my pulses... but didn't help. the oscillation simply speed up or slowed down, but still oscillated. I've created my own PWM using timers on my micro and checked the control signal with an oscilloscope... seems right. Also tried using a pull-up resistor on the output of the micro... but was being optimistic to think that would help
 
ok... you were right. looking closer at my pulses... the on time of the pulse wasn't as stable as i thought it was. the on time pulse was varying between 4.9V and 4.5V... worked out that the 5V reg. that supplies the micro wanted a higher voltage, so just up its supplies to 9V and all my problems dissappeared... thank the pope!
 
Its always a good idea to put a capasitor on the suply for your elecronics when working with servos. They like to drain "high" currents when they get stuck and it can cause your microcontroller to "brown out", meaning it basicly resets the program. This can have very weird efects, similar to what you describe (depending on the program ofcourse)

Another tihng to look at is the timers. Remeber that the while inside an interupt service routine the timer interupts wont trigger (until the isr your alrdy inside has finished). Ive seen weird things happen in my bots due to this, typicaly changing positions slightly almost at random. (of course there is no such thing as random, but it looks like it, think this is how they invented hip-hop)

About servo controlsignals:

The actualy frequncy is not that important. most servos can handle a pwm frequncy of between 50 and 60 Hz, so i usualy make mine 55. It is the length of each pulse that is critical. The center position is "always" 1500 us, with the + or - depending on the servos. Tho most servos has the max turn of 60 degrees at 500 us, there are others, like the hitech HS-485 wich has a turn angle of more then 180. Here you might want the puls with to be in the range 500 - 2500 us. A typical source of weird servo behavior for me seems to be bugs in the code, either screwing up the pulse length when calulating it, or some code that is preventing the signals from changing at the corect time. A simple way to test that is to write a small test program using a delay_us function to generate an acurat PWM signal, disabling all other software. That way you can at least test if it realy is your PWM signal that causes the isues.
 
Last edited:
Thanks for the help, tried what was said, its helping. Does the accuracy of analogue servos depend only on the resolution of the PWM, or is there a set accuracy?
 
Last edited:
The "real" accuracy of the servo is probably only to within a couple percent of the full rotation - at the lowest level the linearity of the control pot will determine how correct the angle output is.

The resolution of the servo is determined mostly by the "deadband" built into the control loop. Without this deadband, the servo will continuously seek back and forth - killing the gears in short order. One way of testing this is to adjust the PWM value by one, and see when the servo "kicks" over to the next position.

All these things depend on the servo and it's settings, so it's pretty hard to tell what the actual numbers are.

BTW, last time I played with servo's, they really didn't handle update rates >>50Hz - they would just madly jitter.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…