In this ESP32 project, I have explained how to make a practical IoT project using the smallest ESP32C3 from the XIAO series and DHT11 sensor with the New Blynk IoT platform.
If there is no internet, still you can also control 4 home appliances with the IR remote and manual switches.
The ESP32 will automatically connect with the Blynk IoT cloud if the WiFi is available. Then you can control the relays from anywhere in the world through the internet and monitor the real-time feedback in Blynk IoT App.
I have used all the FREE tools for this ESP32 IoT project using Blynk.
So if you follow all the steps, you can easily make this Home Automation System with ESP32 and Blynk IoT app.
Table of Contents
Required Components for ESP32C3 IoT project
- XIAO ESP32 C3 development board Amazon
- 4-channel 5V SPDT Relay Module Amazon
- DHT11 Sensor Amazon
- TSOP1838 IR Receiver (with metallic case) Amazon
- Switches Amazon
- Any IR Remote
Circuit of IoT Project using XIAO ESP32-C3
The circuit is very simple, I have used D10, D9, D8 & D7 GPIO to control the 4-channel relay module.
And the GPIO D1, D2, D3 & D4 are connected with switches to control the relay module manually.
I have used the INPUT_PULLUP function in Arduino IDE instead of using the pull-up resistors with each push button.
As per the source code, when the control pins of the relay module receive a LOW signal the relay will turn on and the relay will turn off for the HIGH signal in the control pin.
IR remote receiver (TSOP1838) connected with D5. And the DHT11 sensor is connected with the D6.
If you want to use the pushbuttons instead of latched switches, then just connect the pushbuttons instead of the latched switches across GPIO pins and GND.
I have used a 5V 5Amp mobile charger to supply the circuit.
Please take proper safety precautions while connecting the AC appliances.
Tutorial video on XIAO ESP32C3 & Blynk IoT
In the Internet of things tutorial video, I have covered the following steps in detail.
- Control appliances with Google Assistant Blynk & IR Remote
- Controlling relays with DHT11 Sensor and Timer using Blynk Automation.
- Circuit of the ESP32 IoT Home Automation projects.
- How to set up Blynk IoT cloud for ESP32.
- Source Code for the Blynk ESP32 IoT project.
- How to add Automations in Blynk IoT (Timer and Sensor ).
Set up Blynk IoT Cloud for the IoT-based Project
You can refer to the following article to set up the new Blynk cloud account
Create Blynk Template
During creating the template, I selected ESP32 as the hardware and the connection type as WiFi.
Create Datastreams in Blynk Cloud
For demonstration, I have created 4 Datastreams (V1 to V4) to control 4 relays, 1 Datastream (V5) to turn off all the relays, and 2 Datastreams (V6 & V7) to get the DHT11 sensor readings.
Create Web Dashboard
After that, click and drag Switch widgets according to the number of relays and 2-level widgets for DHT11 sensors.
Then click on “Save“.
Add Device in Blynk Cloud using Template
You can refer to the following article to add a device to the Blynk cloud.
Program ESP32C3 with Arduino IDE
For this IoT-based home automation project, I have used the Arduino IDE to program NodeMcU.
First update the Preferences –> Aditional boards Manager URLs: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
- Then install the ESP32 board (2.0.5) from the Board manager or Click Here to download the ESP32 board.
- Download the required libraries from the following links:
Now Select the XIAO ESP32C3 board in Arduino IDE from the following menu.
Tools — Board — ESP32 Arduino — XIAO ESP32C3
Source Codes for ESP32C3 Blynk IoT Project
Click on the following buttons to download the source codes for this ESP32 project.
Modify the main code for this IoT-based project
In the code, you have to update only the BLYNK_TEMPLATE_ID, BLYNK_DEVICE_NAME, Auth Token, WiFi Credentials, and HEX codes of the IR remote as shown in the video.
After doing these changes, go to Tools and select the board as “XIAO ESP32C3” and the proper PORT in Arduino IDE.
Then click on the upload button to program the XIAO ESP32 C3 board.
You can also design PCBs to make the circuit compact and give the project a professional look and order it from PCBWay.
About PCBWay and their services
You can order any custom design PCBs from PCBWay at very reasonable prices.
PCBWay not only produces FR-4 and Aluminum boards but also advanced PCBs like Rogers, HDI, and Flexible and Rigid-Flex boards, at very affordable prices.
For the online instant quote page please visit – pcbway.com/orderonline
You can also explore different PCB projects from their Open-source community pcbway.com/project/.
For more details please visit the following articles.
Control relays with the Blynk IoT, IR Remote & Switch
You can control appliances with the New Blynk IoT app from anywhere in the world through the internet.
If the ESP32C3 is connected to WiFi, then you can also monitor the real-time feedback and room temperature in the Blynk IoT app.
You can use any IR remote to control the appliances.
First, get the HEX codes of unused IR Remote buttons, then update the HEX codes in the code.
If the Wi-Fi is not connected, still you can control relays with the IR remote.
You can also control the appliances with manual switches.
If the ESP32C3 is connected to Wi-Fi then it will send real-time feedback to the Blynk IoT server.
I hope you like this Smart home IoT project idea with ESP32 and Blynk app.
Click Here for more such ESP32 projects.
Please do share your feedback on this IoT project. Thank you for your time.