This project implements a monitoring system using an ESP32 microcontroller to measure and display temperature, humidity, and CO2 levels in real-time.
This is designed to be used to monitor the environment when growing plants
Here is a list of parts used in this project
Note
Amazon links are non-affiliate
NAME | PRICE | COUNT | DESCRIPTION | LINK | NOTE |
---|---|---|---|---|---|
ESP32 | $5 | 1 | Microcontroller | Amazon | USB-C ESP32 Amazon |
DHT22 | $3 | 1 | Temp/Humidity Sensor | Amazon | |
MQ-135 | $3 | 1 | CO2 Sensor | Amazon | |
OLED Display | $3 | 1 | 0.96" OLED Display 128x64 SSD1306 | Amazon | |
Kasa Smart Plug | $7.50 | 2 | TP-Link Kasa Smart Plug HS103 | Amazon | Intake and exhaust fans smart plugs |
Rocker Switch | $0.60 | 2 | Rocker Switch On/Off 2 Pin | Amazon | |
1K Ω Resistor | $0.25 | 1 | 1K Ohm Resistor | Amazon | MQ-135 analog pin |
10K Ω Resistor | $0.25 | 0/1/2 | 10K Ohm Resistor | Amazon | Most DHT22 sensor modules have a built-in resistor |
Wire/Breadboard | $1 | 0/1 | Jumper wire or breadboard | Amazon | Optional depending on setup |
Breakout Board | $4 | 0/1 | ESP32 Breakout Board GPIO | Amazon | Optional depending on setup |
Buck Converter | $1 | 0/1 | LM2596 DC-DC Buck Converter Step Down | Amazon | Optional depending on setup |
Barrel Jack | $1 | 0/1 | Female DC Barrel Jack Panel Adapter | Amazon | Optional depending on setup |
1N5819 Diode | $0.1 | 0/1 | 1N5819 Schottky Diode | Amazon | Optional depending on setup |
1000µF Capacitor | $0.4 | 0/1 | 1000uF 10V 8x12mm Capacitor | Amazon | Optional depending on setup |
Tip
Lower prices can be found if you shop around
Once you have all the required parts in hand, you can start wiring
ESP32 Pin | Destination | Type | Power Requirements (Volts) | ESP32 VCC Pin | ESP32 GND Pin |
---|---|---|---|---|---|
27 | DHT22 | Digital | 3.3 - 5 | 3.3V | GND |
35 | CO2 Sensor | Analog | 5 | 5V | GND |
21 | OLED SCL | SCL | 3.3 | 3.3V | GND |
22 | OLED SDA | SDA | 3.3 | 3.3V | GND |
19 | Rocker Switch | GPIO | GND |
Note
Feel free to change the pins used on the ESP32, just note, if you change the pins, you will need to update the values in the code.
You will need to define values to suite your needs. Variables are defined in config.h
Here is a list of WiFi variables that must be defined and their descriptions...
WIFI_SSID
: WiFi SSID (network/WiFi name)
WIFI_PASSWORD
: WiFi password
WIFI_HOSTNAME
: Hostname of ESP32 to set
Other variables in the code can be changed to suite your needs
You will need to install additional libraries.
In Arduino IDE, go to library manager and search and install the
required libraries listed in the DEPENDENCIES
section in main.ino
I use Arduino IDE to upload the code to the board. I had to install additional drivers (Download) to get connected to my board.
I installed the ESP32 boards and selected ESP32dev board.
The housing to hold the ESP32 can be 3D printed.
The 3D model files are located under the 3D-models directory.
Name | Image | Link | Author |
---|---|---|---|
ESP32-Plant Case | ESP32-Plant Case Case | ConnerWill | |
DHT22 Case | Over-engineered DHT22 / AM2302 Board Case | SciMonster | |
MQ-135 Case | MQ-2 Sensor Case | RJGII |
- [] Improve wiring/setup instructions
- [] Finish 3D models
- [] Add finished product images
- [] Improve code
- microcontrollerslab.com/esp32-dht11-dht22-web-server
- blog.asksensors.com/air-quality-sensor-mq135-cloud-mqtt
- maker.pro/everything-esp/projects/how-to-control-a-relay-module-with-esp32
- thingiverse.com/thing:4521313
- thingiverse.com/thing:2893581
- javl.github.io/image2cpp
- github.com/ConnerWill/KasaSmartPlug