Sub topic 2
Powering Motors Separately and Sharing a Ground
Assume you can upload Arduino sketches, use pinMode() and digitalWrite(), and identify voltage, current, and ground in a circuit. This chapter focuses on the wiring that keeps a motor from overloading the Arduino.
An Arduino pin is a control output. It can send a small signal, but it cannot safely supply the current required by a motor. Motors can draw a large startup current, and a stalled motor can draw even more. Use a separate power supply for the motor, then connect the two systems correctly.
Separate the power paths
A hobby servo normally has three wires:
- V+: positive motor supply, often 4.8–6 V
- GND: supply return
- Signal: command wire connected to an Arduino I/O pin
Connect the servo’s V+ and GND to a suitable external supply. Connect only the signal wire to the Arduino pin. The external supply must provide the voltage specified by the servo and enough current for movement and stall conditions.
| Connection | Goes to | Purpose |
|---|---|---|
| Servo V+ | External supply positive | Supplies motor current |
| Servo GND | External supply negative and Arduino GND | Provides a shared reference |
| Servo signal | Arduino digital pin | Carries the position command |
Do not connect the external supply’s positive terminal to an Arduino I/O pin. Also avoid connecting it to the Arduino 5 V pin unless the power system was specifically designed for that arrangement.
Why the grounds must connect
A signal voltage has meaning only compared with a reference. When the Arduino sends a HIGH signal, the servo needs to know which voltage counts as zero volts. Connecting Arduino GND to the external supply negative gives both devices the same reference.
The common-ground connection does not make the Arduino power the servo. It only provides a return path for the signal reference. The high motor current should flow through the external supply wiring, not through an Arduino I/O pin.
Add current capacity and local capacitors
Choose a supply based on the motor’s voltage and current. A servo’s average current may look small, but its startup and stall current can cause a brief power dip. A supply that is rated only for the average current may produce resets or jitter.
Place a capacitor near the servo or motor supply connection. For example, a 470 µF electrolytic capacitor can help absorb short current pulses. Connect its positive lead to V+ and its negative lead to GND. Observe the capacitor’s polarity. A smaller ceramic capacitor, such as 0.1 µF, can also reduce high-frequency noise.
Keep the motor’s high-current wires short and reasonably thick. Run the Arduino signal and ground wires alongside each other when possible. This reduces the loop area that can pick up electrical noise.
Test the wiring with a servo
The following sketch sends a position command. The servo is powered by the external supply, while pin 9 carries only the control signal.
#include <Servo.h>
Servo servo;
const int SERVO_PIN = 9;
void setup() {
servo.attach(SERVO_PIN);
servo.write(90);
}
void loop() {
// Keep the servo at its commanded center position.
}Before connecting power, check these points:
- The servo voltage matches the external supply.
- The servo V+ does not connect to an Arduino I/O pin.
- The external negative connects to Arduino GND.
- The signal wire connects to the intended Arduino pin.
- A polarized capacitor, if used, has the correct orientation.
A shared ground is also required when using a transistor or motor-driver board. The driver may receive motor power from an external supply, but its logic ground must connect to Arduino GND so that its input HIGH and LOW levels have a clear reference.
Exercise
A servo moves unpredictably when its external supply is connected, but its signal wire is attached correctly. What wiring connection should you check first, and why?
Show answer
Check that the external supply negative is connected to Arduino GND. Without a common ground, the servo may not interpret the Arduino signal voltage reliably.