Servo Research¶
Reason for research¶
During the development of the second catapult, I had problems with the servo’s I was using. I used a Tower Pro servo for the reload, I used a WAVGAT servo to turn the rubber band to create tension and I used the servo from the kit to hold the catapult arm in place and to make it go off. During development, the servo from the kit was already jittering, so I used it for making the catapult go off. As for this functionality, precision was least important. In this phase the catapult worked without any problems, except for that servo to jitter. But this did not keep the catapult from working. For the last step for this iteration of the catapult, I made a small tower to putt ping pong balls in. These ping pong balls would fall into the holder of the catapult and would be used as the ammunition. I used a WAVGAT servo to make a ball drop into the holder when pushing a physical button. However, this would sometimes not work, as the servo’s behavior was very unpredictable. Sometimes the servo would not open all the way, sometimes the servo would stay open too long and most of the times the servo would not do anything when pushing the reload button. After a lot of debugging, I found out that the servo from the kit was the problem. When changing that servo with another WAVGAT servo, all the servo’s would work as expected. So now I want to find out why some servo’s do not work well and why they can mess with other servo’s.
How Servo’s work¶
Servo’s are controlled by sending an electrical pulse of variable width, or pulse width modulation (PWM), through the control wire. There is a minimum pulse, a maximum pulse, and a repetition rate. A servo motor can usually only turn 90° in either direction for a total of 180° movement. The motor’s neutral position is defined as the position where the servo has the same amount of potential rotation in the both the clockwise and counterclockwise direction. The PWM sent to the motor determines position of the shaft and based on the duration of the pulse sent via the control wire; the rotor will turn to the desired position. The servo motor expects to see a pulse every twenty milliseconds (ms) and the length of the pulse will determine how far the motor turns. For example, a 1.5ms pulse will make the motor turn to the 90° position. Shorter than 1.5ms moves it in the counterclockwise direction toward the 0° position, and any longer than 1.5ms will turn the servo in a clockwise direction toward the 180° position.
When these servo’s are commanded to move, they will move to the position and hold that position. If an external force pushes against the servo while the servo is holding a position, the servo will resist from moving out of that position. The maximum amount of force the servo can exert is called the torque rating of the servo. Servo’s will not hold their position forever though; the position pulse must be repeated to instruct the servo to stay in position.
Source: https://www.jameco.com/Jameco/workshop/Howitworks/how-servo-motors-work.html
Jitter reasons and fixes¶
Possible reasons for Servo jitter¶
Servo jitter is usually caused by an inadequate servo power supply, the controller not sending a constant output, unsteady external power supply or simply just cheap servo’s.
Possible fixes for Servo Jitter¶
Because jitter sometimes is the result from the controller not sending a constant output, We could add a capacitor to make the output more constant.
Testing Equipment¶
Servo’s used¶
- SG90 Mini Servo (The servo from the kit)
- WAVGAT SG90 Mini Servo
Servo’s that worked as intended (not used in research)¶
Boards used¶
Capacitor used¶
Code Used¶
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
myservo.write(0);
delay(2000);
myservo.write(180);
delay(2000);
}
How I am going to test¶
I am going to run the code on different boards, use different pins and use different servo’ s to see in which scenarios the servo will jitter and when not. I will test multiple of the same servo to make sure I did not use just one faulty servo. Scenarios which result in any jitter, I will try to add a capacitor to reduce the jitter. Then with that information I will make a conclusion on why servo’s sometimes jitter and how to prevent it.
Jitter classifications¶
No Jitter¶
Minor Jitter¶
Severe Jitter¶
Results test¶
Servo Test | SG90 Mini Servo (Kit) | WAVGAT SG90 Micro Servo |
---|---|---|
Arduino UNO R3 Pin 9 (PWM) | very minor | none |
Arduino UNO R3 Pin 9 (PWM) with capacitor | very minor | none |
Arduino UNO R3 Pin 8 | very minor | none |
Arduino pro mini Pin 3 (PWM) | Servo does not work | none |
Arduino pro mini Pin 3 (PWM) with capacitor | See GIF below | none |
Arduino pro mini Pin 7 | Servo does not work | none |
Wemos D1 Mini V3 Pin D1 (PWM) | severe | none |
Wemos D1 Mini V3 Pin D1 (PWM) with capacitor | minor | none |
Tests will result in servo’s not jittering, minor jitter or severe jitter. For reference see videos above.
Arduino pro mini Pin 3 (PWM) with capacitor + SG90 Mini Servo (Kit) result:¶
Additional findings¶
-
Using the Arduino pro mini, the servo’s from the kit do not move entirely or very little. Other servo’s work fine.
-
The servo’s work using the Wemos D1 Mini V3, but both servo’s do not always go when they should. Sometimes they move before or after the two second interval, and sometimes they skip moving entirely.
-
Servo performance enhances greatly when using the wemos D1 Mini V3 combined with a capacitor.
-
The servo’s from the kit significantly jitter less when using the Arduino UNO R3, compared to the Wemos D1 Mini V3.
-
The Arduino UNO R3 works best with servo’s, I did not have any problems using this board and the servo’s that are not from the kit.
-
To my surprise, performance of the servo’s did not change when using pins that support PWM compared pins that do not.
Final outcome¶
Only the Servo’s that are from the kit seem to jitter. This is either because they are just bad quality, or they are just less accurate in ‘seeing’ the pulses. But this can loop back to them being of less quality. However, using a capacitator does improve performance and reduce jitter. This is because the capacitator clears the signal and makes it steadier. My advice is to use a capacitator when using the servo’s from the kit, or either just use a WAVGAT servo or a Tower pro servo. For best servo performance use an Arduino UNO R3, but a Wemos D1 Mini plus capacitor also works when you do not need the servo’s to move constantly and accurately.
Project continuation¶
In our prototypes we ended up only using WAVGAT servo’s, because these never caused us any problems.
Sources¶
- https://forum.arduino.cc/t/servo-jitter-how-do-you-fix-it/390128
- https://forum.arduino.cc/t/avoiding-servo-jitter/606480/7
- https://learn.adafruit.com/adafruit-arduino-lesson-14-servo-motors/if-the-servo-misbehaves