Servo Deadband Correction
Introduction: Servo Deadband Correction
Analog servos require the pulse-width to change by up to 10 microseconds before they start to move. This represents an error of almost 2 degrees. [1]
This instructable explains how to significantly reduce the deadband errors in the servo plotter described in https://www.instructables.com/Servo-Plotter/
Images
* Photo 1 shows the orginal servo plotter
* The lower trace in photo2 shows two overlaid squares. One square is plotted clockwise (CW) ... the other is plotted counter-clockwise (CCW). Deadband is distorting the squares and causing the diagonals to separate.
* The upper trace in photo2 shows the improvement when deadband compensation is applied.
* The video shows servo plotter 2 in action ... 134
note the deadband improvement
The cost of the push-switches for this project is less than $5.00
Notes
[1]
For a standard servo:
* 500uS produces 0 degrees
* 1000uS produces 90 degrees
* 1500uS produces 180 degrees
* 1 degree equates to (1500-500)/180uS = 5.5uS
* 10uS equates to 10/5.5 = 1.8 degrees
Step 1: Reducing Mechanical Errors
Photo 1 shows the penlift in instructable https://www.instructables.com/Servo-Plotter/.
This simple penlift has a serious problem ... the servo horn tends to displace plotter arm 2 sideways when it is raised and lowered.
Rotating the SG90 servo 90 degrees doesn’t fix the problem as the servo horn is now off-center causing arm2 to twist.
Arm 2 is replaced in Photos 2, 3, 4 with a length of 3mm aluminium extrusion to which an alternate design penlift is attached.
Only the pen touches the paper under its own weight ... the servo arms are no longer displaced.
Now that the mechanical errors have been minimised (there is still a tiny backlash in the gears) lets modify the circuit.
Step 2: Circuit Diagram
The circuit and parts are the same as for the plotter described in https://www.instructables.com/Servo-Plotter/ with the addition of two push-switches.
These push-switches allow you to increase/decrease the servo pulse widths under menu control.
The cost of the push-switches for this project is less than $5.00
Step 3: Installing the Software
Method:
* Copy the attached file “servo_plotter_10.ino” into an Arduino sketch and save it to a folder using the same name but without the .ino extension.
* Copy myServo.h into the folder you have just created. [1]
* Copy myServo.cpp into the folder you have just created. [1]
* Compile and upload “servo_plotter_10” to your Arduino.
* Set your Arduino “Serial Monitor” to 9600 bauds.
* The menu in photo should appear.
Caution:
[1]
The above files, myServo.h and myServo.cpp, are different from those of the same name in https://www.instructables.com/Servo-Plotter/
15 January 2022
Alternate software using a PCA9685 servo shield has been posted here https://www.instructables.com/ArduinoServo-Shield/
Step 4: Calibrating the Servos
Servo Arm 1
* Draw radials at 10 degree intervals as shown in photo 1
* Select menu option T4 ... numbers should start scolling on your monitor.
* Press the “decrease” button until the servo is fully left (0 degrees)
* Now press the “increase” button and record the microseconds every 10 degrees.
* If you overshoot press the decrease button and approach the overshot point in a CW direction.
* You should now have 19 measurements.
* Repeat the process, this time recording the pulsewidths every 10 degrees in a CCW direction.
* Enter these values into spreadsheet as shown in photo 2
* Subtract the readings at each 10 degrees interval
* Sum these readings and divide by 19 ... this your servo deadband.
* Record this reading as “deadband1” in the “servo_plotter_10.ino” file header.
* Record the CCW reading for 90 degrees in the “servo1_90” header variable. 16