# Your ESP32 reboots the moment the motor starts

> The board runs fine until a motor, pump or solenoid switches on, then it resets. It is a brownout, not your code. Five steps to fix it, with a worked parts list.

[HTML version](https://soldr.ai/docs/esp32-reboots-when-motor-starts)

[Docs](https://soldr.ai/docs) / When it doesn't work

The board runs fine until something with a coil in it switches on — then it resets, over and over. This is almost never your code.

5 min read
Power
ESP32 · Arduino

## What you're seeing

Your sketch uploads and runs. The instant a motor, pump, relay or solenoid switches on, the board restarts. The serial monitor shows a burst of garbage, then the boot banner again:

```
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
Brownout detector was triggered
```

Sometimes it loops forever. Sometimes it only happens when the motor is under load.

## Why it happens

A motor pulls a large current spike the moment it starts — often **five to ten times** what it draws while running. If it shares a supply with the ESP32, that spike drags the rail below the voltage the chip needs, and the brownout detector resets the board to protect it.

> **The USB port is not a power supply** — A laptop USB port gives you around 500 mA. A small DC motor can ask for more than that in its first few milliseconds. This is the single most common cause.

## Fixing it

- **Give the motor its own supply** Power the motor from a separate adapter sized to its stall current, not its running current. Do not run it from the board's 5V pin.

- **Tie the grounds together** The motor supply's ground and the board's ground must connect. Without a shared reference the control signal has nothing to switch against — this is the step people skip.

- **Add a capacitor across the motor supply** A 470 µF or larger electrolytic across the motor's power rail absorbs the start-up spike before it reaches the regulator.

- **Switch the motor with a driver, never a pin** A GPIO can source about 20 mA. Use a MOSFET, a motor driver or a relay module between the pin and the load.

- **Re-flash and watch the serial monitor** If the brownout line is gone, it was the supply. If it persists, the driver or the ground link is still wrong.

> [screenshot] Soldr chat showing a brownout diagnosis: pasted serial output containing "Brownout detector was triggered", the reply naming the 12V supply as the cause, and the revised parts card with the buck converter added.

## Letting Soldr do it

Paste the serial output straight into Soldr. It reads the reset reason against **the sketch you actually flashed**, not a generic answer, and rebuilds the parts list with the supply corrected.

Or photograph the breadboard and ask what's wrong — it will read the picture.

> **Both of these are free** — Questions, diagnosis and troubleshooting never cost credits. You only spend credits when Soldr generates something for you.

## A worked example

This is the build Soldr produces for "automatic plant watering with a 12V solenoid valve and an ESP32" — note that the power problem above is designed out from the start:

| Part | Why it's there | Price |
|---|---|---|
| ESP32-C3 Super Mini | the controller | ₹290 |
| 12V Solenoid Valve | the load, on its own rail | ₹240 |
| IRF540N MOSFET | switches 12V from a 3.3V pin | ₹60 |
| LM2596 Buck Converter | keeps the board at 5V, isolated from the spike | ₹95 |
| 12V 2A DC Adapter | sized to the valve, not the board | ₹300 |
| Core of the build | the rest is wiring | ₹985 |

## If it still resets

- Measure the 3V3 pin with a multimeter while the motor starts — if it dips below ~2.8V the supply is still shared somewhere.

- Check the capacitor's polarity. Backwards electrolytics fail, sometimes loudly.

- A long, thin jumper is a resistor. Shorten the motor's power leads.

- Still stuck? Paste the full serial log into Soldr and it will work through it with you.

[Previous Credits & pricing](#)
[Next Reading serial output](#)
