CircuitPlanning:
Arduino UNO R3 --> MQ135 Sensor
Pins--> Vin-->Vcc
Pins--> GND --> GND
Pins--> A0 --> A0
Code://Coded and Tested By:
//Sheekar Banerjee, AI-ML, IOT Solution Engineer and Researcher
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0); // read the input on analog pin 0:
Serial.println("The amount of CO2 (in PPM): ");
Serial.println(sensorValue);
delay(2000);
}
Results:SerialMonitor:
SerialPlotter:
NecessaryInformation:
It took almost 40 minutes for my sensor to preheat. it may take more or less in different situations. On the serial monitor, you can see the values of the analog pin being detected. Currently, in my case, they are around about 100 ppm which indicates normal air. But when breath out right in front of sensor, suddenly the reading rises up closing to 170-220 PPM.
- Normal air returns approximately 100-150 ppm
- Alcohol returns approximately 700 ppm
- Lighter gas returns approximately 750 ppm
PPM stands for “Parts per million”
Aceton (C3H6O) Measurement:CircuitPlanning:
Arduino UNO R3 --> MQ135 Sensor
Pins--> Vin-->Vcc
Pins--> GND --> GND
Pins--> A0 --> A0
Code://Coded and Tested By:
//Sheekar Banerjee, AI-ML-IOT Solution Engineer and Researcher
int R0 = 176;
int R2 = 1000;
float RS;
float PPM_acetone;
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0); // read the input on analog pin 0:
// convert to voltage:
float volts = sensorValue * 5;
volts = volts / 1023;
// calculate RS
RS = R2 * (1-volts);
RS = RS/volts;
// calculate acetone PPM
PPM_acetone = 159.6 - 133.33*(RS/R0);
// print out the acetone concentration:
Serial.println(PPM_acetone);
delay(3000); // delay in between reads for stability
}
Results:SerialMonitor:
SerialPlotter:
Comments