[ESP32 Dev Kit] ADC pin readings always HIGH with external battery connected

tuskist
Posts: 1
Joined: Sun Mar 24, 2024 6:07 pm

[ESP32 Dev Kit] ADC pin readings always HIGH with external battery connected

Postby tuskist » Sun Mar 24, 2024 6:33 pm

Hi everyone, this is my first time working with an ESP32 Dev Kit and I hope someone can solve my mystery.😭

I have this ESP32 board powered by a 3.7V LiPo battery through Vin. The battery is plugged in an Adafruit charging circuit.
Put aside the battery life and voltage concerns etc., I'm trying to use ADC pin 35 to measure the battery voltage status at the same time.
The battery voltage is stepped down by using a voltage divider of 27k and 100k resistors.

Say now my battery voltage is 3.7V, and the stepped down voltage to be measured by PIN 35 is 2.9V.

- When I tested this design by connecting ESP32 to Arduino through USB, and the tuned down voltage of battery to PIN 35, it measures the voltage 2.9V correctly.
- When I tested it by connecting ESP32 to battery, and the tuned down voltage to PIN 35, the voltage read by PIN 35 immediately goes HIGH and stays HIGH.
- I then checked battery voltage at PIN35 using DMM and it shows the actual stepped down voltage which was still 2.9V. However it shows HIGH when I tried to read the PIN status wirelessly...

I've checked common ground - they are all soldered together.
Checked wiring multiple times.
Continuity checked multiple times.
Tried with PIN 34 but same problem.

Any help would be much appreciated. Thank you!

- TJ
Attachments
IMG_8949.jpg
IMG_8949.jpg (2.78 MiB) Viewed 1540 times

ESP_Sprite
Posts: 9052
Joined: Thu Nov 26, 2015 4:08 am

Re: [ESP32 Dev Kit] ADC pin readings always HIGH with external battery connected

Postby ESP_Sprite » Mon Mar 25, 2024 2:00 am

The reference voltage for the internal ADC is not 3.3V, it's about 1.1V, with an internal attenuator that can scale the input voltage down to that range if needed. You're probably better off changing your voltage divider to divide the battery voltage to something around 0.5V and using 0DB as attenuation (arduino: analogSetAttenuation(ADC_ATTEN_DB_0))

lbernstone
Posts: 673
Joined: Mon Jul 22, 2019 3:20 pm

Re: [ESP32 Dev Kit] ADC pin readings always HIGH with external battery connected

Postby lbernstone » Mon Mar 25, 2024 4:56 am

Does "connected to battery" mean that the battery is connected to the 5V input, so that it is going through the LDO, or directly powering the esp32 on 3V3?
Not sure why it would be different battery vs usb, but 100K is a bit high for the current limiter. Try taking it down an order of magnitude (10K/2.7K).
Oh, and to head off a later question, it is analogSetAttenuation(ADC_0db).

User avatar
jgustavoam
Posts: 134
Joined: Thu Feb 01, 2018 2:43 pm
Location: Belo Horizonte , Brazil
Contact:

Re: [ESP32 Dev Kit] ADC pin readings always HIGH with external battery connected

Postby jgustavoam » Fri Apr 05, 2024 2:49 am

Caution!
LIPO Battery voltage when fully charged is about 4.2V !! Not 3.7V.
Measure the battery voltage with a voltmeter.
Retired IBM Brasil
Electronic hobbyist since 1976.

Who is online

Users browsing this forum: No registered users and 125 guests