Electronics > Microcontrollers

[newbie] On/off switch to handle battery?

(1/2) > >>

Winfried:
Hello,

Lilygo's TTGO T-Display has a JST plug so that the board can be powered by a battery… but the board has no on/off switch.

I have a couple of questions:

1. What (compact) on/off switch can I use to have the battery power the board? Do I need a four leg switch (red + black from the battery to the board, red and black from the switch to the JST)?

2. When the board is powered by USB, will it recharge the battery after I set the switch to ON?

Thank you.

ledtester:

--- Quote from: Winfried on September 23, 2022, 12:06:48 am ---1. What (compact) on/off switch can I use to have the battery power the board? Do I need a four leg switch (red + black from the battery to the board, red and black from the switch to the JST)?

--- End quote ---

You don't need to use a DPDT switch if that's what you're asking. You only need to break either the red or black connection.

This inline JST power switch might work for you if the pitch of the connector is the same:

https://www.amazon.com/JST-2-pin-Extension-Cable-Switch/dp/B01M9AAUEM

Also see this reddit thread:

https://www.reddit.com/r/esp32/comments/jq9zev/how_to_power_off_ttgo_tdisplay_while_charging/


--- Quote ---2. When the board is powered by USB, will it recharge the battery after I set the switch to ON?

--- End quote ---

Yes - it will be the same as if the battery is connected.

Winfried:
Thanks. I'll see if I can find a compact switch to fit the tiny TTGO board.

https://learn.adafruit.com/on-slash-off-switches

DavidAlfa:
Check the schematics! Yeah, it has built-in charger...
https://github.com/Xinyuan-LilyGO/TTGO-T-Display/blob/master/schematic/ESP32-TFT(6-26).pdf

The LDO has a quiescent current of just 55-80uA, that's at most 2mAh every day, even a really small 100mAh battery should last for weeks.
However the schematic has some features that are wasting power.
R32 (100K) will consume another 40uA, isn't really needed, can be removed.
R25 (10K) will waste about 300uA when turned on, doesn't need to be that low, should work fine with 220K.

Actually the esp32 needs to set IO14 high to work from batteries (PWR_EN pin), so it won't turn on unless it's connected from USB power first?
The main program starts, enables the output and then USB power can be removed.
Once it booted at leats once, it might go into sleep mode while keeping the pin high.

Anyways sleep still consumes some power, not optimal.
You could make a very simple hardware mod to make it switch on and off.

- Add a push button between R28 and GND, as in attached picture.
- Read a button in software and use it as power-off button switch, turning IO14 low when detecting a long press on this button.
- Enable IO14 in the initialization code, but add a delay of 500mS first, this will prevent any noise from turning on the board, so the user must press the button for at least 500mS to ensure power-on.

mikerj:

--- Quote from: DavidAlfa on September 24, 2022, 11:01:34 am ---Actually the esp32 needs to set IO14 high to work from batteries (PWR_EN pin), so it won't turn on unless it's connected from USB power first?

--- End quote ---

"BAT" and "3V3" are switched outputs controlled by IO14.  "VBAT" is the supply rail from the battery, and the board runs as soon as the battery is plugged in.

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version