A comprehensive module integrating motion detection, temperature and humidity monitoring, RGB LED control, and relay switching functionalities.
- Project Description
- Components and Pin Configurations
- Project Diagram
- Components List
- Additional Information and Resources
This project implements a home automation system using an ESP32 microcontroller. The system integrates various sensors to detect motion, monitor temperature and humidity, and control an RGB LED and a relay. The project demonstrates the use of FreeRTOS tasks to manage concurrent operations and showcases efficient utilization of I2C and GPIO interfaces for sensors. The system also includes an LCD screen to display temperature, humidity, and motion detected by the PIR sensor. The RGB LED changes color based on temperature and motion detection, while the PIR sensor activates a relay to turn on an external battery-powered lamp.
- ESP32 development board
- USB cable to connect ESP32 to your computer
- ESP-IDF Visual Studio Code Extension
- Adjust the pin settings in the
config.h
file if necessary. - Ensure all connections are secure according to the project diagram.
The LCD screen is controlled via the I2C interface, with programmatic pull-up resistors configured in the software.
- I2C_MASTER_SCL_IO: GPIO_NUM_14
- I2C_MASTER_SDA_IO: GPIO_NUM_13
The PIR sensor is connected with a programmatic pull-up resistor.
- PIR_SENSOR_PIN: GPIO_NUM_27
Definitions | Component | GPIO Pin | Interface | Type |
---|---|---|---|---|
DHT11_PIN | DHT-11 | GPIO_NUM_18 | GPIO (one-wire) | Input |
I2C_MASTER_SCL_IO | LCD1602 / SCL | GPIO_NUM_14 | I2C | Output |
I2C_MASTER_SDA_IO | LCD1602 / SDA | GPIO_NUM_13 | I2C | Output |
PIR_SENSOR_PIN | PIR Sensor | GPIO_NUM_27 | GPIO | Input |
RELAY_PIN | Relay | GPIO_NUM_12 | GPIO | Output |
RGB_LED_RED_PIN | RGB LED (Red) | GPIO_NUM_15 | PWM | Output |
RGB_LED_GREEN_PIN | RGB LED (Green) | GPIO_NUM_2 | PWM | Output |
RGB_LED_BLUE_PIN | RGB LED (Blue) | GPIO_NUM_4 | PWM | Output |
The pin definitions can be found in the config.h
file within the components
folder.
Component | Resistance/Type | Amount |
---|---|---|
DHT-11 | Humidity/Temp Sensor | 1 |
LCD | 1602 | 1 |
PIR Sensor | Motion Sensor | 1 |
Relay | SPDT | 1 |
RGB LED | Common Anode | 1 |
Resistor | 220kΩ | 4 |
Resistor | 1KΩ | 1 |
Resistor | 10KΩ | 1 |
Transisor | NPN | 1 |
LED | Blue | 1 |
Diode | rectifier | 1 |
Battery | 9v | 1 |