Servo Motors on Three Axes

If we are designing a robot arm, we need it to be able to rotate freely on three axes; X, Y, and Z. This lesson covers connecting three servo motors to an Arduino UNO board, as well as controlling them with C++ code, using the Arduino IDE to deply the program over USB.

Servo Motors

MG90S Servo Motor Wires

Most servo motors have 3 wires:

  • Ground (negative pole of DC power, labeled as “-“)
  • Positive (positive pole of DC power, labeled as “+”)
  • Signal (Pulse Width Modulation input, labeled as “PWM”)

The colors of the wires vary, so check the documentation for your servo motors to properly identify the wires. In this example, we are using three MG90S servo motors.

Connections

  1. Connect the “+” wire of each servo to the “5V” pin on the Arduino board
  2. Connect the “-” wire of each servo to the “GND” pin on the Arduino board
  3. Connect the “PWM” wire of each servo to the ~9, ~10, and ~11 pins on the Arduino board (one per servo)

Control the Servos with Code

Example code that rotates the X, Y, and Z servo motors back and forth by 90 degrees.

Serving Suggestion

Here is an example of the above connections, using an Arduino UNO R3, breadboard, jumper wires, and three MG90S servos. Power provided by a solar-charged USB battery pack.

Leave a Reply