Further experimentation with servo PWM frequencies

As a follow up on a previous post

formatting link
I wanted to mention that today I implemented a feature where I can adjust PWM pulse frequencies on the fly. Whereas before I had found that my servos (Hitec HS-81MGs) would not be able to stabilize on a position at frequencies above about 80Hz, today I've found something slightly different. That limit only holds true when the servo's output shaft is a long ways away from the pwm signal's pulsewidth's matching angle. Thus when you first turn the servo on (as I was doing in my first experiment) - at too high of a PWM frequency they will indeed oscillate pretty terribly and sometimes never stabilize (well, at least not in a minute or so - I lost patience after that). But if you first let it stabilize at an angle (by using a lower PWM frequency), and then increase the PWM frequency, it will hold the angle beautifully. Once it has reached a steady state for a constant PWM pulsewidth at a high frequency, if you gradually adjust the PWM pulsewidth it will track the signal beautifully. Thus I'm going to be changing my code so that on power up the PWM signal is at

50Hz, but as soon as the servos have stabilized I'll increase the frequency.

I've found that reference tracking is much, much better at higher frequencies, and disturbance rejection is also much, much better at higher frequencies. Whereas before at 50Hz when I would torque an output shaft I could feel it vibrating, now the vibration is pretty much gone. The shaft is just solid. Similarly, when I'd move the foot of a leg on my robot in a straight line I could see it jerk around a little bit, but now, it moves almost perfectly straight. Power consumption is definitely higher, but oh well. Glad I'm using li- polys :) I'm going to try to get some quantitative results with regards to power consumption tomorrow. I wish I knew more about how this affects the life of the servo though - as that is my only worry. It'd be a tad spendy to replace all 18 of my servos...

I went up to 100Hz and everything just kept getting better and better. The way my PWM pulse generation is set up I can't go much higher than that without making some fairly major changes to my code, as I originally designed it to only drive the servos at 50Hz.

Hope somebody finds this information useful.

-Mike

Reply to
Mike
Loading thread data ...

Absolutely! I've only experimented a little for my own designs, but I've always thought there is a huge gap between the available serial servo controllers and what analog servos are capable of -- with a little creative effort.

Do experiment with slower frame rates if the motor doesn't need the holding torque. For a bipedal or walking robot it's a foregone conclusion you will need maximum torque pretty much at all times. But for rolling robots and basic push-pull applications, it's often possible to reduce or even completely remove the pulses from the servo. (This is what I always do with servos modified for continuous rotation...to make them stop I never try to hit that 1500 us middle-ground, which drifts anyway.)

A hobby servo has *maybe* 100 hours MTBF, and with increased current, I'm betting you'll get 50+ hours. If you add up the actual hours your robot is powered while you play with it, I think you'll find you'll still get lots of enjoyment out of your investment (knock on wood).

There's really no way to tell for sure how much shorter the motors will last, because there is so much variation in their design and quality. What will go first is the little wire brushes inside. If you're using coreless servos they ought to last a little while longer than regular PM motors. These have greater brush and commutator life, and are popular among the heli users. They are also more expensive.

-- Gordon

Reply to
Gordon McComb

To update my post - I did some measurements today. Under a normal load at 50Hz the HS-81MG is drawing about 200ma. At 100Hz it is drawing about 280ma. At 125Hz it is drawing about 290ma.

I find it interesting that the current appears to be tapering off, though I suppose it makes sense since the motor spends less time unpowered so it has less time to move away from the correct position.

Performance seemed very similar between 100Hz and 125Hz, which again makes sense. There is a huge gain going from 50 to 75, smaller gain from 75 to 100, and hardly any gain in performance going from 100 to

125. I wish I had proper equipment to do these measurements, but my eyes and ears have served me pretty well thus far so I just have to trust them. However - a note about running it at 125Hz! At this refresh rate, the servo holds positions very well - better than at 100Hz. But if you try to make it move - it just loses control. It starts oscillating quite badly - oscillating with a magnitude of maybe 20 degrees or so. Not pretty. But for holding a position it gives alot of torque.

I still think I'm going to move away from servos and design my own geared motor systems, but this absolutely massive performance boost that I'm getting from increasing the refresh rate makes that less of a priority. It seems that 100Hz is the sweet spot, as long as you don't change the PWM pulsewidth rapidly, so I'm going to make that my normal refresh rate.

-Mike

Reply to
Mike

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.