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 :-)
Adafruit HUZZAH32 - ESP32 Feather Measuring Battery
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Draexler
- Posts: 2
- Joined: Wed Nov 23, 2022 4:51 am
- dastels
- Posts: 12771
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Adafruit HUZZAH32 - ESP32 Feather Measuring Battery
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
You just need to change VBATPIN to be A13 instead of A6 (which is what is used on the STM board).
Dave
This approach to reading the battery is also used on the STM32f405 Feather, and it's guide includes the code needed: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
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);
Dave
- Draexler
- Posts: 2
- Joined: Wed Nov 23, 2022 4:51 am
Re: Adafruit HUZZAH32 - ESP32 Feather Measuring Battery
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.
- dastels
- Posts: 12771
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Adafruit HUZZAH32 - ESP32 Feather Measuring Battery
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
Dave
Please be positive and constructive with your questions and comments.