Updated: Jul 23
Interfacing Electronic components and building small devices is the way to explore our technical knowledge as well as our creativity. These devices can be built on a small scale as projects and also on a large and more practical level as a #Home Automation system.
In this article, we are going to learn how to control Home #Appliances using the Arduino board and HC-05 Bluetooth module. Let us start with the Hardware requirements for the circuit.
#Arduino board is a microcontroller that is used to accept inputs from sensors connected and provide an output action on the desired device connected to it. The sensor inputs can be from light-detecting sensors, motion sensors (Ultrasonic or IR), temperature sensors, etc. The output function done on the devices can be turning on an LED, the sound of a buzzer, or a Serial monitor display.
Buy Arduino UNO from here.
2. HC-05 Bluetooth Module
It is a Serial #Bluetooth module for Arduino and other microcontrollers. The range of Operating Voltage is 4V to 6V. It operates with a current of 30mA. The Bluetooth devices have a certain radius of distance inside which it can communicate to the device connected. This device has a range of around 100m. The Bluetooth module uses serial communication to control other devices connected. It can operate in Master, Slave, or Master/Slave mode though the default mode is Slave mode.
Buy the HC-05 Bluetooth Module from here.
3. 2-Channel Relay
A relay is basically a switch that works on the principle of #Electromagnetism. It operates on a small amount of current to control a large amount of current flow. When current flows through the circuit, it activates the electromagnet. This in turn generates a magnetic field. One of the two magnets of the switch attracts the component of the other magnet which causes the switch to open and close every time a current passes through it.
Buy 2-Channel Relay from here.
4. AC Bulbs (with Bulb holder)
These are light-emitting devices. In this project, AC Bulbs are used instead of #LEDs. Also, LEDs can be used to Automate and control.
NOTE: In this project demonstration, we have used a Mosquito repellent machine which is controlled and is a part of the Automation #system. You can use another Bulb, LED, DC Motor, etc.
5. Jumper Wires
These are the main components that are used to establish the connections between different devices of the circuit.
Buy Jumper Wires from here.
#Arduino IDE (Integrated Development Platform) which is used to interface the boards like NodeMCU to run the desired code designed to interface hardware devices.
2. Arduino Bluetooth Controller App for Android
This is an #App for Android devices that is used to interface the device or circuit built. It allows controlling operations using Buttons, Timers, Dimmers, and Controllers, etc.
Circuit connections for this device can be understood by dividing them into different parts.
Part 1: Connections between the Bluetooth Module and Arduino.
We will be using four out of six pins of the Bluetooth module to connect it to the Arduino board. The VCC pin of the Bluetooth Module is connected to the VIN terminal of Arduino. The Ground pin of #HC-05 is connected to the GND terminal of Arduino. The TXD( Transmission Data) pin of HC-05 is connected to the RX (Receiving) terminal of Arduino. The RXD (Receiving Data) pin HC-05 is connected to the TX (Transmitting) terminal of Arduino.
These connections between RX, TX, and TXD, RXD pins of Arduino and Bluetooth module respectively show that both Arduino and the Bluetooth module are capable of receiving and transmitting data. So the data/inputs transmitted by one of the two Boards are going to be received by one of them on the other end.
Part 2: Connections between the Arduino UNO board and the Relay Module
Next, let us see how the relay module is connected to Arduino. As usual, the power supply terminal, 5V of the Arduino is connected to the VCC terminal of the Relay module and the same with the Ground terminals of both the components (GND -> GND).
The Digital pin 9 of Arduino is connected to the IN1 (Input pin 1) of the #Relay Module. Remember that PIN 9 of Arduino can also give PWM (Pulse Width Modulated) output. Next, PIN 8 (digital pin) is connected to IN2 (Input pin 2) of the Relay module. The connections between these two components end here.
Part 3: Connections between the Relay Module and the other Components (Which we will be controlling).
So, it is to be noted that, the article and the video give an explanation where an AC bulb and another Electronic component ( Mosquito Repellent Device) are the components used that are going to be Automated. But, we can also use two LEDs to build the same circuit and work with them.
Case 1: When two LEDs are used as the components to be Automated.
When two LEDs are used, the connection is as follows. The COM (common) pin of the Relay module is connected to the Negative terminal of the LED and the Positive terminal of the LED is connected to the power supply. The negative terminal of the power supply must be connected to the NO (Normally Open) pin of the relay module.
NOTE: The power supply module can be used as the main power supply to the LEDs.
Case 2: When other components are used as output.
We can use AC Bulbs and other small electronic components as output devices. The circuit shown in the video has an AC bulb and a Mosquito Repellent Machine as output and is Automated. The positive terminal of the bulb is connected to the power supply and the negative terminal of the bulb is connected to the COMM (Common) pin of the relay. The Negative terminal of the power supply is connected to the NO (Normally Open) pin of the relay.
Configuring the Arduino Bluetooth Controller App.
First, we have to switch on Bluetooth in our #smartphone and search for the HC-05 #Module, whose name will be displayed in terms of a few digits like an IP Address. (refer to video). Once the device is connected and paired to the phone, open the App downloaded, search for the devices using the search icon. Select the HC-05 module to configure buttons, dimmers, etc according to how we want to control the device.
In this project, we will configure a button to control the LED and another button to control the Mosquito Repellent #Machine. The button icon is selected after the HC-05 module is paired and connected. A name should be given to the buttons and particular numerical values need to be given to the input control and output control (Refer to video). Then using the button, we can control the LED and the Good Knight machine by turning it ON or OFF from our smartphone.
Let us analyze how the #relay works as a switch. Once the command from the smartphone is given through a button, the current is passed through the coil inside one channel of the relay, a magnetic field is generated and the contact of the switch is changed. The bulb is turned #ON and OFF in this manner.
The same happens when the command is given from the mobile phone for the next button, the second coil of the relay receives current, magnetic fields are generated and the contact of the switch is changed. With this the second component, the Mosquito repellent machine is switched ON and #OFF.
An 8-channel relay can be used for implementing the complete code given above. For just two components, a set of two "if" conditions can be used, and working for the same is given.
Watch the video given below for the practical demonstration of the Project.
Project video By - Farhan Ahamed
Building an Automation system is as easy as it seems and gets complex when taking it to the next level. It is not difficult if the design of the device is built systematically, specific buttons are used to control specific components and noted in real-time about which components are active, etc. So, let's get on with it and design our own mini Home Automation system now.