1

Trying to read from a voltage divider circuit using two 240 Ohm resistors. Getting a reading of 6.0, when it should be 1.65. Circuit is powered by a bench 3.3V and both the Huzzah32 and circuit are grounded. Using USB for the Huzzah32. Any thoughts?

 void setup() 
{
 Serial.begin(9600);
}
void loop() 
{
 int sensorValue = analogRead(A9);
 float voltage = sensorValue * (3.3 / 1023.0);
 Serial.println(voltage);
 delay(1000); 
}

circuit diagram

asked Oct 21, 2020 at 7:07
6
  • Please add the schema. Commented Oct 21, 2020 at 7:10
  • My multimeter reads the correct Vout... Commented Oct 21, 2020 at 8:03
  • this gets me closer, but still low... float voltage = (sensorValue * 3.3) / (4095); Commented Oct 21, 2020 at 8:26
  • ESP32 chips have a problem with ADC and WIFI at the same time. Maybe disable WIFI ? Commented Oct 21, 2020 at 9:01
  • both the Huzzah32 and circuit are grounded ... are the grounds joined? ... your schematic does not show a common ground Commented Oct 21, 2020 at 16:54

1 Answer 1

1

First, ESP32 ADC is 12-bit, not 10-bit. therefore the formula should be:

float voltage = sensorValue * (3.3 / 4096.0);

Secondly, ESP32 ADC is not really linear, and tend to have lower reading than the actual value. You will need to do some calibration if you want to get a more accurate reading. You can take a look at my github on esp32-adc-calibrate.

answered Oct 21, 2020 at 15:02

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.