How To Test A Micro Servo for proper and free operation.
A very useful procedure when using clone micro servos that do not always operate smoothly and may not be accurate in arm positioning.
Note that this is an initial test. Servos may have some wag at the end points. Once you do this test, to put the servo to use, use the procedure and code that you find here. Basic Servo And Turnout Control.
Arduino Mega, Uno or Nano
A servo motor has everything built in: a motor, a feedback circuit, and most important, a motor driver. It just needs one power line, one ground, and one control pin.
Following are the steps to connect a servo motor to the Arduino:
- The servo motor has a female connector with three pins. The darkest or even black one is usually the ground. Connect this to the Arduino GND.
- Connect the power cable that in all standards should be red to 5V on the Arduino.
- Connect the remaining line on the servo connector to a digital pin on the Arduino.
The sketch will turn a servo motor to 0 degrees, wait 1 second, then turn it to 90, wait one more second, turn it to 180, and then go back.
You can change those angles. This allows you to determine what the actual servo arm position is for an angle that you set in the code. This is important because low cost servos are not necessarily true in their response.
The sketch is on Pastebin at this link. When you go there you can review the sketch and download it.
The video below shows a servo being tested.
A video showing how a micro servo is tested. Click on the image to watch the video.
This image depicts an Arduino Uno being used. We use it because it is easy to see the pinout. For your animation project it is most economical to use a Nano.
Click on the image to see a larger version that you can print.
Once again, note that this is an initial test. Servos may have some wag at the end points. Once you do this test, to put the servo to use, use the procedure and code that you find here. Basic Servo And Turnout Control.