Lolin S2 mini ADC read incorrect valises

I am currently building a battery operated esp32 project using 2- AAA batteries. I also have a step converter, pushing the voltage to 5volts. I have connected the 5v to the VBUS input. My AAA battery voltage reading using my DVM at the pin is 2.8v. Basically when I am trying to read the battery voltage of the AAA batteries, I see values greater then 8000 counts(The S2 has a 13 bit ADC), when I expect values closer to 7000. If I ground the pin I see the value change to under 10. So it seems to be kind of working.

I also tried the example "ESP32AnalogReadTest.ino" from the Arduino library ESP32AnalogRead. Using this example I read 2.58 v for my AAA batteries and the 3.3v output from the on board regulator.(Second example), if I ground the pin the output is "0v"

Thanks for any help.

Development board link: Lolin S2 Mini
image

Here is my first code example:

const int VbusInPin = 3;
int VbusInVal = 0;

void setup() {
  Serial.begin(115200);
  delay(2000);
  pinMode(VbusInPin, INPUT);
}
// the loop function runs over and over again forever
void loop() {
  VbusInVal = analogRead(VbusInPin);  
  Serial.println(VbusInVal);// 
}

/************ Second code example *********************************/

#include "Arduino.h"
#include <ESP32AnalogRead.h>
ESP32AnalogRead adc;

void setup()
{
adc.attach(3);
Serial.begin(115200);
}
void loop()
{
delay(500);
Serial.println("Voltage = "+String(adc.readVoltage()));
}

Post links to the esp device you are using, be sure it has technical information in it. Not all A/D front ends on the ESPs are the same nor are the max voltages the same. A small schematic showing how it is connected will also help.

Thank you for the suggestions. I have added a simple schematic "ish" to try and better describe my setup and connections to the original post. I also added a link for my board that includes the Espressif datasheet for my specific part, and the board schematic.

The schematic is a great help. If the A/D input will support 3V3 or more you are all set.

I finally figured out my issue, the esp32-S2 ADC only supports a max voltage of around 2.5v, so my 2.8 volts was limited to 2.54 volts. Ill have to add a voltage divider to solve my issue.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.