Skip to content

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

License

Notifications You must be signed in to change notification settings

CyberScopeToday/ESP32-AirQuality-Station-Home

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌿 ESP32-Based Air Quality Monitoring Station HOME 🌿

Codacy Badge

An IoT project for monitoring CO₂ levels, 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 (sensor BME680)
  • 💧 Humidity (sensor BME680)
  • 🌫️ Air Quality (CO₂ concentration via MH-Z19B and VOC via BME680)

📊 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, CO₂ levels, and VOC data
MH-Z19B CO₂ sensor for measuring carbon dioxide concentration
BME680 Environmental sensor for temperature, humidity, pressure, and VOC

🎥 Device Demonstration

🚦 Air Quality Color Indication

🌈 Air quality indication via LED:

  • 🟢 Green: Low CO₂ level (CO₂ ≤ 800 ppm)
  • 🔵 Blue: Medium CO₂ level (800 < CO₂ ≤ 1200 ppm)
  • 🔴 Red: High CO₂ level (CO₂ > 1200 ppm)
Pollution Level Indicator Color GIF
Low 🟢 Green
Medium 🔵 Blue
High 🔴 Red

📟 Example of Data Display on the OLED Screen


⚙️ Components

  • 🪣 ESP32 DevKit
  • 🔴 MH-Z19B CO₂ sensor
  • 🌡️ BME680 temperature, humidity, pressure, and VOC sensor
  • 📺 OLED SSD1306 display
  • 💡 RGB LED
  • 🔗 Resistors, wires, and other components

🚀 Installation and Setup

1. Hardware Preparation

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

2. Software Preparation

  • Clone the repository:

    git clone /~https://github.com/CyberScopeToday/ESP32-AirQuality-Station-Home.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
  • Adafruit BME680 Library
  • MHZ19
  • HTTPClient
  • UniversalTelegramBot
  • ArduinoJson
  • Preferences

You can install these libraries via the Arduino Library Manager (Sketch -> Include Library -> Manage Libraries...).

Configuring config.h

Create a file named config.h in your project directory with the following content:

#ifndef CONFIG_H
#define CONFIG_H

// Конфигурация Wi-Fi
#define WIFI_SSID "your_wifi_ssid"          // Замените на ваш SSID Wi-Fi
#define WIFI_PASSWORD "your_wifi_password"  // Замените на ваш пароль Wi-Fi

// Конфигурация ThingSpeak
#define THINGSPEAK_API_KEY "your_api_key"   // Замените на ваш API ключ ThingSpeak

// Конфигурация Telegram-бота
#define TELEGRAM_TOKEN "your_bot_token"     // Замените на токен вашего Telegram-бота
#define TELEGRAM_CHAT_ID "your_chat_id"     // Замените на ваш Telegram chat ID

// Пороги CO₂ для индикации RGB-светодиода
#define CO2_LOW_THRESHOLD 800              // Зеленый: CO₂ ≤ 800 ppm
#define CO2_MEDIUM_THRESHOLD 1200          // Синий: 800 < CO₂ ≤ 1200 ppm

#endif

4. Uploading the Sketch

  1. Откройте Arduino IDE и загрузите файл main.ino.
  2. Выберите правильную плату и COM-порт:
    • Инструменты > Плата > выберите вашу модель ESP32 (например, "ESP32 Dev Module").
    • Инструменты > Порт > выберите соответствующий COM-порт.
  3. Загрузите скетч на устройство, нажав кнопку "Загрузить" (стрелка вправо).

📱 Telegram Bot Commands

Команда Описание
/start Приветственное сообщение и помощь
/status Получение текущих данных с устройства
/setapikey <api_key> Установка нового API ключа для ThingSpeak
/setinterval <секунды> Установка интервала отправки данных (минимум 300 секунд)
/setthreshold <низкий> <средний> Установка пороговых значений CO₂
/getsettings Просмотр текущих настроек
/toggledebug Включение/выключение отладочной информации на OLED-дисплее

📸 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 BME680 sensor.
  • 💧 Humidity: Monitor real-time humidity levels measured by the BME680 sensor.
  • 💨 CO₂ Concentration: Track CO₂ levels with data from MH-Z19B.
  • 🌫️ VOC: Monitor Volatile Organic Compounds with BME680.

🔗 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 CO2 levels with OLED display and control via Telegram.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published