Skip to content

☀️Smart environmental monitor with ESP32: measuring temperature, humidity and pollution levels with OLED display and control via Telegram.

License

Notifications You must be signed in to change notification settings

CyberScopeToday/ESP32-AirQuality-Station

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌿 ESP32-Based Air Quality Monitoring Station 🌿

CodeFactor

An IoT project for monitoring temperature, humidity, and air quality with a user-friendly interface, RGB indication, and control via a Telegram bot. 🎉


🇷🇺 Click here for the Russian version of the README (Нажмите здесь для русской версии README)


📋 Description

This air quality monitoring station measures:

  • 🌡️ Temperature (sensors DS18B20 and SHT21)
  • 💧 Humidity (sensor SHT21)
  • 🌫️ Particle concentration PM1.0, PM2.5, PM10 (sensor PMS5003)

📊 Acquired Data:

  • Displayed on an OLED SSD1306 display 📺
  • Indicated using an RGB LED 💡
  • Sent to the ThingSpeak platform 🌐
  • Accessible via a Telegram bot 🤖

🛠 Used Technologies

Technology Description
ESP32 Main controller of the project
Arduino IDE Arduino IDE Development environment for programming the ESP32
ThingSpeak ThingSpeak Platform for data analysis and storage
Telegram Telegram Bot Device management and data retrieval
OLED Display Displays temperature, humidity, and air quality data

🎥 Device Demonstration

🚦 Air Quality Color Indication

🌈 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

📟 Example of Data Display on the OLED Screen


⚙️ Components

  • 🪣 ESP32 DevKit
  • 🌡️ DS18B20 temperature sensor
  • 🌡️ SHT21 temperature and humidity sensor
  • 🌫️ PMS5003 air quality sensor
  • 📺 OLED SSD1306 display
  • 💡 RGB LED
  • 🔗 Resistors, wires, and other components

🚀 Installation and Setup

1. Hardware Preparation

Assemble the circuit according to the code and schematics. Ensure all connections are secure.

2. Software Preparation

  • Clone the repository:

    git clone https://github.com/CyberScopeToday/ESP32-AirQuality-Station.git
  • Install Arduino IDE and the necessary libraries (see below).

3. Configuration Setup

Installing Libraries

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

Configuring config.h

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 name
  • your_wifi_password — Your Wi-Fi password
  • your_thingspeak_api_key — Your ThingSpeak channel API key
  • your_telegram_bot_token — Your Telegram bot token
  • your_telegram_chat_id — Your Telegram chat ID

4. Uploading the Sketch

  1. Connect the ESP32 via USB.
  2. In Arduino IDE, select the ESP32 DevKit board.
  3. Upload the code to the device.

📱 Telegram Bot Commands

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

📸 Device Photos


📈 Data Visualization on ThingSpeak

All data collected by the ESP32 Air Quality Monitoring Station is sent to ThingSpeak, a cloud-based platform for IoT data visualization and analysis.

🌟 Live Dashboard Example

Explore a real-time example of air quality data visualization on ThingSpeak:
ThingSpeak Channel - Air Quality Monitor

📊 Charts Available:

  • 🌡️ 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

🔗 How to Access

  1. Open the ThingSpeak Channel.
  2. Use the charts to view real-time air quality data updated every 5 minutes.
  3. Analyze trends, download datasets, or integrate the data into your own applications using ThingSpeak's API.

📄 License

This project is licensed under the MIT License. See LICENSE for details.


🎯 Useful Links


🇷🇺 Русская версия README

You can find the Russian version of this README here.


About

☀️Smart environmental monitor with ESP32: measuring temperature, humidity and pollution levels with OLED display and control via Telegram.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published