|
MQ135 air quality sensor module |
x 1 | |
|
0.96 Inch Oled Display Module |
x 1 | |
|
|
Arduino Nano |
x 1 |
Air quality sensor
MQ-135 Air quality sensor, Arduino nano, SSD1306 OLED
#include "MQ135.h"
//OLED Display libraries
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET 4
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
//In and Out
int RedLed = 9;
int GreenLed = 8;
int Buzzer = 7;
void setup()
{
pinMode(RedLed, OUTPUT); // initialize digital pin RedLed as an output.
pinMode(GreenLed, OUTPUT); // initialize digital pin GreenLed as an output.
pinMode(Buzzer, OUTPUT); // initialize digital pin Buzzer as an output.
// Start serial communication between arduino and your computer
Serial.begin(9600);
//initialize with the I2C addr 0x3C (128x64)
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
delay(10);
// Print text on display
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println("MQ 135"); // Print text
display.display();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,20);
display.println("Sensore");
display.display();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,35);
display.println(" Air quality");
display.display();
delay(2000);
}
void loop()
{
// Read Senso value
MQ135 gasSensor = MQ135(A0);
float air_quality = gasSensor.getPPM();
// Print Senso value on Serial Monitor Window
Serial.print("Air Quality: ");
Serial.print(air_quality);
Serial.println(" PPM");
Serial.println();
//Print Senso value or Air Quality Index on OLED Display
display.clearDisplay();
display.setCursor(0,0); //oled display position
display.setTextSize(1);
display.setTextColor(WHITE);
display.println("Air Quality Index");
display.setCursor(0,20); //oled display position
display.setTextSize(2);
display.setTextColor(WHITE);
display.print(air_quality);
display.setTextSize(1);
display.setTextColor(WHITE);
display.println(" PPM");
display.display();
// when air quality value less than 1000PPM
if (air_quality<=1000)
{
digitalWrite(GreenLed, HIGH); // turn the Green LED on
digitalWrite(RedLed,LOW); // turn the Red LED off
noTone(Buzzer); // turn the Buzzer off
// Print text on OLED Display
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,45);
display.println("Fresh Air"); //Message
display.display();
delay(2000);
}
// when air quality value greater than 1000PPM & less than 2000PPM
else if( air_quality>=1000 && air_quality<=2000 )
{
digitalWrite(GreenLed,LOW); // turn the Green LED off
digitalWrite(RedLed, HIGH ); // turn the Red LED on
noTone(Buzzer); // turn the Buzzer off
// Print text on OLED Display
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,45);
display.println(" Poor Air"); //Message
display.display();
delay(2000);
}
// when air quality value greater than 2000PPM
else if (air_quality>=2000 )
{
digitalWrite(GreenLed,LOW); // turn the Green LED off
digitalWrite(RedLed,HIGH); // turn the Red LED on
tone(Buzzer, 1000, 200); // turn the Buzzer on
// Print text on OLED Display
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,45);
display.println("Danger!!"); //Message
display.display();
delay(2000);
}
}
Air quality sensor
Project images are for reference only. Actual production is based on the manufacturing files on the project page.
Please review the designer's notes (e.g., PCB thickness) and select the appropriate options.
PCBWay is not responsible
for issues caused by unsuitable parameter selections.
For more important ordering information, please refer to
Read More
Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW- Comments(0)
- Likes(1)
-
(DIY) C64iSTANBUL
Jul 29,2025
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Engineer
-
TDA7000 Fm Radio
Fm Radio with TDA7000ANT 1 is antenna ground (if you use a telescopic or a single wire connect the p...
-
Fm notch filter
FM Bandstop (Notch) FilterL1, L2, L3 : 0.3 uHC1: C2, C3: 7 pF
-
microphone module
microphone amplifier module
-
Altimeter sensor
Altimeter, pressure sensor with MS561101BA03
-
BF199 untuned radio receiver
Receives shortwave (not tuned)T1: BF199C1: 100 nFR1: 1.5kR2: 300kC2: 1 nFL1: 10 uHL2: 2 uHAF / AFGND...
-
LM7809 9V Voltage Regulator
9v power supply using LM709, with reverse polarity protection at the input. Use an heatsink1x LM7809...
-
LM386 Amplifier board
Mono audio amplifier with a LM386, gain of 200 (47 db)IC1: LM386C1: 100 uFC2: 10 uFIN: Audio jackOUT...
-
MAV-11BSM / ERA-11 Amplifier board
MAV-11BSM or ERA-11 Amplifier board1x MAV-11BSM (or ERA-11)C1, C2: 150 pFR1: 70 OhmRFIN - RFOUT 2 x ...
-
TA7642 Direct conversion Medium wave receiver
Voltage: 3 - 5 VPARTS:1x TA7642T1: BC337 (or any NPN transistor)R1: 100kR2: R3 1kR3: 1KR4: 470RR5: 4...
-
AM Medium wave transmitter
Low power AM Medium wave transmitter, for old radios for example.If you use an antenna longer than 1...
-
vibration sensor
PARTS:9V Battery ClipIC1: LM741 or UA741PIEZO: Piezo transducer positivePIEZO_GND: Piezo negativeC1:...
-
Heart pulse sensor
Place one finger on both TX and RX IR leds, and the PULSE led will blink. IC socketIC1: LM358TX: IR...
-
HF preamp medium wave 40 db
MW gain: 40 dbSW gain: 20 - 10 dbQ1: J111 or J310T1: 2N3904C1: 10 nFC2, C3: 100 nFR1: 1MOhmR2: 6,8 k...
-
Proximity sensor
IC1: LM358TM1: 100KΩ variable resistorR1: 1KΩR2: 10KΩD1: IR LedD2: IR receiver photodiode (black)9D3...
-
Fm transmitter
PART LIST:C1, C5, C6 : 22 pf capacitorC2: 10 pF trimmer capacitorC3: 22 uF capacitorC4 : 10 pf capac...
-
CD4026 Counter with external clock
Counter with CD4026 and 1-digit 7 segments led display. Needs external clock ( from a 555, signal ge...
-
Air quality sensor
MQ-135 Air quality sensor, Arduino nano, SSD1306 OLED
-
Programmable Mist Maker - XIAO / QT PY Extension
1061 2 1 -
RadioHAT - Raspberry Pi radio development platform
867 0 2 -
QWIIC-VL53L4CD Time-of-Flight Distance Sensor Module
1089 0 1 -
-
-
-
ARPS-2 – Arduino-Compatible Robot Project Shield for Arduino UNO
3323 0 6 -
-
A Compact Charging Breakout Board For Waveshare ESP32-C3
3933 3 8 -
AI-driven LoRa & LLM-enabled Kiosk & Food Delivery System
4320 2 2







