├── MQ135_Block_Diagram_Flow_Chart.docx ├── README.md ├── hirentailor_mq135_AirQuality.ino └── hirentailor_mq135_AirQuality_Image.jpg /MQ135_Block_Diagram_Flow_Chart.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hiren-tailor/MQ135-Air-Quality-Arduino/5fce578201e786d6249fe16cfb601a4f3c204a75/MQ135_Block_Diagram_Flow_Chart.docx -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MQ135-Air-Quality-Arduino 2 | Video Link : https://youtu.be/SCXteaUVICw 3 | This Arduino Tutorial explain about how to make air quality monitoring and alert system using MQ135 sensor in ppm. 4 | Components: Arduino Board, MQ135 sensor, 16x2 LCD, Potentiometer, Resistor, LED, Buzzer, breadboard. 5 | -------------------------------------------------------------------------------- /hirentailor_mq135_AirQuality.ino: -------------------------------------------------------------------------------- 1 | #include //Header file for LCD 2 | const int rs=12, en=11, d4=5, d5=4, d6=3, d7=2; //pins of LCD connected to Arduino 3 | LiquidCrystal lcd(rs,en,d4,d5,d6,d7); //lcd function from LiquidCrystal 4 | 5 | int buz = 8; //buzzer connected to pin 8 6 | int led = 9; //led connected to pin 9 7 | 8 | const int aqsensor = A0; //output of mq135 connected to A0 pin of Arduino 9 | int threshold = 250; //Threshold level for Air Quality 10 | 11 | void setup() { 12 | 13 | pinMode (buz,OUTPUT); // buzzer is connected as Output from Arduino 14 | pinMode (led,OUTPUT); // led is connected as output from Arduino 15 | pinMode (aqsensor,INPUT); // MQ135 is connected as INPUT to arduino 16 | 17 | Serial.begin (9600); //begin serial communication with baud rate of 9600 18 | 19 | lcd.clear(); // clear lcd 20 | lcd.begin (16,2); // consider 16,2 lcd 21 | } 22 | 23 | void loop() { 24 | 25 | int ppm = analogRead(aqsensor); //read MQ135 analog outputs at A0 and store it in ppm 26 | 27 | Serial.print("Air Quality: "); //print message in serail monitor 28 | Serial.println(ppm); //print value of ppm in serial monitor 29 | 30 | lcd.setCursor(0,0); // set cursor of lcd to 1st row and 1st column 31 | lcd.print("Air Qualit: "); // print message on lcd 32 | lcd.print(ppm); // print value of MQ135 33 | 34 | if (ppm > threshold) // check is ppm is greater than threshold or not 35 | { 36 | lcd.setCursor(1,1); //jump here if ppm is greater than threshold 37 | lcd.print("AQ Level HIGH"); 38 | Serial.println("AQ Level HIGH"); 39 | tone(led,1000,200); //blink led with turn on time 1000mS, turn off time 200mS 40 | digitalWrite(buz,HIGH); //Turn ON Buzzer 41 | } 42 | else 43 | { 44 | digitalWrite(led,LOW); //jump here if ppm is not greater than threshold and turn off LED 45 | digitalWrite(buz,LOW); //Turn off Buzzer 46 | lcd.setCursor(1,1); 47 | lcd.print ("AQ Level Good"); 48 | Serial.println("AQ Level Good"); 49 | } 50 | delay (500); 51 | } 52 | -------------------------------------------------------------------------------- /hirentailor_mq135_AirQuality_Image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hiren-tailor/MQ135-Air-Quality-Arduino/5fce578201e786d6249fe16cfb601a4f3c204a75/hirentailor_mq135_AirQuality_Image.jpg --------------------------------------------------------------------------------