Language:
English | Русский (Russian)

An IoT project for monitoring temperature, humidity, and air quality with a user-friendly interface, RGB indication, and control via a Telegram bot. 🎉
This air quality monitoring station measures:
- 🌡️ Temperature (sensors DS18B20 and SHT21)
- 💧 Humidity (sensor SHT21)
- 🌫️ Particle concentration PM1.0, PM2.5, PM10 (sensor PMS5003)
- Displayed on an OLED SSD1306 display 📺
- Indicated using an RGB LED 💡
- Sent to the ThingSpeak platform 🌐
- Accessible via a Telegram bot 🤖
🌈 Air quality indication via LED:
- 🟢 Green: Low pollution level (PM2.5 ≤ 12)
- 🔵 Blue: Medium pollution level (12 < PM2.5 ≤ 35)
- 🔴 Red: High pollution level (PM2.5 > 35)
Pollution Level | Indicator Color | GIF |
---|---|---|
Low | 🟢 Green | ![]() |
Medium | 🔵 Blue | ![]() |
High | 🔴 Red | ![]() |

To securely house and protect all components, you can use a 3D-printed enclosure, available at the following link:
3D-Printed Enclosure on Thingiverse
Key benefits of using this enclosure:
- Reliable protection for sensors and the ESP32 board from external factors.
- Easy access to the OLED display, connectors, and LED.
- Customizable design: modify and reprint the enclosure as needed.
- 🪣 ESP32 DevKit
- 🌡️ DS18B20 temperature sensor
- 🌡️ SHT21 temperature and humidity sensor
- 🌫️ PMS5003 air quality sensor
- 📺 OLED SSD1306 display
- 💡 RGB LED
- 🔗 Resistors, wires, and other components
Assemble the circuit according to the code and schematics. Ensure all connections are secure.
-
Clone the repository:
git clone https://github.com/CyberScopeToday/ESP32-AirQuality-Station.git
-
Install Arduino IDE and the necessary libraries (see below).
Ensure the following libraries are installed in the Arduino IDE:
WiFi.h
Wire.h
Adafruit GFX Library
Adafruit SSD1306
OneWire
DallasTemperature
HTTPClient
SHT21
WiFiClientSecure
UniversalTelegramBot
ArduinoJson
Preferences
Create a file named config.h
:
#define WIFI_SSID "your_wifi_ssid"
#define WIFI_PASSWORD "your_wifi_password"
#define THINGSPEAK_API_KEY "your_thingspeak_api_key"
#define TELEGRAM_TOKEN "your_telegram_bot_token"
#define TELEGRAM_CHAT_ID "your_telegram_chat_id"
Replace the placeholder values with your actual credentials:
your_wifi_ssid
— Your Wi-Fi network nameyour_wifi_password
— Your Wi-Fi passwordyour_thingspeak_api_key
— Your ThingSpeak channel API keyyour_telegram_bot_token
— Your Telegram bot tokenyour_telegram_chat_id
— Your Telegram chat ID
- Connect the ESP32 via USB.
- In Arduino IDE, select the ESP32 DevKit board.
- Upload the code to the device.
Command | Description |
---|---|
/start |
Welcome message and help |
/status |
Retrieve current data from the device |
/setapikey <api_key> |
Set a new ThingSpeak API key |
/setinterval <seconds> |
Set data sending interval (minimum 300 seconds) |
/setthreshold <low> <medium> |
Set PM2.5 threshold values |
/getsettings |
View current settings |
/toggledebug |
Enable/disable debug information on the OLED display |

All data collected by the ESP32 Air Quality Monitoring Station is sent to ThingSpeak, a cloud-based platform for IoT data visualization and analysis.
Explore a real-time example of air quality data visualization on ThingSpeak:
ThingSpeak Channel - Air Quality Monitor
- 🌡️ Temperature: Visualize ambient temperature from DS18B20 and SHT21 sensors.
- 💧 Humidity: Monitor real-time humidity levels measured by the SHT21 sensor.
- 🌫️ Particulate Matter (PM): Track air quality with PM1.0, PM2.5, and PM10 data from PMS5003:
- PM1.0: Fine particles, diameter ≤ 1.0 µm
- PM2.5: Particles, diameter ≤ 2.5 µm
- PM10: Coarse particles, diameter ≤ 10 µm
- Open the ThingSpeak Channel.
- Use the charts to view real-time air quality data updated every 5 minutes.
- Analyze trends, download datasets, or integrate the data into your own applications using ThingSpeak's API.
This project is licensed under the MIT License. See LICENSE for details.