One of the most common real-world Arduino problems is a project that works perfectly until a servo moves, a motor starts, a relay clicks, or an LED strip turns on. Then the Arduino resets, the display flickers, the serial monitor restarts, or the whole project behaves randomly.
This is usually not a programming problem. In most cases, the microcontroller is losing power for a very short moment. The voltage drops low enough that the Arduino, ESP32, ESP8266, RP2040 or other controller resets.
This problem is called a brownout or power dip. It is especially common when beginners power everything from the microcontroller board instead of using a proper external supply for the load.
Typical Symptoms
- The Arduino resets when a servo starts moving.
- The serial monitor prints the setup message again when a motor turns on.
- The display flickers or goes blank when a relay switches.
- The project works from USB until a load is connected.
- The board works with one servo, but fails with two or more.
- The ESP32 shows brownout detector messages.
- The problem happens only when the load starts, not while it is idle.
Why This Happens
Microcontroller boards need a stable supply voltage. A small Arduino, ESP32 or RP2040 board may only need a few tens or hundreds of milliamps. A servo, motor, relay coil or LED strip can need much more current, especially at startup.
When the load turns on, it may pull the supply voltage down for a short time. The dip can be so fast that a regular multimeter may not show it clearly, but the microcontroller still sees it.
If the voltage drops below the reset threshold, the controller restarts.
Common Cause: Powering a Servo from the Arduino 5V Pin
Small servos are often shown in beginner diagrams connected directly to the Arduino 5V pin. This may work with a tiny unloaded servo, but it is not a good general rule.
A servo can draw a high peak current when it starts moving, changes direction, hits a mechanical stop, or holds position under load.
- A small servo can draw several hundred milliamps.
- Multiple servos can easily overload the board supply.
- A stalled servo can draw much more than expected.
- The Arduino 5V pin is not a motor power supply.
For reliable operation, power servos from a separate supply that can handle the peak current.
Common Cause: Motors Pull High Startup Current
DC motors and gear motors can draw much more current when starting than when running freely. This is called startup current or stall current.
The stall current can be several times higher than the normal running current. If the power supply is only sized for the running current, the voltage may collapse when the motor starts.
This can cause:
- Arduino resets.
- ESP32 brownout errors.
- Motor driver shutdown.
- LCD or OLED flicker.
- Random sensor readings.
Common Cause: Relay Coils and Solenoids Create Noise
Relays, solenoids and other coils create electrical noise when switched. When the coil is turned off, the collapsing magnetic field creates a voltage spike unless the circuit has proper suppression.
Relay modules often include a flyback diode or transistor driver, but bare relays do not. If a relay coil is connected incorrectly or lacks suppression, the spike can reset the microcontroller or even damage parts.
For bare relay coils, use a proper driver transistor and a flyback diode across the coil.
Common Cause: LED Strips Draw More Current Than Expected
Addressable LED strips such as WS2812B / NeoPixel strips can draw a lot of current at high brightness. Even if the average current is moderate, fast brightness changes can create current spikes.
If the LED strip shares the same weak supply as the microcontroller, the voltage can dip when many LEDs turn on.
- Use a power supply sized for the number of LEDs.
- Inject power at multiple points for longer strips.
- Keep high LED currents out of the microcontroller ground path.
- Use a large capacitor near the LED strip power input.
Common Cause: No Common Ground
Using a separate power supply for motors, servos or relays is often the correct solution. But the control signal still needs a reference.
The microcontroller ground and the external load supply ground usually need to be connected together. Without a common ground, the servo signal, relay control signal or motor driver input may not be understood correctly.
A typical servo setup needs:
- Servo power from external 5V or 6V supply.
- Servo ground connected to external supply ground.
- Arduino ground connected to the same ground.
- Servo signal wire connected to the Arduino output pin.
The servo power should not come from the Arduino board, but the grounds must share a common reference.
Common Cause: Ground Wiring Carries Load Current
Even when grounds are connected, the layout can still be wrong.
If motor or LED current flows through the same thin ground wire used by the microcontroller, the ground voltage can bounce. The controller may see false signals, unstable sensor readings, or resets.
For better wiring:
- Connect high-current loads directly to the power supply.
- Do not route motor current through the Arduino board.
- Use thicker wires for high-current paths.
- Use a star-ground style layout where practical.
- Keep sensor and I2C wiring away from motor wiring.
Common Cause: Weak USB Power
USB power is convenient, but not always strong enough for a full project.
A computer USB port may power the controller board itself, but fail when external modules are added. Thin USB cables can also cause voltage drop. Some USB hubs limit current or behave poorly with sudden load changes.
If the project resets under load, try:
- A shorter USB cable.
- A known-good USB data cable.
- A powered USB hub.
- A separate external power supply for the load.
- Measuring the voltage at the controller while the load switches.
Common Cause: Linear Regulator Overheating
Many Arduino-style boards have a small onboard linear voltage regulator. This regulator may be fine for the board itself, but not for powering motors, relays, servos or displays.
If the board is powered through a barrel jack or VIN pin with a high input voltage, the regulator must burn off the extra voltage as heat.
For example, using 12V input to create 5V on a small onboard regulator can make the regulator hot very quickly. Adding external loads makes it worse.
Symptoms include:
- The board works for a short time, then resets.
- The voltage regulator gets very hot.
- The project fails more often after warming up.
- It works from USB but not from VIN or barrel jack.
Quick Check: Watch the Serial Monitor
Add a startup message to your sketch:
void setup() {
Serial.begin(115200);
Serial.println("System started");
}
void loop() {
}
If this message appears again every time the motor, relay or servo turns on, the controller is resetting.
This is a simple way to prove that the problem is not just a display glitch or sensor error.
Quick Check: Measure the Supply Voltage
Use a multimeter to measure the voltage directly at the microcontroller power pins while the load turns on.
A multimeter may not catch very short dips, but it can still reveal obvious problems.
- Measure 5V to GND on a 5V Arduino board.
- Measure 3.3V to GND on an ESP32 or RP2040 board.
- Measure at the board, not only at the power supply.
- Measure while the servo or motor is actually moving.
If the voltage drops significantly when the load starts, the supply or wiring is not strong enough.
Quick Check: Disconnect the Load Power
To separate code problems from power problems, disconnect the load power but leave the control signal connected if safe to do so.
For example, remove servo power but keep the servo signal wire disconnected from the servo. Or disconnect motor power while keeping the motor driver logic connected.
If the sketch runs normally without the load power connected, the code is probably not the main problem. The load current is causing the reset.
Correct Servo Wiring
A more reliable servo setup uses a separate power supply for the servo.
| Servo Wire | Connects To | Important Note |
|---|---|---|
| VCC / Red | External 5V or 6V servo supply | Do not power multiple servos from the Arduino 5V pin |
| GND / Brown or Black | External supply ground and Arduino ground | Ground must be common for signal reference |
| Signal / Orange, Yellow or White | Arduino GPIO pin | Carries control signal only, not motor power |
Correct Relay Wiring
A relay should not be driven directly from a microcontroller GPIO pin unless it is part of a proper relay module designed for logic input.
For a bare relay coil, use:
- A transistor or MOSFET driver.
- A flyback diode across the relay coil.
- A relay coil supply sized for the relay current.
- A common ground between controller and driver circuit.
Relay modules may already include these parts, but not all relay modules are equally suitable for 3.3V controllers such as ESP32.
Correct Motor Wiring
Motors should be powered through a motor driver, not directly from a microcontroller pin.
A proper motor setup includes:
- External motor power supply.
- Motor driver rated for the stall current.
- Common ground between controller and motor driver.
- Flyback protection if the driver does not already include it.
- Decoupling capacitors near the driver and motor supply.
The motor driver input pins connect to the microcontroller. The motor current should not flow through the microcontroller board.
Capacitors Can Help, but They Are Not Magic
Adding capacitors can help with short current spikes and electrical noise.
Common examples:
- A large electrolytic capacitor near a servo supply.
- A large capacitor near the input of an LED strip.
- Small ceramic capacitors near IC power pins.
- Motor noise suppression capacitors on brushed DC motors.
However, capacitors do not fix an undersized power supply. If the load needs 2A and the supply can only provide 500mA, a capacitor will only hide the problem briefly.
Power Supply Sizing
When choosing a power supply, consider peak current, not only average current.
| Load Type | Current Behavior | Design Advice |
|---|---|---|
| Servo | High current during movement and stall | Use external supply sized for all servos moving together |
| DC motor | High startup and stall current | Select driver and supply based on stall current |
| Relay coil | Moderate steady current plus switching spike | Use driver transistor and flyback diode |
| LED strip | Current depends on brightness and number of LEDs | Use separate supply and inject power where needed |
| Microcontroller | Low current compared with loads | Keep supply stable and isolated from load current paths |
ESP32 Brownout Messages
ESP32 boards often make this problem more visible because they can print a brownout detector message before resetting.
If the serial monitor shows a brownout error, do not start by changing the sketch. First check the 3.3V supply, USB cable, regulator, and external loads.
ESP32 boards are especially sensitive to weak supplies because WiFi current peaks can already stress a poor power setup. Adding relays, servos or LEDs to the same weak supply makes the problem worse.
Recommended Troubleshooting Steps
- Add a startup message to the serial monitor to confirm resets.
- Disconnect the motor, servo, relay or LED strip and test the controller alone.
- Power the load from a separate supply rated for the peak current.
- Connect the grounds together.
- Make sure load current does not flow through the controller board.
- Use a driver transistor, MOSFET, relay module or motor driver where required.
- Add flyback protection for coils if not already included.
- Add decoupling capacitors near the load supply.
- Use thicker wires for high-current paths.
- Reconnect one load at a time and test after every change.
Quick Diagnostic Table
| Symptom | Likely Cause | First Thing to Try |
|---|---|---|
| Arduino resets when servo moves | Servo current pulls 5V rail down | Use separate servo power supply with common ground |
| ESP32 shows brownout error | Weak 3.3V supply or USB power dip | Use better USB cable/supply and disconnect loads |
| Reset when relay turns off | Coil voltage spike or poor suppression | Check flyback diode and relay driver circuit |
| Display flickers when motor starts | Motor noise or supply dip | Separate motor supply and improve grounding |
| Works on USB, fails on external power | Weak regulator, wrong VIN voltage or bad wiring | Measure voltage at the controller under load |
| Works until more modules are connected | Power budget exceeded | Calculate total and peak current |
What Not to Do
- Do not power motors directly from GPIO pins.
- Do not power multiple servos from the Arduino 5V pin.
- Do not assume USB power is enough for the whole project.
- Do not omit the common ground between controller and external supply.
- Do not ignore flyback protection for relay coils and solenoids.
- Do not fix power problems only in software.
CANABLOX Practical Note
CANABLOX makes this type of troubleshooting easier because the control electronics can be separated from the load electronics. The modular layout helps isolate whether the problem is the controller, the I2C module, the load, or the power supply.
When adding servos, relays, motors or LED loads to a CANABLOX project, power the load from a supply designed for that load. Keep the CANABLOX controller and logic side stable, and connect grounds correctly when control signals need a shared reference.
Conclusion
If an Arduino, ESP32 or other controller resets when a servo, motor or relay turns on, the sketch is usually not the first suspect. The most likely cause is a power dip, missing common ground, poor wiring layout, or electrical noise from the load.
Use separate power for high-current loads, connect grounds properly, keep load current out of the controller board, and add suppression where needed.
Once the power system is solid, the same code that seemed unreliable often starts working perfectly.
