Arduino Smart Home With Alexa Google Assistant Usi
Arduino Smart Home With Alexa Google Assistant Usi
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT
Project 2022
by techstudycell
In this IoT project, I have shown how to make an IoT-based Arduino Smart Home with Google Assistant & Alexa using
ESP-01 to control 4 home appliances with voice commands, IR remote, and manual switches. If the internet is not
available, then you can control the home appliances from IR remote & manual switches. During the article, I have shown
all the steps to make this smart home system.
This Arduino Home Automation system has the following features:
1. Control appliances with Google Assistant.
2. Control appliances with Alexa.
3. Used Arduino EEPROM to remember previous states
4. Control appliances with IR remote.
5. Control appliances manually with switches or pushbuttons
6. Monitor real-time feedback in the Google Home and Amazon Alexa App.
7. Control home appliances manually without internet.
8. All resources used for this project are FREE.
So if you follow all the steps, you can easily make this IoT project just by using Arduino UNO, ESP01, and relay module.
Although the PCB is not mandatory, I have used PCB to make the circuit compact and give the project a professional
look.
Supplies:
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 1
ESP8266 ESP01
PC817 Optocuplors (4 no)
510-ohm 0.25-watt Resistor (4 no) (R1 -- R4)
1k 0.25-watt Resistors (6 no) (R5 -- R10)
2k 0.25-watt Resistor
4.7k 0.25-watt Resistor
10k 0.25-watt Resistors (2no)
22pF ceramic capacitor
104 ceramic capacitor
220uF 25V Capacitor (2no)
1uF Box capacitor (1no)
16MHz Crystal
LED 5-mm (6 no)
1N4007 Diodes (4 no) (D1 -- D4)
Push Buttons (8 no)
BC547 Transistors (4 no)
Relays 5v (SPDT) (4 no)
Terminal Connectors
Jumper (5no)
Switch (1no)
Hi-link ac-dc 220v-5v
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 2
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 3
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 4
https://youtu.be/YpddzFyWMHA
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 5
Step 2: Circuit Diagram of the ESP01 Arduino Control Relays
The circuit is very simple, I have used the digital pins D4, D5, D6 & D7 to control the 4 relays.
And the digital pins D10, D11, D12 & D13 are connected with switches to control the 4 relays manually.
The output pin of the IR receiver is connected with A0.
I have used the INPUT_PULLUP function in Arduino IDE instead of using the pull-up resistors.
I have used D7 as RX and D8 as TX for the serial communication with the ESP-01 module.
I have made a voltage divider using 2k and 4.7k resistors to drop down the 5volt logic level to 3.3volt logic level for the
serial communication with the ESP-01 module.
If you use the momentary pushbutton then just connect the pushbutton across the digital pins and GND instead of
switches.
If you use Arduino UNO then you can use the 3.3V pin instead of the 1117 3.3V regulator to supply the ESP01 but for
Arduino Nano, you have to use the 1117 3.3V voltage regulator.
I have used a 5V mobile charger to supply the smart relay module.
Please take proper safety precautions while working with high voltage.
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 6
Step 3: Create an Account in Sinric Pro
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 7
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 8
Step 4: Add Room and Devices in Sinric Pro
After that add a room and give a nickname to that room (Ex: Living Room)
Then Add devices one by one and give the nickname for each device. Sinric will assign a unique device ID for each device.
Here, I have used the free Sinric Pro account, so I can add a maximum of 3 devices for free.
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 9
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 10
Step 5: Testing the Circuit Before Designing the PCB
Before designing the PCB, I have made the circuit with Arduino UNO, ESP01, some resistors, and an IR receiver for testing
all the features.
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 11
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 12
Step 6: Design the PCB for This Smart Home System
To make the circuit compact and give a professional look, I have designed the PCB after testing all the features of the
smart relay module.
You can download the PCB Gerber le of this home automation project from the following link:
Download PCB Gerber from GitHub
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 13
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 14
Step 7: Order the PCB
After downloading the Garber le you can easily order the PCB from JLCPCB.
1. Visit https://jlcpcb.com and Sign in / Sign up.
2. Click on the QUOTE NOW button.
3. Click on the "Add Gerber le" button. Then browse and select the Gerber le you have downloaded.
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 15
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 16
Step 8: Uploading the Gerber File and Set the Parameters
4. Set the required parameter like Quantity, PCB masking color, etc
5. After selecting all the Parameters for PCB click on SAVE TO CART button.
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 17
Step 9: Select Shipping Address and Payment Mode
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 18
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 19
Step 10: Get the IR Codes (HEX Code) From Remote
Now, to get the HEX codes from the remote, rst, we have to connect the IR receiver output pin with the A0 pin of
Arduino UNO.
And give the 5V across the VCC and GND. The IR receiver must have a metallic casing, otherwise, you may face issues.
Then follow the following steps to get the HEX codes:
1. Install theIRremote library in Arduino IDE.
2. Download the attached code, and upload it to Arduino UNO.
3. Open Serial Monitor with Baud rate 9600.
4. Now, press the IR remote button.
5. The respective HEX code will populate in the serial monitor.
6. Save all the HEX codes in a text le. You have to update these HEX codes in the main sketch.
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 20
Download
https://www.instructables.com/ORIG/F2L/MM8X/KZJUOZCN/F2LMM8XKZJUOZCN.ino
If you use the PCB, then you can easily go to program mode with a switch (PMOD) and directly connect the FTDI232 USB
to the serial interface board with ESP-01.
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 21
Otherwise, you refer to this circuit to program the ESP-01. During programming, the GPIO-0 and GND should be
connected.
First, download the attached source code & install all the required libraries mentioned in the code.
Required Arduino Libraries:
1. Sinric Pro
2. ArduinoJson
3. WebSockets
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 22
Download
https://www.instructables.com/ORIG/FNQ/1DDP/KZJUOZCM/FNQ1DDPKZJUOZCM.ino
Step 12: Program the Arduino UNO or ATmega328P With Arduino IDE
In the PCB I have used an ATmega328P microcontroller, so I have used FTDI232 USB to TTL board to program the
microcontroller (Refer to tutorial video).
But if you don't use PCB then you can directly connect the Arduino UNO with the laptop.
For the main sketch, you need to install following libraries
IRremote 3.5.2 Library
AceButton 1.9.1 Library
Arduino-timer 2.3.1 Library
Then you have to update the HEX code in the sketch for IR remote control.
For momentary switch use the code: Code_ArduinoUNO_EEPROM_WiFi_IR_Button_4Relay.ino
and for latched switch use the code: Code_ArduinoUNO_EEPROM_WiFi_IR_Switch_4Relay.ino
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 23
Download
https://www.instructables.com/ORIG/FXD/7CQX/KZJUP16J/FXD7CQXKZJUP16J.ino
Download
https://www.instructables.com/ORIG/FLM/1UVU/KZJUP16K/FLM1UVUKZJUP16K.ino
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 24
Step 13: Setup the Google Home App
First, download and install the Google Home App. then follow the steps to create Home in Google Home app
1. Tap on the "+" icon (upper left corner).
2. Tap on Create new home.
3. Enter the Home nickname and address.
4. Then click on Continue.
The Home is created. Now again tap on the "+" icon to add devices.
Step 14: Connect Sinric Pro With Google Home App | Add Devices
After creating the Home in the Google Home app, you can connect the Sinric Pro with the Google Home app
1. Tap on the "+" icon, then select Set up device.
2. Tap on Works with Google.
3. Search for Sinric Pro, then select Sinric Pro.
4. Enter the email id and password used for the Sinric account,
5. Then tap on Sign in.
Thus, all the devices from Sinric Pro will be added to Google Home Account.
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 25
Step 15: Configure the Alexa App for This Smart Home System
Download and install the Amazon Alexa App from the Google play store or App Store.
1. Go to "More", then select "Skills & Games".
2. Search for Sinric Pro and tap on "Sinric Pro".
3. Tap on "ENABLE TO USE ".
4. Log in with the Sinric account credentials.
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 26
Step 16: Connecting Devices With Alexa
1. Tap on CLOSE.
2. Tap on "DISCOVER DEVICES".
3. It will take a minute to add devices. During this time the ESP-01 should be connected with the WiFi.
4. Tap on "Devices", and tap on "Plug" to see all the devices.
Thus, all the devices from Sinric Pro will be added to Amazon Alexa App.
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 27
Step 17: Controlling Relays With Google Assistant and Google Home
If the ESP01 is connected with the WiFi, then you can control the home appliances from Google Home App.
You can also ask Google Assistant to turn on and o the appliances.
You can control, monitor the real-time status of the relays in the Google Home App from anywhere in the world.
You don't need any Google Home Nest device for this home automation project.
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 28
Step 18: Controlling Relays With Alexa
You can also control the home appliances from Amazon Alexa App if the ESP01 is connected with the WiFi.
You can also ask Alexa to turn on and o the appliances.
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 29
You can also control the appliances from the manual switches or IR remote and monitor the real-time feedback of the
relays in the Amazon Alexa App from anywhere in the world.
You don't need any Echo DOT device for this home automation project.
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 31
Arduino Smart Home With Alexa & Google Assistant Using ESP-01 - IoT Project 2022: Page 32