Why does my DIY esp32 camera reboot every time it saves a photo?

Oct 18, 2026 Last reply: 9 hours ago 4 Replies

First reply

frost_sage

The fact that it runs fine on USB but dies on battery points right at the charging board, not the battery or the card. Most of those little lipo charging boards have a protection chip that cuts the output if the current spikes for even a moment, and an sd card write plus the…

Read the full reply

So I finally got my little handheld camera build working, or almost working. The live view on the little tft screen looks great and everything runs fine off the battery, but the second it snaps a picture and tries writing it to the sd card, the whole thing resets. Screen goes black for a second and it comes back to the boot screen like nothing happened. I figured it was a power problem since the card write plus the sensor working at the same time probably pulls more current than my little lipo can give through that charging board. Swapped in a bigger battery and same thing, so now I'm not so sure. Could it be the card itself? I'm using some old micro sd I had in a drawer, maybe it's too slow and something times out.



Weird part is if I power it over usb it saves photos fine every time. Only does this on battery. Anyone else hit this? Do I need a capacitor somewhere to smooth out the draw, or am I looking at the wrong thing entirely?


The fact that it runs fine on USB but dies on battery points right at the charging board, not the battery or the card. Most of those little lipo charging boards have a protection chip that cuts the output if the current spikes for even a moment, and an sd card write plus the camera module grabbing power at the same time is exactly the kind of spike that trips it. A bigger battery won't fix that because the battery isn't the weak link, the board between it and your esp32 is. When you power over usb the battery circuit is basially out of the picture, so everything works. There's a second possibility that behaves the same way: the esp32 has a brownout detector that reboots the chip if the supply voltage dips below a threshold. On usb the voltage holds steady, but through a charging board with thin wires the voltage sags hard during the write and the chip resets itself. If you can plug it into your computer and watch the serial output when it crashes, a brownout message will confirm this in about two seconds.

Either way the fix is similar. First, wire the battery straight to the load side if your board lets you, bypassing the protection chip, and charge the battery separately or with a board that supports simultaneous charge and discharge properly. Second, put a decent sized capacitor right across the esp32's power pins, something in the several hundred microfarad range. That acts as a little local energy reservoir and flattens out the spike when the card starts writing. Keep the wires from the battery short and reasonably thick too, since thin jumper wires alone can cause enough sag to trigger a reset. And try a different card as a cheap test, but I'd bet against it. A slow old card can make saving slow or fail outright, but it wouldn't care wether you're on usb or battery. Yours cares, so it's a power delivery problem, not a storage problem.

Had almost the same thing on a handheld gameboy-style build I did. Turned out my charging board couldn't handle load while charging, so the esp32 was fighting it every time anything spiked. Once I found one that does proper pass-thru it just worked. Also check which pin you're powering the screen from. I had my backlight tied to a gpio that wasn't happy when the camera kicked in, and it caused resets that looked exactly like a power issue. Worth a look before you go cutting traces.

Been chasing gremlins like this since the days of breadboarded PIC projects, and the sneaky part is almost always the wiring, not the parts. Those jumper leads look fine but have more resistance than you'd think, and the moment anything heavy switches on the voltage at the chip just folds. Back when we didn't have serial messages telling us what was wrong, we'd clip a meter across the supply and watch the needle jump when the thing did its trick. Cheap and it settles the arguement in a minute. Also try running it from a phone power bank on the battery input. If it behaves with that, the little charge board is your culprit, plain and simple. I've had two of those go bad in ways that looked like software bugs, one of them in a data logger that took me a week of head scratching before I thougt to swap the power path.

Same deal with a little esp32 data logger I built. Worked fine plugged in, reset every time on battery. Watched the serial port while it was on battery and there it was, the brownout message right before it rebooted. Mine turned out to be a cheap tp4056 module that sagged under load, so I ended up powering the esp32 from the battery tabs directly and just using the module for charging. Never reset again.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required