user69617: 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); 
}



user40646: 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.

69617: <p>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?</p>
<pre><code>  void setup() 
{
  Serial.begin(9600);
}
void loop() 
{
  int sensorValue = analogRead(A9);
  float voltage = sensorValue * (3.3 / 1023.0);
  Serial.println(voltage);
  delay(1000); 
}
</code></pre>
<p><a href="https://i.stack.imgur.com/leO3d.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/leO3d.png" alt="circuit diagram" /></a></p>
 40646: <p>First, ESP32 ADC is 12-bit, not 10-bit. therefore the formula should be:</p>
<pre><code>float voltage = sensorValue * (3.3 / 4096.0);
</code></pre>
<p>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 <a href="https://github.com/e-tinkers/esp32-adc-calibrate" rel="nofollow noreferrer">esp32-adc-calibrate</a>.</p>
