When debugging control systems for a 9G micro servo motor, it helps to check under the hood.
Recently, I built a rotating mount for a medium wave frame loop antenna. The rotation is accomplished by a pair of 9G micro servo motors controlled by an Arduino. These servo motors are moved by a short pulse sent by the computer fifty times a second. The length of the pulse (nominally ranging from 1 to 2 milliseconds) determines the position of the servo. A 1 millisecond pulse rotates the motor to 0, a 1.5 millisecond pulse to 90 and a 2 millisecond pulse to 180 degrees.
The above picture shows these signals being sent. The top trace is the pan motor and the bottom trace is the tilt motor.
While testing, however, I found that the servos would sometimes stall and require the whole system to be reset. This happened often. Everything worked fine. And then it didn’t.
Monitoring the current being used by the motors, I found something puzzling. Normally, the servo draws a lot of current while the motor is turning, and very little current when stopped. However, near the bottom of its range, my servos were drawing too much current. And that is when the stalling problem occurred.
9G Micro Servo and the Arduino Servo Library
Reading the documentation for the Arduino Servo library, I noticed that by default, the range of control pulses used is 540 to 2400 microseconds, rather than the standard 1000-2000 microseconds. All of the problems were happening at the low end of the range, when the Arduino was sending pulses less than 1 millisecond.
I tested all three of my 9G micro servos using the current meter, and wrote down the points at which the stalling (excessive current drain) started. This point ranged from 650-900 microseconds. The Arduino Servo library provides the ability to override the default values. So I reprogrammed the controller to limit the low-end pulse to start above the stalling points. For example, one of my motors is now set to run from 850 to 2400 microseconds. It works perfectly.
So, the learning here is to do a bit of digging under the hood when setting up Arduino code to run your 9G Micro Servo motors. Running the servo with “out of range” pulses can produce unpredictable results and possibly damage to the servo.
If you have an oscilloscope, it’s a handy tool to visualize what is happening on the control and power lines connecting things together. It also helps to have a bench power supply that easily measures current as well as voltage.