In this ESP32 project, I have explained how to make an ESP RainMaker home automation system with Google Assistant, Alexa, Bluetooth, IR remote, and manual switches. You can also control the relays and monitor sensor readings on Google Home and Amazon Alexa App from anywhere in the world.
You don’t need any Google Nest or Amazon Echo Dot devices for this voice control home automation project and I have used all the free tools to make this IoT Project.
Without WiFi, you can control the relays with Bluetooth, IR remote, and manual switches. The ESP32 will automatically connect with the Wi-Fi if the Wi-Fi is available.
Table of Contents
Required Components for the ESP32 Project
- ESP32 DevKIT V1 Amazon
- 4-channel or 8-channel 5V SPDT Relay Module Amazon
- TSOP1838 IR receiver (with metallic casing)
- Bluetooth or BLE module (ANY)
- Manual Switches or Pushbuttons Amazon
- Amazon Echo Dot (optional) Amazon
- Google Nest Mini (optional)
Circuits of the ESP32 IoT Project with Bluetooth
The circuit is very simple, I have used D23, D22, D21, D19, D18, D5, D25 & D26 GPIO to control the 8-channel relay module.
And the GPIO D13, D12, D14, D27, D33, D32, D15 & D4 are connected with switches to control the relay module manually.
The output pin of the IR receiver is connected with GPIO D35.
For Bluetooth control, you can connect any Bluetooth or BLE modules with ESP32. In the above circuit, I have connected the HC-05 Bluetooth module with ESP32.
If you want to use any 3.3V BLE module, then refer to the following circuit.
The TX pin of the Bluetooth or BLE module is connected with the RX2 (GPIO16) pin of ESP32 for serial communication.
**I have not used the inbuilt BLE of ESP32 as it is used to Reset WiFi details through OTA from the ESP RainMaker app.
I have used the INPUT_PULLUP function in Arduino IDE instead of using the pull-up resistors with each switch.
As per the source code, when the control pins of the relay module receive the LOW signal the relay will turn on and the relay will turn off for the HIGH signal in the control pin.
I have used a 5V 5Amp mobile charger to supply the circuit.
Tutorial video on ESP RainMaker Home Automation project
In the tutorial video, I have covered the following steps in detail.
- Control 8 relays with Google Assistant, Alexa, and switches.
- Control 8 relays with Bluetooth or BLE.
- Get the HEX codes of IR remote buttons.
- Programming the ESP32 for RainMaker with Arduino IDE
- Add devices in the ESP RainMaker app.
- Connect ESP RainMaker with Amazon Alexa App.
- Connect ESP RainMaker with Google Home App.
Bluetooth App for this ESP32 Project
You can use this app for any Bluetooth or BLE module. First pair the Bluetooth module with the mobile, then connect the module with the “Bluetooth Switch” app.
Program ESP32 with Arduino IDE
In the Tutorial video, I explained all the steps to program the ESP32 using Arduino IDE.
- Update the Preferences –> Additional boards Manager URLs: http://arduino.esp8266.com/stable/package_esp8266com_index.json,https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
- Then install the ESP32 board (Version: 2.0.3) from the Board manager or Click Here to download the ESP32 board.
- Download the required libraries from the following links:
- In Arduino IDE, select Board as ‘ESP32 DEV Module‘, and the Partition scheme as ‘RainMaker‘.
Source Codes for ESP RainMaker IoT Project
Click on the following buttons to download the source codes for this ESP32 project.
First, you have to upload the Code for Getting HEX codes to ESP32 and connect the IR receiver with GPIO D35.
After that, open the serial monitor, and select the Baud Rate at 115200.
Now, you have to press all the remote buttons (one by one) which you want to use to control the relays.
Now, save all the HEX codes. You have to update the main code with these HEX codes. You need 8 HEX codes to control 8 relays.
In the main sketch, update the HEX code of the IR Remote buttons (as shown in the tutorial video).
//Update the HEX code of IR Remote buttons 0x<HEX CODE>
#define IR_Button_1 0x80BF49B6
#define IR_Button_2 0x80BFC936
#define IR_Button_3 0x80BF33CC
#define IR_Button_4 0x80BF718E
#define IR_Button_5 0x80BFF10E
#define IR_Button_6 0x80BF13EC
#define IR_Button_7 0x80BF51AE
#define IR_Button_8 0x80BFD12E
#define IR_All_Off 0x80BF3BC4
And if you want you can also change the device names. Google and Alexa will identify the devices with these names.
// define the Device Names
char deviceName_1[] = "Switch1";
char deviceName_2[] = "Switch2";
char deviceName_3[] = "Switch3";
char deviceName_4[] = "Switch4";
char deviceName_5[] = "Switch5";
char deviceName_6[] = "Switch6";
char deviceName_7[] = "Switch7";
char deviceName_8[] = "Switch8";
After uploading the code to ESP32, please refer to the following article to add the devices with the ESP RainMaker app.
Now, please refer to the following articles to connect the ESP RainMaker with Amazon Alexa and Google Home App.
After doing all these steps, now you control the appliances with Google Assistant and Alexa.
PCB for this ESP32 Home Automation system
To make the circuit compact, I designed a PCB for this ESP32 IoT project.
If you want, you can also use this PCB to make the circuit compact and give the project a professional look. This PCB can be used for any ESP32 Home Automation project.
Control relays with the Google Assistant & Alexa
You can control appliances with Google Assistant from anywhere in the world through the internet.
If the ESP32 is connected with WiFi, then you can also control and monitor the real-time feedback in the Google Home app.
You can ask Alexa to control appliances from anywhere in the world through the internet.
And you can also control and monitor the real-time feedback and sensor readings on the Amazon Alexa app.
Control relays with Bluetooth, IR Remote & Switches
You can connect the mobile Bluetooth with the Bluetooth or BLE module.
Once it is connected, you can easily control relays from your smartphone without Wi-Fi.
You can use any IR remote to control the appliances.
If the Wi-Fi is not connected, still you can control relays with the IR remote.
You can also control the appliances from manual switches or push buttons.
If the ESP32 is connected to Wi-Fi then it will send real-time feedback to the IoT server (ESP RainMaker).
I hope you like this Smart house IoT project idea with the Espressif ESP32.
Click Here for more such ESP32 projects.
Please do share your feedback on this IoT project. Thank you for your time.