In this article, the wizard will tell us how you can use your smartphone to control the block of sockets and switches. Of course, it is not necessary to use sockets or switches as a load, you can connect any other devices to a lamp, an electric kettle or even a pump, although to connect a large load it is better to add a powerful relay to the circuit, but that's another question.
Tools and materials: -Arduino Nano; -Bluetooth module (HC-05); – 8-channel relay module; -LM 2596 buck converter; -Red LED (5 mm); – 470 Ohm resistor; -Connectors; -2 -pin connector; -Connecting wires; -Single-layer printed circuit board with copper coating; -Power supply 12V 1A;
-Block of switches and sockets;
Step one: schematic
The master used Easy EDA software to manufacture the schematic and printed circuit board. Below you can download the file and then print it on glossy paper.
PCB Layout Home Automation.pdf
Step two: making the board – Next, you need to make a printed circuit board.
We print the previously given file. Cut off a part of the board to the size of the circuit. Carefully clean the top of the copper plating. Put the sketch on the board with the toner down. We heat the paper with an iron for 5-10 minutes. Then we place the board in a container with water for 10 minutes. Take out the board and carefully remove the layer of paper, the toner should remain on the copper coating. We place the board in a solution of ferric chloride. The solution will “eat” the copper in open areas. Then we rinse the board and remove the toner. We drill holes. We are assembling the board.
Step three: installing and configuring the BLYNK application
Install the Blynk application from the Google store Play on your smartphone. Create an account at Blynk. Create a new project. You will receive Tocken at email specified during registration.
Give a name to the project. Select your device and connection type and click the “New” button.
Select Bluetooth, then add 8 buttons. Give the buttons a name. Check the boxes.
Step Four: Programming Arduino
Add the Blynk library to the Arduino IDE
Go to Sketch-Include Library-Manage libraries-Type Blynk-
Copy the following code and upload it to Arduino Nano (disable bluetooth module before uploading)
/* * Hello Friends Welcome To Techno-E-Solution * Here is the Arduino Code for Home Automation by Techno-E-Solution */#define BLYNK_USE_DIRECT_CONNECT //You could use a spare Hardware Serial on boards that have it (like Mega) #include & lt; SoftwareSerial.h & gt; SoftwareSerial DebugSerial (0,1); //RX, TX #define BLYNK_PRINT DebugSerial #include & lt; BlynkSimpleSerialBLE.h & gt; //You should get Auth Token in the Blynk App. //Go to the Project Settings (nut icon). char auth & # 91; & # 93; = & # 34; AuthToken & # 34 ;; void setup () & # 123; //Debug console DebugSerial.begin (9600); pinMode (12, OUTPUT); pinMode (11, OUTPUT); pinMode (10, OUTPUT); pinMode (9, OUTPUT); pinMode (8, OUTPUT); pinMode (7, OUTPUT); pinMode (6, OUTPUT); pinMode (5, OUTPUT); pinMode (12, LOW); //Set All Pins Low Because At The Starting All Relays get ON, Results In All load pinMode (11, LOW); //Connected Across Relay Module Get Turn On pinMode (10, LOW); pinMode (9, LOW); pinMode (8, LOW); pinMode (7, LOW); pinMode (6, LOW); pinMode (5, LOW); DebugSerial.println (& # 34; Waiting for connections ... & # 34;); //Blynk will work through Serial //9600 is for HC-06. For HC-05 default speed is 38400 //Do not read or write this serial manually in your sketch Serial.begin (9600); Blynk.begin (Serial, auth); } void loop () & # 123; Blynk.run (); }
Step five: connection < br>The wizard installs the device into the box. Connects sockets and switches to the relay module. Connects the module to Arduino. Sets the buck module to 5V and connects it to the Arduino. A power supply is connected to the module.
To use the device, open the Blynk app. Turn on Bluetooth. Press the Bluetooth button and select hc-05.
Now you can control 8 previously connected sockets and switches via your smartphone. Of course, the point is not in managing sockets, you can connect lamps, some devices to them.