Devices & Components
Arduino Uno Rev3
MQ-135 Gas Sensor
Software & Tools
Arduino IDE
Project description
Code
Program of MQ-135 Sensor (CO2) with Arduino UNO R3
arduino
This code is for measuring Carbon Dioxide (CO2)
1//Coded and tested by: 2//Sheekar Banerjee, AI-ML-IOT Solution Engineer 3 and Researcher 4 5void setup() { 6 // initialize serial communication at 7 9600 bits per second: 8 Serial.begin(9600); 9} 10 11void loop() { 12 // 13 read the input on analog pin 0: 14 int sensorValue = analogRead(A0); 15 Serial.println("The 16 amount of CO2 (in PPM): "); 17 Serial.println(sensorValue); 18 delay(2000); 19}
Program of MQ-135 Sensor (Acetone) with Arduino UNO R3
arduino
This Code for measuring Acetone(C3H6O) with MQ-135 Sensor
1//Coded and tested by: 2//Sheekar Banerjee, AI-ML-IOT Solution Engineer and Researcher 3 4int R0 = 176; 5int R2 = 1000; 6float RS; 7float PPM_acetone; 8 9void setup() { 10 Serial.begin(9600); 11} 12 13void loop() { 14 // read the input on analog pin 0: 15 int sensorValue = analogRead(A0); 16 // convert to voltage: 17 float volts = sensorValue * 5; 18 volts = volts / 1023; 19 // calculate RS 20 RS = R2 * (1-volts); 21 RS = RS/volts; 22 // calculate acetone PPM 23 PPM_acetone = 159.6 - 133.33*(RS/R0); 24 // print out the acetone concentration: 25 Serial.println("Acetone (C3H6O) Value: "); 26 Serial.println(PPM_acetone); 27 delay(3000); // delay in between reads for stability 28}
Program of MQ-135 Sensor (CO2) with Arduino UNO R3
arduino
This code is for measuring Carbon Dioxide (CO2)
1//Coded and tested by: 2//Sheekar Banerjee, AI-ML-IOT Solution Engineer and Researcher 3 4void setup() { 5 // initialize serial communication at 9600 bits per second: 6 Serial.begin(9600); 7} 8 9void loop() { 10 // read the input on analog pin 0: 11 int sensorValue = analogRead(A0); 12 Serial.println("The amount of CO2 (in PPM): "); 13 Serial.println(sensorValue); 14 delay(2000); 15}
Downloadable files
Circuit Diagram of MQ135 Sensor with Arduino UNO R3
Circuit Diagram of MQ135 Sensor with Arduino UNO R3

Circuit Diagram of MQ135 Sensor with Arduino UNO R3
Circuit Diagram of MQ135 Sensor with Arduino UNO R3

Comments
Only logged in users can leave comments