How To Automate Home Appliances Using Arduino?
As we have the basic idea, now let’s move towards gathering the components, assembling them to make a circuit and writing the code to automate your home appliances.
Step 1: Components Used (Hardware)
Step 2: Components Used (Software)
After downloading the Proteus 8 Professional, design the circuit on it. We have included software simulations here so that it may be convenient for beginners to design the circuit and make appropriate connections on the hardware.
Step 3: Studying The Components
As we have made a list of components that we are going to use in our project. Let us move a step ahead and go through a brief study of how these components work.
Step 4: Understanding Circuit Design With Circuit Diagram
Firstly, we need to connect HC-05 with Arduino UNO. Since Bluetooth uses the UART protocol, we need to use the RX and TX pins of the Arduino. We will be using the “SoftwareSerial” library to define our own RX and TX pins (Pin 2 is RX and Pin 3 is TX). The RX pin of the Bluetooth module and the TX pin of the Arduino will be disconnected. Secondly, we will connect the relays to the Arduino. We have used a readymade relay board with 4 – channels, so we need to connect the inputs of the individual relays to the Arduino. For connecting load to the relay module refer to the diagram below: Four loads are connected to the relay module for demonstration and be extra careful while using AC Mains with a relay board. Just for demonstration, we have switched ON the alternate loads:
Step 5: Working Principle Of The Project
In this project, voice commands are used to control different appliances. Assemble the hardware according to the circuit diagram given above. Assemble all of the components on the breadboard. After making the necessary connections, switch on the power supply to the circuit and pair the phone’s Bluetooth to the HC-05 Bluetooth module. Before pairing install the application mentioned above in your smartphone. Now, connect the phone with the Bluetooth module. Click on the option “Connect Robot” and select the appropriate Bluetooth device. If the devices aren’t paired earlier, pair them now by entering the pin 0000 or 1234. After a successful connection, devices are ready to transmit data. For transmitting data, press the microphone icon on the app and start giving voice commands. Ensure that the voice recognition feature is enabled on your smartphone (this is usually associated with Google app). For example, when we press the microphone icon and say “Turn on the light”, the application will recognize the command and transfer it to the Bluetooth module. When the string is recognized by the application it will send the string as “turn on light#’ and the actual message received by the Bluetooth Module has this type of format (“Message#”). The reason for padding the ‘’ and ‘#’ at the begging and end of the string is to identify the starting and end of the message. The received message is compared with some predefined strings and if the message matches with them the corresponding action like “turning on” and turning off happens. In this project we have used the following commands: “turn on AC”, “turn off AC”, “turn on light”, “turn off light”, “turn on TV”, “turn off TV”, “turn on fan”, “turn on all” and “turn off all”.
Step 6: Getting Started With Arduino
If you are not familiar with Arduino IDE before, don’t worry because below, you can see clear steps of burning code on the microcontroller board using Arduino IDE. You can download the latest version of Arduino IDE from here and follow the steps mentioned below: 1). When the Arduino board is connected to your PC, open “Control panel” and click on “Hardware and Sound”. Then click on “Devices and Printers”. Find the name of the port to which your Arduino board is connected. In my case it is “COM14” but it may be different on your PC. 2). Now open the Arduino IDE. From Tools, set the Arduino board to Arduino / Genuino UNO. 3). From the same Tool menu, set the port number that you saw in the control panel. 4). To use this voice-controlled app, we need a special library to be included in Arduino IDE. This Library is attached in the link below, along with the code. To include the library go to Sketch > Include Library > Add ZIP. Library. 5). Download the code attached below and copy it to your IDE. To upload the code, click on the upload button. You can download the code by clicking here.
Step 7: Understanding the code
The Code is not so complex but still, some of its parts are briefly described below.
- In the start, a library is included to allow serial communication on other digital pins of the Arduino, using software to replicate the functionality. Two Pins are initialized to be used with the Bluetooth module. Four Pins are initialized to be used for the home appliances connected to the system and a string variable is initialized to store the data coming through Bluetooth serially.
- void setup() is a function in which we set the initialized pins to be used as INPUT and OUTPUT. Baud Rate is also initialized here. Baud Rate is the speed by which the Arduino board communicates with the components attached. In our function, we have set all the pins connected to the appliances to LOW.
- void loop() is a function that runs repeatedly in a loop. Here all the conditions are set to make the system work properly. The following While() loop is used to take data that is coming serially to the microcontroller. Below all the conditions are set to switch on all the electrical appliances attached, as the user commands. These conditions are pretty simple and self-explanatory.
Applications
How to Design Arduino Based Home Automation System Using TV Remote?[FIX] Home Sharing Could Not Be Activated (Error 5507)How To Make Smart Home Automation System Using ESP32 Module?Using Hogar Controls: For Smart Home Automation