Page 1 of 1

Powering esp32 from battery doesn't work

Posted: Sat Jun 13, 2026 12:52 pm
by mogplus8
Hi All,

I'm confused. I've developed a system (using Micropython) to write an output stream to a pin using the RMT function. It works perfectly when the ESP32 is plugged into my computer, but doesn't when it's plugged into a battery. I've confirmed the battery is fully charged and is delivering five volts to the usb plug (it has two 18650 cells). I have also confirmed that the code is executing with the battery by putting some led flashing code around the RMT write_pulses() command, and the led does flash so the command is definitely being executed. I'm using a logic analyser (cheap Chinses knockoff, but it works) connected to the output pin, and Saleae Logic Analyser 2 to display the output on my pc.

This is the code I'm running (without the led flashing stuff):

Code: Select all

"""
Works perfectly.
"""
from esp32 import RMT
from machine import Pin

rmt = RMT(0, pin=Pin(23), resolution_hz=1_000_000, num_symbols=512, idle_level=False) 

duration = (1000, 300, 2000, 300) * 4
duration = duration + (7800, 300)

print('enter loop')

while True:
    try:
        rmt.write_pulses(duration, True)

    except Exception as e:
        print('Fell over', e)
        rmt.deinit()
        break
    except KeyboardInterrupt:
        print('keyboard interrupt')
        rmt.deinit()
        print('rmt deinitialised')
        break

rmt.deinit()
print('program ended')

What am I doing wrong? or missing?

All advice gratefully received.

:-)

Re: Powering esp32 from battery doesn't work

Posted: Sat Jun 13, 2026 5:06 pm
by mgsecord62
Do you have the logic analyzer ground connected to the 3.3v ground on the ESP32 when running from the battery? When running power from the same computer as the logic analyzer, the ground of the USB logic analyzer and USB power are most likely connected.