I am using a very simple fw configuration with ESP32S MCU board - all it does it blinks internal LED, sends a “ping” to HA (to let it know it’s alive), output status message on OLED display then goes to deep sleep from which it can be woken up by PIR sensor.
Everything is working as expected when powered by microUSB cable. But when I use a freshly charged battery (the board has a built-in battery port) it only runs for a few hours. I suspect that when the voltage drops until a certain level, it just blinks - there is a short break between the blinks so it seems like there is a reset loop.
No, it remains on. But only couple pixels are lit. And I’ve seen the same behaviour even without using OLED (actually I added it to get more insight).
No, as currently I am not able to run the code even with a fully charged battery. When the code is running the multimeter jumps from 40 to 90 mA (suggesting a boot loop).
Final thing I can think of is that 7 seconds may not be enough time for the ESP to connect to wifi. Wifi is inititalised at boot priority 250 but that does not mean it is connected, AFAIK.
I see several potential issues here but they are not related to battery/usb power.
Did you measure your real battery capacity? Or deep sleep current of your setup?
How are pir and display powered? Something from 5V pin? I don’t know your board, but I would guess you only have regulated 3.3V while on battery.
With a USB power it pulses as intended. When powered by battery the pulses are way shorter. There is also a loop of 10 regular blinks, then a longer pause (which I think means that the MCU is restarting).
The meter says the battery voltage is 3.9, but perhaps it’s unable to supply a current in bursts? Sadly, I do not have an oscilloscope to monitor the changes in voltage.
Weird. So battery voltage is 3.9V and 800mAh one generally can provide sufficient current even on “surges”. And stable Esp rail ~3.3V doesn’t really indicate power problem either.
Makes me wonder if they even come from your program. If you change the interval to 2s, does it affect the behavior?
Ok. that approves that the code is not running at all, it likely just blinks on boot loop. @ShadowFist is right for the timing though.
So voltage levels look good with battery, code is working on usb power… It’s getting tricky. Can you find schematic of your board?
Gpio16 on normal esp board shouldn’t be bonded to anything, but your board has LED on it so it likely has some circuit still not clear to me…