For robotics and RC projects worldwide, the Tower Pro 9G Servos are crucial components since they can give controlled movement. But these servos have a problem. The basic definition of a servo is that it could rotate from 0 degrees to 180 degrees. But these servos can’t rotate a complete 180 degrees.
These servos show that error when tested with the Sweep.ino sketch in the Arduino’s Servo.h library. Factors like manufacturing defects, cheaper clones, etc. could be the cause of this error. But every Tower Pro 9G Servo I bought show the same error.
I was able to find the cause of error after digging through the servo’s datasheet and library files. The problem was not with the servos, but with the Servo.h library. This library predefines the range of the PWM signal that the Arduino uses to control a servo. Increasing this range of the pulse width can increase the range of rotation of the servo.
Exploring deeper, the Servo.h library had two functions that is not used in any example.
Servo.attach(PIN, MIN, MAX); // To redefine the minimum & maximum pulse width
Servo.writeMicroseconds(microSeconds); // To control the servo directly by specifying pulse width
The Servo Test Rig shown in the video is a build using 1/2″ – inch PVC pipes and joints. The setup held the servo and the protractor in such a way that the test could be done easily.
Using 3 potentiometers with same value but different map resolutions, The Super_Knob.ino controls the servo directly by writing microseconds of the PWM signal. While one pot tunes the values in multiples of 100s, the other two tunes the values in multiples of 10s and 2s to attain a specific even value in the redefined pulse range.
The circuit diagram and Super_Knob.ino sketch can be downloaded from the link below.