Author Topic: [newbie] On/off switch to handle battery?  (Read 1403 times)

0 Members and 1 Guest are viewing this topic.

Offline WinfriedTopic starter

  • Contributor
  • Posts: 24
  • Country: fr
[newbie] On/off switch to handle battery?
« on: September 23, 2022, 12:06:48 am »
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.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3036
  • Country: us
Re: [newbie] On/off switch to handle battery?
« Reply #1 on: September 23, 2022, 12:39:52 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)?

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?

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

Offline WinfriedTopic starter

  • Contributor
  • Posts: 24
  • Country: fr
Re: [newbie] On/off switch to handle battery?
« Reply #2 on: September 23, 2022, 12:40:27 pm »
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
 

Online DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5907
  • Country: es
Re: [newbie] On/off switch to handle battery?
« Reply #3 on: September 24, 2022, 11:01:34 am »
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.
« Last Edit: September 24, 2022, 11:16:05 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3240
  • Country: gb
Re: [newbie] On/off switch to handle battery?
« Reply #4 on: September 24, 2022, 01:10:28 pm »
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?

"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.
 

Online DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5907
  • Country: es
Re: [newbie] On/off switch to handle battery?
« Reply #5 on: September 24, 2022, 08:23:18 pm »
You're right, I missread the schematics.
Moving the esp32 power from vdd3v3 to v3v would completely turn it off and work as I said.
Q6 should be ok with it, it's a si2301, capable of almost 3Amps.
« Last Edit: September 24, 2022, 08:26:06 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline WinfriedTopic starter

  • Contributor
  • Posts: 24
  • Country: fr
Re: [newbie] On/off switch to handle battery?
« Reply #6 on: September 25, 2022, 09:21:25 am »
Thanks. That's way above my head. A plain switch seems a much easier path to the goal.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf