Home automation using bluetooth and Arduino
In this article, I am going to tell you how to make the Home automation using bluetooth and Arduino. You can control your home appliances using your smartphone easily. These can be used in houses, apartments, hotels, etc.
I want to know how to make this project and make your home automated.
Step 1: Components Required
Hardware :
- Arduino UNO
- 2 channel Relay
- 230V AC supply
- Jumper Wires
- HC05 Bluetooth Module
Arduino UNO
Relay
bluetooth module
Software :
- Arduino IDE
- Blynk App
Step 2: Blynk Setup
- First of all, download the Blynk app on an Android device.
- Register with your device.
- Click on ‘create a new project
- Select your project name (eg: Home automation)
- Choose your board: Arduino UNO
- Choose connection type: Bluetooth
- And click on the create button. Hence, your project is ready to edit.
- An email will be sent to your mail-id. Copy the authentication code from your mail.
- Now, install the blynk libraries to your Arduino IDE.
- You have to paste the Auth token in the Arduino code.
- Now, your Arduino is ready to take instructions from the app.
- Let’s create the functions to be performed in the Blynk app.
Step 3: Blynk Interface
- Click on add widget button to create your operations.
- Select the ‘Bluetooth’ widget and the 2 buttons to control 2 devices in your home.
- If you want to control more number of devices you can add buttons to your requirement.
- Now, customize the button settings to acts as a switch. Select the digital pin in the Arduino that you are using to control specific appliances.
- After making the necessary connections, customize Bluetooth settings to connect to your HCO5 device.
Step 4: Connections - The connections are very simple. There are 6 pins for HCO5 from which we use only 4 pins (TX, RX, VCC, GND). The TX and RX pins are connected to 10,11 pins respectively. VCC is connected to 3.3v pin on Arduino. GND pin is connected to the GND pin of Arduino.
- Note1: Take care that the pins TX and RX of the Bluetooth are not connected to Arduino during the uploading of the code. After the code is uploaded, we can connect them to their respective pins.
- Relay is simply an Electronic switch used to control electrical appliances. A 2- channel relay has 4 pins to be connected to Arduino (VCC, GND, D0, D1). The VCC and GND are connected to the respective pins of Arduino. With the pins D0, D1 we can control 2 appliances of our home. Let these pins to be connected to D2, D3 pins of Arduino since we used the same pins for buttons in BLYNK app.
- The other side of the relay has 3 connections namely NC (Normally Connected), COM ( common), and NO (Normally Open). Connect the positive terminal of the lamp to the positive terminal of the AC supply. Now break the negative terminal of the lamp and connect one end to COM pin and another end to NO pin of the relay.
- Now, The circuit is ready to be executed.
- Step 5: Code
- The Arduino code requires some standard libraries to perform this project namely “blynk” And “SoftwareSerial.h”
- The Arduino code is as follows :
#define BLYNK_USE_DIRECT_CONNECT
// You could use a spare Hardware Serial on boards that have it (like Mega)
#include
SoftwareSerial DebugSerial(10, 11); // RX, TX
#define BLYNK_PRINT DebugSerial
#include
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
void setup()
{
// Debug console
DebugSerial.begin(9600);
DebugSerial.println("Waiting for connections...");
// 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()
{
Blynk.run();
}