The ESP32 Home Monitoring Hub is a versatile IoT project that leverages the ESP32 microcontroller to monitor environmental parameters such as temperature, humidity, pressure, and light intensity. It integrates multiple sensors and a display to provide real-time data visualization, making it ideal for home automation, environmental monitoring, or educational purposes.
- Features
- Hardware Requirements
- Software Requirements
- Installation
- Wiring
- Usage
- Libraries Used
- Code examples
- Next Steps
- Contributing
- License
- Real-time monitoring of temperature, humidity, atmospheric pressure, and light intensity.
- Visual display of sensor data on an ST7735 TFT screen.
- Easy-to-use interface for home monitoring applications.
- Modular design supporting multiple sensors.
- Low-power operation suitable for continuous monitoring.
- ESP32 Development Board (e.g., ESP32-WROOM-32)
- DHT Sensor (e.g., DHT11 or DHT22 for temperature and humidity)
- BMP280 Sensor (for atmospheric pressure and temperature)
- BH1750 Sensor (for light intensity)
- ST7789 TFT Display (1.8" SPI TFT display)
- Jumper wires
- Breadboard or custom PCB
- USB cable for programming and power
- Arduino IDE or PlatformIO for programming the ESP32
- ESP32 board support package installed in the Arduino IDE
- Required libraries (listed below)
-
Set up the Arduino IDE:
- Install the Arduino IDE from arduino.cc.
- Add ESP32 board support by following the ESP32 Arduino setup guide.
-
Install the required libraries:
- Open the Arduino IDE Library Manager and install the following libraries:
Adafruit_SensorDHT sensor libraryAdafruit_BMP280_LibraryBH1750Adafruit_ST7735_Library
- Alternatively, download them from the links in the Libraries Used section and add them manually.
- Open the Arduino IDE Library Manager and install the following libraries:
-
Clone the repository:
git clone https://github.com/guustavomc/ESP32-Home-Monitoring-Hub.git
-
Upload the code:
- Open the main sketch (e.g.,
ESP32_Home_Monitoring_Hub.ino) in the Arduino IDE. - Connect your ESP32 to your computer via USB.
- Select the appropriate board and port in the Arduino IDE.
- Upload the code to the ESP32.
- Open the main sketch (e.g.,
Below is a general wiring guide for connecting the sensors and display to the ESP32. Adjust pin assignments based on your specific code configuration.
| Component | ESP32 Pin | Notes |
|---|---|---|
| DHT11/DHT22 | GPIO 4 | Data pin |
| BMP280 (SDA) | GPIO 21 | I2C SDA |
| BMP280 (SCL) | GPIO 22 | I2C SCL |
| BH1750 (SDA) | GPIO 21 | I2C SDA (shared I2C bus) |
| BH1750 (SCL) | GPIO 22 | I2C SCL (shared I2C bus) |
| ST7789 (TFT_CS) | GPIO 5 | Chip Select |
| ST7789 (DC) | GPIO 2 | Data/Command |
| ST7789 (RST) | GPIO 15 | Reset |
| ST7789 (SCL) | GPIO 18 | SPI Clock |
| ST7789 (SDA) | GPIO 23 | SPI MOSI |
Notes:
- Ensure a common ground (GND) for all components.
- Power the sensors and display with 3.3V or 5V as per their specifications.
- Verify pin assignments in the code before wiring.
- Power the ESP32 via USB or an external power source.
- The ST7735 display will show real-time data from the connected sensors:
- Temperature and Humidity from the DHT sensor.
- Atmospheric Pressure (and optional temperature) from the BMP280.
- Light Intensity (in lux) from the BH1750.
- Customize the display output or data logging by modifying the Arduino sketch as needed.
The project relies on the following open-source libraries:
- Adafruit_Sensor - Base library for Adafruit sensors
- DHT-sensor-library - For DHT11/DHT22 sensors
- Adafruit_BMP280_Library - For BMP280 pressure sensor
- BH1750 - For BH1750 light sensor
- Adafruit_ST7735_Library - For ST7735 TFT display
The project used as a base multiple example projects from the community, examples used for each component:
- Display ST7789 - Display example
- Sensor BH1750 - For BH1750 sensors
- Sensor BMP280 - For BMP280 sensor
- Sensor DHT11 - For DHT11 sensor
- Sensor PIR Motion - For PIR Motion Sensor
The following features are planned to enhance the ESP32 Home Monitoring Hub:
- Display Improvement: adding button to turn on display, option to navigate on specific display details.
- Sharing Sensor Data to a Separate Server: Enable Wi-Fi connectivity to send sensor data to a remote server or cloud platform for real-time monitoring and data visualization. Using https://github.com/plapointe6/EspMQTTClient
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature). - Make your changes and commit (
git commit -m "Add your feature"). - Push to the branch (
git push origin feature/your-feature). - Open a Pull Request.
Please ensure your code follows the project's coding style and includes appropriate documentation.
