Arduino Servo Control



Spinning a motor can be fun. There are many hobby servos that can be obtained on-line. Inside the servo, there is a small gearbox to make the movement and some electronic circuitry for movement control. This project will show you how to control the servo and it's simple enough just to rotate the servo 180 degree back and forth.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Equipments

We only need an Arduino compatible board and one servo motor for this simple project

  • Ameba Arduino (you can search eBay by this name about it)
  • Servo (Hextronic HXT900 or TowerPro SG90)

Step 2: Wiring

A typical servo is positioning from 0 to 180 degrees and is having 3 wires, the red wire is for power, black or brown one should be connected to ground, and the other one is for signal data. We use PWM signal to control the rotation angle of the axis of the servo. The frequency of the signal is 50Hz, that is period 20ms. Each servo defines its pulse bandwidth, which is usually 1ms~2ms. To control the rotation angle, for example if 1ms pulse length rotates the axis to degree 0, then 1.5 ms pulse rotates the axis to 90 degrees, and 2 ms pulse rotates the axis to 180 degrees. The signaling wire is connected to Ameba Aruino board pin 9 as shown in the above diagram.

Step 3: The Code

The Arduino sketch is attached for your reference. After you downlaod the code to the board and run it, you can see the servo is turning clockwise for 180 degree then counterclockwise for 180 degree repeatedly.

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest