Sub topic 11
Noise, Decoupling Capacitors, and Brownouts
Assume you can upload sketches, use pinMode() and digitalWrite(), and understand voltage, current, ground, and breadboard wiring. This chapter explains why a motor can make an otherwise correct Arduino project reset or behave erratically.
Why motors disturb Arduino circuits
A motor does not draw a constant current. When it starts or changes load, its current can rise quickly. A servo can also draw a short, high-current pulse when it starts moving or meets resistance.
This current flows through the power supply, wires, breadboard contacts, and ground connections. Every part has some resistance and inductance. A sudden current change can therefore cause:
- A brief drop in the Arduino's supply voltage.
- A shift in the ground voltage between the motor and Arduino.
- Electrical noise from brushes, switching transistors, or long wires.
- A servo signal that appears unstable because its signal reference is moving.
A brownout is a reset caused by the supply voltage falling below a safe level. The Arduino may restart without showing a clear software error. If the sketch begins again at its initial state, suspect a power problem.
Use a separate motor supply
Power the motor or servo from a suitable external supply. Do not use an Arduino I/O pin as a motor power source. An I/O pin is for signaling and has strict current limits.
Connect the external supply ground to Arduino GND. This common ground gives the control signal a shared voltage reference.
Keep the high-current motor path separate from the Arduino's power path. Connect the motor supply wires directly to the driver or servo connector when possible. Avoid sending motor current through a thin breadboard rail that also supplies the Arduino.
Add capacitors near the load
A capacitor stores a small amount of electrical energy. Placed near a motor or servo, it can supply a short current pulse before the power supply and wires respond.
Use two useful types:
| Capacitor | Main purpose | Typical placement |
|---|---|---|
| 100 nF ceramic | Reduces fast, high-frequency noise | Across supply and ground near the driver |
| 470–1000 µF electrolytic | Supports short, larger current demands | Across the motor or servo supply near the load |
Electrolytic capacitors are polarized. Connect the positive lead to the supply positive terminal and the negative lead to ground. Reversing one can damage it.
A capacitor does not fix an undersized supply. The supply must still provide the required voltage and current. The capacitor only reduces brief disturbances.
Reduce switching noise
Brushed DC motors create electrical spikes when their brushes switch. A small ceramic capacitor across the motor terminals can reduce some of this noise. Keep its leads short.
A flyback diode protects a transistor or MOSFET from the voltage produced when motor current is switched off. A diode is required for a low-side MOSFET circuit, but it does not replace good wiring and supply decoupling.
For longer wires, twist the motor's supply and return wires together. Keep them away from the servo signal wire and Arduino reset line. Use short signal wires and connect grounds at a deliberate point instead of allowing large motor currents to share narrow ground paths.
Recognize the symptoms
| Symptom | Likely cause | First check |
|---|---|---|
| Arduino restarts when the motor starts | Supply sag or ground disturbance | Measure the Arduino supply during startup |
| Servo jitters while the motor runs | Noisy supply or signal reference | Add bulk capacitance and improve common ground |
| Motor works alone but fails with Arduino connected | Missing common ground or wiring noise | Verify the ground connection |
| Driver or wires become hot | Excess current or incorrect wiring | Check stall current and driver rating |
A simple uptime message helps reveal unexpected resets. If the message starts again while the board should still be running, the Arduino probably reset.
const int LED_PIN = LED_BUILTIN;
unsigned long lastReport = 0;
void setup() {
pinMode(LED_PIN, OUTPUT);
Serial.begin(9600);
Serial.println("Sketch started");
}
void loop() {
digitalWrite(LED_PIN, (millis() / 250) % 2);
if (millis() - lastReport >= 1000) {
lastReport = millis();
Serial.print("Uptime: ");
Serial.println(millis() / 1000);
}
}Do not use a USB connection as proof that the motor supply is safe. USB may power the Arduino while the motor uses a separate supply, and the two circuits can still disturb each other through their ground connection.
Exercise
A servo makes the Arduino restart as soon as it moves. Name two hardware changes you would try first.
Show answer
Power the servo from a suitable external supply with a common ground, then place a correctly polarized bulk electrolytic capacitor near the servo supply terminals. Also check that the supply can provide the servo's startup and stall current.