1

I have an esp32 WROOM-32 connected to a MQ9 gas sensor to GPIO35. Both are powered separately. measuring the output from the sensor directly using a multi-meter shows a constant reading of 0.145 V but the readings on esp32 shows 3.3V and if fluctuates too much.

The circuit: MQ-9 AO -> voltage divider (using 1k and 2.2k ohm) -> ESP32 (GPIO35)

Sample Code:

void setup() { 
  Serial.begin(9600); 
  analogReadResolution(11);  
  analogSetWidth(11);               // 11Bit resolution
  analogSetAttenuation(ADC_0db);
} 
void loop() { 
 int ADC = analogRead(35);
 float volt = (ADC * 3.3) / 2045;
 Serial.print("Volt : ");
 Serial.println(volt);
 Serial.print("Analog : ");
 Serial.println(ADC);
 Serial.println("");
 delay(1000);
}

Image of the error: Readings and Fluctuation

2
  • 2
    please do not post a picture of text ... post the text instead, same as the code Commented Jul 23, 2023 at 14:57
  • the circuit description does not say anything about a ground connection Commented Jul 23, 2023 at 14:59

0

Your Answer

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.