DIY

Smart home – remote control of electrical appliances

Smart home - remote control of electrical appliances  Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances From this IoT (Internet of Things) project, we will learn how to create home automation with Arduino IoT Cloud and Alexa, using ESP32 to control 4 household appliances with voice commands. If the internet is not available, you can control your home appliances manually using switches or IR remote control.
This IoT-based home automation system has the following features:
-Control devices using Alexa and Arduino IoT Cloud Dashboard.
-Control relays with IR remote control.
-Control appliances manually using switches.
-Control home appliances manually without internet.
-Real time feedback and room temperature in the Amazon app Alexa.
-All resources used for this project are free.
You can easily implement this home automation project just using ESP32 and some sensors. Or you can use a specially designed PCB for this project.
Tools and Materials:
Without PCB
-ESP32; -DHT11 sensor;
-IR receiver 1838;
-4-channel relay module;
With printed circuit board
-ESP32 DEVKIT V1; -DHT11 sensor; -1838 IR receiver (in a metal case); – 5V relay (SPDT) – 4 pcs; – BC547 transistors – 4 pcs; – PC817 optocoupler – 4 pcs; – 510 Ohm resistor 0, 25 W – 4 pcs (R1 – R4); – 1 kOhm resistor 0.25 W – 6 pcs (R5 – R10); – 10 kOhm resistor 0.25 W – 1 pc (R11); – 5-mm LED – 6 pcs; -Diode 1N4007 – 4 pcs (D1 – D4); – Buttons – 4 pcs; – Terminals; -Power supply 5 V DC;
Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances Step one: project diagram
The circuit is very simple, the master used GPIO pins D23, D22, D21 and D19 to control 4 relays. GPIO pins D13, D12, D14 and D27 are connected to switches to manually control 4 relays.
The master used the INPUT_PULLUP function in the Arduino IDE instead of pull-up resistors. IR remote control receiver (TSOP1838), connect to D35. DHT11 sensor, connected to RX2.
A 5V mobile charger is used to power the relay module.
Smart home - remote control of electrical appliances Step two : relay control
You can control your home appliances from the Amazon Alexa app, and also control the room temperature if the ESP32 is connected to Wi-Fi.
You can also ask Alexa to turn your home appliances on and off from anywhere in the world.
No Echo DOTs or other Alexa devices are needed for this home automation project.
Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances It is also possible to control the room temperature and control home appliances from the Arduino web control panel if the ESP32 is connected to Wi-Fi.
In this project, the master used the free Arduino IoT Cloud plan. With this plan, you can control a maximum of 5 relays or sensors for free.
When a relay is controlled from the Arduino IoT Cloud Remote mobile app, the current state of the relay is also updated in the Amazon Alexa app.
Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances The third way to control the relay is with a remote control. If the ESP32 is connected to Wi-Fi, it is also possible to monitor real-time feedback in the Amazon Alexa App and Arduino cloud dashboard.
 Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances If Wi -Fi is not available, the relay can be controlled by buttons. When Wi-Fi is available, ESP32 will automatically reconnect to Wi-Fi.
Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances Step three: printed circuit board
To make the circuit compact and give it a professional look, master designed the PCB after testing all the functions of the relay module.
You can download the PCB Gerber file of this home automation project from the following link:
https://drive.google.com/uc?export=download&id=1ul0vrxWT95tU8UadmhOsaCp6fVvo_xi7
Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances After manufacturing the printed circuit board, all components are mounted according to the schematic diagram. Then ESP32, DHT11 sensor and IR receiver are connected.
Smart home - remote control of electrical appliances  Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances Step Four: Free Arduino IoT Cloud Account
For this smart home project, the master used Arduino Cloud Free plan.
Click the link below to create an Arduino IoT Cloud account: https://store.arduino.cc/digital/create
Then click “GET STARTED FOR FREE”, then “create one”
Enter your birthday and click “Next”.
Enter your email address, username, set a password. Then click “Sign Up”.
Click “IoT Cloud”.
 Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances  Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances Step five: add an ESP32 device to the Arduino IoT cloud
Click on Select Device. < br> Select “Set up a third Party device”, then select the device type as ESP32 and the device model as DOIT ESP32 DEVKIT V1.
After these actions, the user will receive a device identifier and a secret key, which will be required in the code.
Press “Continue” and find the added device.
 Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances Step six : adding Varriable to Arduino IoT Cloud
Now, in order to control 4 relays and receive readings from the DHT11 sensor, you need to add 5 variables.
Click on the “ADD VARIABLE” button.
Enter a name, then select a compatible switch type with Alexa. The variable permission will be “Read & amp; Write” and the variable update policy will be “On Change”.
Similarly, add the following 3 variables.
To measure room temperature, select an Alexa-compatible temperature sensor. The variable update policy will be “Periodically” with a specified time interval.
Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances  Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances Step Seven: Configuring the Arduino IoT Cloud Dashboard
Next, click on the toolbar at the top, to set up the Arduino cloud control panel.
Then we click on Build Dashboard. After that, click on EDIT. Press ADD and select Switch.
Now we need to name this switch, and bind a variable to this switch widget.
Finally click Done.
Similarly, add all 4 Switch widgets to control four relays.
For the temperature, select the “Gauge” widget and bind it to the “Temperature” variable. You can also set minimum and maximum limits.
Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances Step eight: IR codes (hexadecimal code) from the remote control
To get codes from the remote, you first need to connect the output pin of the IR receiver to the GPIO D35 and apply 5V to VCC and GND. The IR receiver must have a metal case, otherwise problems may arise.
Then follow these steps to get the HEX codes:
Install the IRremote library in the Arduino IDE.
Download the attached code and load it into the ESP32. < br> Open the Serial Monitor with a baud rate of 9600.
Then press the button of the IR remote control.
The corresponding hexadecimal code will be displayed on the serial monitor.
Save the code in a text file.
Press the next button, save, etc.
Code_IR_Button_HEX_Code.ino
 Smart home - remote control of electrical appliances Step Nine: Programming ESP32 with Arduino IDE
The master used the Arduino IDE to program the ESP32.
Download the file with the code.
Code_ESP32_Alexa_ArduinoIotCloud_IR_4Relays.ino
Next, you need to install the ArduinoIoTCloud library.
Enter the following data in the code.

 const char THING_ID & # 91; & # 93; = & # 34; & # 34 ;; //Enter THING ID const char DEVICE_LOGIN_NAME & # 91; & # 93; = & # 34; & # 34 ;; //Enter DEVICE ID const char SSID & # 91; & # 93; = & # 34; & # 34 ;; //Enter WiFi SSID (name) const char PASS & # 91; & # 93; = & # 34; & # 34 ;; //Enter WiFi password const char DEVICE_KEY & # 91; & # 93; = & # 34; & # 34 ;; //Enter Secret device password (Secret Key)  

Next we get THING_ID [] from Arduino IoT. Copy and paste DEVICE_LOGIN_NAME [] and DEVICE_KEY [] from the PDF file previously uploaded when adding the device to the Arduino IoT cloud.
Updating the HEX codes for controlling the relay from the IR remote control.

 case 0x80BF49B6 & # 58; relayOnOff (1); switch1 = toggleState_1; break; //update the HEX-code case 0x80BFC936 & # 58; relayOnOff (2); switch2 = toggleState_2; break; //update the HEX-code case 0x80BF33CC & # 58; relayOnOff (3); switch3 = toggleState_3; break; //update the HEX-code case 0x80BF718E & # 58; relayOnOff (4); switch4 = toggleState_4; break; //update the HEX-code  

Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances  Smart home - remote control of electrical appliances Smart home - remote control of electrical appliances  Smart home - remote control of electrical appliances Step Ten: Configuring the Alexa App for Arduino IoT Cloud
Download and Install the Amazon Alexa App from Google Play or App Store.
Click More.
Then Select Skills & amp; Games.
Find Arduino and press “Arduino”.
Press “ENABLE TO USE”.
Smart home - remote control of electrical appliances Step eleven : connecting Arduino cloud devices to Alexa
Login with Arduino Cloud credentials.
Clicking CLOSE.
Clicking “DISCOVER DEVICES”. Adding devices will take a minute.
Click “Devices” and then “Switches” to see all devices.
This will add all devices from the Arduino IoT Cloud to the Amazon Alexa app.
Smart home - remote control of electrical appliances Step Twelve: Configuring a Remote Arduino IoT Cloud
You can also control devices from a remote application Arduino IoT Cloud.
Download and install the Arduino IoT Cloud Remote app from Google Play or App Store.
Press SIGN IN.
Then log into your Arduino IoT Cloud account.
Click on THING to open the control panel.
You can now control the relay from this remote Arduino IoT Cloud app.
 Smart home - remote control of electrical appliances Step thirteen: load connection
Everything is configured and now you need to connect the load. The master uses incandescent lamps as a load, but you can use any electrical appliances.
We connect a 5-volt power supply and a mains voltage of 220 V.
 Smart home - remote control of electrical appliances All is ready. Using this scheme, you can connect any household load and remotely control it.
< img class = "aligncenter" alt = "Smart home - remote control of electrical appliances" src = "https://usamodelkina.ru/uploads/posts/2021-08/1629127660_1-55.jpg"/> Smart home - remote control of electrical appliances  Smart home - remote control of electrical appliances On the video you can watch the entire process of assembling and setting up a” smart home “.

Source:

usamodelkina.ru

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button