I have some devices Lolin32 with battery and also powered by usb connector.
In order to build a usable device, I need to add an on/off switch… which is the better way ???
Hack the hardware ?
Put a switch to an GPIO and use sleep mode ??? If this is a solution… can you explain it ?
Thanks in advance !!!
I’m sorry for taking so long answering your question.
What do you mean by an ON/OFF switch?
Do you want to cut power completely? If that’s the case, the best way is to put a switch in series with the power supply.
However, depending on your application, deep sleep mode might be a better scenario. But it really depends on your project.
Can you provide more details?
Dear Sara, thank you for your response.
In my case, I think deep sleep is a good solution.
Can you suggest me an example to do this ???
I mean, start and quit deep sleep mode with a switch to a GPIO. May be ?
Thanks in advance. Hugo.
In that case, you’re talking about deep sleep with external wake-up.
You can take a look at the ESP32 course Module 3, unit 4: https://rntlab.com/module-3/deep-sleep-external-wake-up/
Then, let me know if you need further help.