Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cyberscopetoday/esp32-airquality-station

Smart environmental monitor with ESP32: measuring temperature, humidity and pollution levels with OLED display and control via Telegram.
https://github.com/cyberscopetoday/esp32-airquality-station

Last synced: 13 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# 🌿 ESP32-Based Air Quality Monitoring Station 🌿

[![CodeFactor](https://www.codefactor.io/repository/github/cyberscopetoday/esp32-airquality-station/badge)](https://www.codefactor.io/repository/github/cyberscopetoday/esp32-airquality-station)

> **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)](readmeru.md)**

---

## πŸ“‹ 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](https://img.icons8.com/color/48/000000/arduino.png) **Arduino IDE** | Development environment for programming the ESP32 |
| ![ThingSpeak](https://img.icons8.com/color/48/000000/api.png) **ThingSpeak** | Platform for data analysis and storage |
| ![Telegram](https://img.icons8.com/color/48/000000/telegram-app.png) **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:

```bash
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`**:

```cpp
#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 ` | Set a new ThingSpeak API key |
| `/setinterval ` | Set data sending interval (minimum 300 seconds) |
| `/setthreshold `| 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](https://thingspeak.mathworks.com/channels/991348)**

### πŸ“Š 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](https://thingspeak.mathworks.com/channels/991348)**.
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](LICENSE) for details.

---

## 🎯 Useful Links

- πŸ“• [ESP32 Documentation](https://www.espressif.com/en/products/socs/esp32/resources)
- 🌐 [ThingSpeak API](https://thingspeak.com)
- πŸ€– [Creating a Telegram Bot](https://core.telegram.org/bots)

---

# πŸ‡·πŸ‡Ί Русская вСрсия README

You can find the Russian version of this README [here](readmeru.md).

---