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)
This air quality monitoring station measures:
- 🌡️ Temperature (sensor BME680)
- 💧 Humidity (sensor BME680)
- 🌫️ Air Quality (CO₂ concentration via MH-Z19B and VOC via BME680)
- 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 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 |
- 🪣 ESP32 DevKit
- 🔴 MH-Z19B CO₂ sensor
- 🌡️ BME680 temperature, humidity, pressure, and VOC sensor
- 📺 OLED SSD1306 display
- 💡 RGB LED
- 🔗 Resistors, wires, and other components
Assemble the circuit according to the provided schematics. Ensure all connections are secure.
-
Clone the repository:
git clone /~https://github.com/CyberScopeToday/ESP32-AirQuality-Station-Home.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
Adafruit BME680 Library
MHZ19
HTTPClient
UniversalTelegramBot
ArduinoJson
Preferences
You can install these libraries via the Arduino Library Manager (Sketch
-> Include Library
-> Manage Libraries...
).
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
- Откройте Arduino IDE и загрузите файл
main.ino
. - Выберите правильную плату и COM-порт:
Инструменты
>Плата
> выберите вашу модель ESP32 (например, "ESP32 Dev Module").Инструменты
>Порт
> выберите соответствующий COM-порт.
- Загрузите скетч на устройство, нажав кнопку "Загрузить" (стрелка вправо).
Команда | Описание |
---|---|
/start |
Приветственное сообщение и помощь |
/status |
Получение текущих данных с устройства |
/setapikey <api_key> |
Установка нового API ключа для ThingSpeak |
/setinterval <секунды> |
Установка интервала отправки данных (минимум 300 секунд) |
/setthreshold <низкий> <средний> |
Установка пороговых значений CO₂ |
/getsettings |
Просмотр текущих настроек |
/toggledebug |
Включение/выключение отладочной информации на OLED-дисплее |
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 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.
- 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.
You can find the Russian version of this README here.