Close

An update on dealing with Servos

A project log for T85 Target

A mini Attiny85 target dev board

mcunerdmcu_nerd 04/06/2016 at 19:470 Comments

My servo demo worked fine on SG90 but when I tried it with a MG90S (essentially a metal geared version of the SG90) that I got today wouldn't work right. I hypothesized the reason for the problem was due to the frequency of the PWM signal sent to the servo has being too far off of 50Hz for the MG90S.

With the Attiny85, I managed to (at least theoretically) get very close to 50 Hz, but not spot on. I pulled out my Arduino Uno, and thanks to it's 16 bit timer I managed to get (a theoretical) 50Hz signal. I hooked up the MG90S to the Uno and it worked perfectly. I took frequency measurements of the PWM signals from the Attiny and Uno using my multimeter and got the following results:

50.76Hz from the Attiny85

49.99Hz PWM signal from the Uno

The PWM signal from the Attiny85 isn't off 50Hz by much but apparently my MG90S wants a practically spot-on 50Hz signal.

I decided to play with OCR0A value a bit to get closer to 50Hz and managed to get the MG90S to sometimes work with a PWM frequency of 49.5Hz from the Attiny85, but even then, it still tends to act up.

Lesson learned: Some servos demand a practically spot-on 50Hz signal to work properly.

Discussions