LilyGo-T-Call-SIM800L - How to detect power source USB-C or BATTERY

vitaminazeta
Posts: 1
Joined: Sun Jul 26, 2020 9:00 pm

LilyGo-T-Call-SIM800L - How to detect power source USB-C or BATTERY

Postby vitaminazeta » Sun Jul 26, 2020 11:04 pm

Hello everyone,
I'm looking to a way to detect if my LilyGo-T-Call-SIM800L is powered from USB-C connector or if running from battery.
My first option was to add an extra power supply (220VAC to 5V) connected only to a GPIO pin and detect if there is power. I wish to avoid this solution so save a second power suply unit on the project.
My second option was to connect the 5Vdc coming from USB-C to one of the GPIO pin. The problem here is how to get USB-C 5v. USB-C connector has a very small pins and I wan't be able to solder a wire without destroy the whole PCB.

Anyone knows if is possbile to detect power source on LilyGo-T-Call-SIM800L.
Actually I'm using Adafruits_FONA library where I should be able to measure battery capacity but not power source.
many thanks

23skidoo
Posts: 4
Joined: Wed Aug 12, 2020 1:51 pm

Re: LilyGo-T-Call-SIM800L - How to detect power source USB-C or BATTERY

Postby 23skidoo » Thu Aug 13, 2020 10:35 am

hi,

- does your development board have access to the 5V, 3.3V, and GPIO pins for example on a pin header? the battery voltage may also be available as VBAT?
- to detect battery voltages using a GPIO pin, in hardware configuration first drop the voltage down through a resistive voltage divider (example values 300k, 100k), you could use one GPIO pin for each of VUSB and VBAT
- it is not recommended to connect any voltages over 3.3V to any GPIO pin on ESP32, or you might fry your ESP32 or encounter other problems
- in your application, ensure that the dropped down voltages are routed to an ADC pin, then configure the ADC and measure the input voltages


Who is online

Users browsing this forum: No registered users and 116 guests