This project is designed to run on a Wemos D1 board and performs several functions related to environmental monitoring and control. It includes functionalities for reading sensor data, connecting to WiFi, publishing data to an MQTT server, sending events to IFTTT, and controlling a Toshiba air conditioner via IR commands.
- Sensor Initialization and Reading: Initializes and reads data from various sensors including MiCS-6814 (for gas detection) and BME280 (for temperature, humidity, and pressure).
- WiFi and MQTT: Connects to WiFi using WiFiManager and publishes sensor data to an MQTT server.
- IFTTT Integration: Sends events to IFTTT based on temperature and humidity thresholds.
- Telegram Bot: Uses a Telegram bot to send messages and receive commands, and controls a Toshiba air conditioner via IR commands.
- OTA Updates: Checks for firmware updates and performs OTA updates if a new version is available.
- Miscellaneous: Controls a humidifier based on humidity levels, logs data to ThingSpeak, and handles various hardware configurations and resets.
The device collects the following gases and environmental parameters:
- Temperature (°C)
- Humidity (% RH)
- Pressure (hPa)
- Carbon Monoxide (CO) (ppm)
- Nitrogen Dioxide (NO2) (ppm)
- Ammonia (NH3) (ppm)
- Propane (C3H8) (ppm)
- Butane (C4H10) (ppm)
- Methane (CH4) (ppm)
- Hydrogen (H2) (ppm)
- Ethanol (C2H5OH) (ppm)
- Arduino IDE
- Wemos D1 board
- MiCS-6814 sensor
- BME280 sensor
- Toshiba air conditioner (for IR control)
- WiFi network
Ensure you have the following libraries installed in your Arduino IDE:
- Ticker
- WiFiManager
- ESP8266HTTPClient
- ESP8266httpUpdate
- CTBot
- DHTesp
- MiCS6814-I2C
- ESP8266WiFi
- ESP8266WiFiMulti
- WiFiClientSecureBearSSL
- BME280I2C
- Wire
- ESP8266mDNS
- WiFiUdp
- Arduino
- PubSubClient
- IRremoteESP8266
- IRsend
- ir_Toshiba
- Clone this repository to your local machine.
- Open the
air_sensor-jb4-230314-commented.ino
file in the Arduino IDE. - Update the following placeholders with your actual values:
YOUR_IFTTT_KEY
YOUR_API_KEY
YOUR_API_KEY_GASSES
YOUR_MQTT_SERVER
YOUR_MQTT_USER
YOUR_MQTT_PASSWORD
YOUR_TELEGRAM_BOT_TOKEN
SERVER IP
DIRECTORY
- Connect your Wemos D1 board to your computer.
- Select the appropriate board and port in the Arduino IDE.
- Upload the sketch to the board.
Once the sketch is uploaded, the device will:
- Connect to the WiFi network.
- Initialize the sensors and start reading data.
- Publish sensor data to the MQTT server.
- Send events to IFTTT based on temperature and humidity thresholds.
- Control the Toshiba air conditioner via IR commands received from the Telegram bot.
- Check for firmware updates and perform OTA updates if a new version is available.
Contributions are welcome! Please fork this repository and submit pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.