Adafruit HUZZAH32 - ESP32 Feather Measuring Battery

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Draexler
 
Posts: 2
Joined: Wed Nov 23, 2022 4:51 am

Adafruit HUZZAH32 - ESP32 Feather Measuring Battery

Post by Draexler »

Hello,

would like to measure the battery voltage. I am using an Adafruit HUZZAH32 - ESP32 Feather. According to the documentation, PIN A13 should be used. Since I do it later, I unfortunately can no longer get to this PIN structurally or for soldering. Can another PIN be used? Do I then have to double the value as well as described in the documentation?
I hope you can help me :-)

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: Adafruit HUZZAH32 - ESP32 Feather Measuring Battery

Post by dastels »

A13 is not available as an external connection and is hardwared only to the voltage divider on Vbat. You just need to use it, exactly as stated in the tutorial: https://learn.adafruit.com/adafruit-huz ... ry-3122383 and in the FAQ
A13 / I35 - this pin is not exposed, it is used only for measuring the voltage on the battery. The voltage is divided by 2 so be sure to double it once you've done the analog reading
This approach to reading the battery is also used on the STM32f405 Feather, and it's guide includes the code needed:

Code: Select all

#define VBATPIN A6

float measuredvbat = analogRead(VBATPIN);
measuredvbat *= 2;    // we divided by 2, so multiply back
measuredvbat *= 3.3;  // Multiply by 3.3V, our reference voltage
measuredvbat /= 1024; // convert to voltage
Serial.print("VBat: " ); Serial.println(measuredvbat);
You just need to change VBATPIN to be A13 instead of A6 (which is what is used on the STM board).

Dave

User avatar
Draexler
 
Posts: 2
Joined: Wed Nov 23, 2022 4:51 am

Re: Adafruit HUZZAH32 - ESP32 Feather Measuring Battery

Post by Draexler »

Very stupid question... Do I have to connect the A13 to a different PIN at all? I know that you normally have to supply voltage to the PIN so that a measurement can be carried out.

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: Adafruit HUZZAH32 - ESP32 Feather Measuring Battery

Post by dastels »

It's connected to a voltage divider internally (on the board); there isn't a place to connect to it. Hence "this pin is not exposed".

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”