As smart home technologies become increasingly popular, developers seek hardware platforms that offer the right balance between performance, connectivity, and affordability. The ESP32 microcontroller has emerged as one of the most suitable choices for implementing IoT-based smart home applications due to its rich feature set and developer-friendly ecosystem.
The ESP32 is equipped with a dual-core Tensilica processor, which allows for efficient multitasking and real-time response—key requirements in automation scenarios. It includes built-in Wi-Fi and Bluetooth (Classic and BLE), removing the need for additional communication modules and simplifying the system architecture. These wireless capabilities make it easy to connect the device to cloud platforms like ThingsBoard, enabling remote monitoring and control of home appliances through smartphones or web dashboards.
Additionally, the ESP32 provides a generous number of GPIO pins, supporting a wide variety of sensors (such as temperature, humidity, gas, and light sensors) and actuators (like relays, LEDs, and displays). Its support for analog and digital I/O, PWM, I2C, SPI, and UART protocols allows seamless integration with diverse hardware components.
The module’s low power consumption modes make it ideal for battery-powered or energy-efficient smart home systems. Furthermore, the ESP32 is compatible with the Arduino IDE, making it accessible to both beginners and experienced developers. Its large community and extensive documentation accelerate development and troubleshooting, which is essential for rapid prototyping and scalable solutions.
The Internet of Things (IoT) is revolutionizing modern living by enabling seamless connectivity between devices, sensors, and systems. In the context of smart home automation, IoT allows users to monitor and control home environments remotely, enhancing comfort, security, and energy efficiency. This project explores the integration of various sensors and actuators with a microcontroller to create a responsive and connected smart home system, demonstrating how IoT can transform traditional living spaces into intelligent, automated environments.
——— Board ———
- ESP32 WROOM layout dev board
——– Sensors ———
- DHT11: temperature sensor
- HR202: humidity sensor (I2C connectivity)
- Photoresistor module: light intensity sensor (I2C connectivity)
- MQ-2: particle sensor (I2C connectivity)
——– Others ————
- 128×32 0'94 inch OLED screen (I2C connectivity)
- Tuya-compatible Smart Lightbulb
- Tuya-compatible Smart Plug
1. Arduino IDE
2. Thingsboard Community edition
3. Tuya Developer Platform
4. Google Cloud & Google Functions
1. Tuya-compatible devices are bound to send data to a pre-defined database (the tuya data center). Tried reverse engineering its flow to be able to send the data to the ESP32 board but without success. The solution was to create a proxy server between the ESP32 and Thingsboard which should handle requests to retrieve data from the devices and send them to Thingsboard and send commands from the Thingsboard cloud directly to the devices. This layer was implemented using Google Cloud VMs & Google Cloud functions but is not yet fully functional (created the scripts used to handle the requests but was unable to start the server due to extra costs).
2. MQ-2 gas sensor only has a digital output so was unable to read the actual value read by the sensor (it only acts as a notifier for when the measured value passes a certain threshold). The threshold was set using the sensors datasheet and a potentiometer installed on the sensor's module.
3. In the final configuration the photoresistor module's output is connected to pin 4 of the ESP32 dev board (the only remaining working pin with an ADC). It seems that pin 4 is also used for Wi-Fi communication so while the ESP32 is connected to Thingsboard the board is not able to read the sensor's value. However, to demonstrate that the sensor works and ESP is able to read its value a small script was attached below.
1. Thingsboard documentation: https://thingsboard.io/docs/getting-started-guides/helloworld/
2. Tuya Developer documentation: https://developer.tuya.com/en/overview
3. DHT11 sensor connection: https://randomnerdtutorials.com/esp32-dht11-dht22-temperature-humidity-sensor-arduino-ide/
4. Google Cloud documentation: https://cloud.google.com/docs