How to connect a servo to the Arduino

Servo Cable

The continuous rotation servos that come with the BOE Shield-Bot have a 3-wire cable for connecting it to the power and controller. The black wire is the ground, the red wire is the power (positive) and the white wire (sometimes yellow, depending on the servo) is the signal wire. The signal wire is used to send the control signal to the servo. All three wires run together into a single, standard hobby servo connector.

Wiring the Connection with a Breadboard

To help you to understand how the servo connections work, we are going to show you how to hand wire the connections.

First we are going to use the two 3-pin headers to connect the servo cables to the breadboard. To do this we are going to need five jumper wires; functionally the wires can be of any color, but to follow the circuit we recommend that you have one black wire, one blue wire, one yellow wire, and two red wires (left).

Next we want to look at the schematic for the connections (right).

How to connect a servo to the Arduino

As you can see, both servos have their black wires connected to ground and their red wires connected to 5V. However, the white signal wires each connect to a different Arduino pin. The left servo gets connected to digital pin 10, while the right servo gets connected to digital pin 11. This is because we want to be able to control the servos independently.

Since the black wires are both being connected to ground (called ‘common ground’), we can connect both of the black wires to one ground port. Likewise, the two red wires can be connected together to the a +5 volt port (since they are both using +5 volts). The two white signal wires, however, will be using two different signal pins in order to control the servos independently and should not be wired together.

BOE Shield-Bot Shield connections

While hand wiring the connections is not hard, it does take up a large amount of space on the breadboard that could be used for other components. Thankfully, the BOE Shield-Bot Shield has four connections on the shield that allow you to plug the servo connectors directly into the board. On the shield (near the edge of the breadboard) you will see a group of pins shielded by plastic.

How to connect a servo to the Arduino schematic

These are the servo pins. When connecting the servos, always make sure that they are correctly orientated (as noted on the shield’s silkscreening; the black wire should be closest to the breaboard). Plugging the servos in the wrong way could cause a short and damage the servo (and possible the Arduino). The servo bank is wired to the Arduino’s digital pins 10, 11, 12 and 13. You can tell which pin the signal is connected to by the small number near the signal wire of the plug.

 

For more detail: How to connect a servo to the Arduino


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top