Introduction: Home Automation Using Bluetooth
So happy that this project got completed finally. I had been working on this for a long time.
Think how cool it would be if you are able to control your AC appliances just with a touch of your Android smartphone. All you need to tap on your phone and you can easily switch ON/OFF your lights, fans and other home appliances. AVR micro-controllers provide a great platform to build such interesting projects and I have used ATMEGA8 micro-controller which is based on AVR.
Why prefer Bluetooth??
It is preferable to use bluetooth because nowadays people have their smartphones with them all the time, since the smartphones have bluetooth facility in them, thus it's better to use bluetooth rather than using RF remotes or IR remotes.Have you ever seen people carrying remotes???
Using bluetooth has many of its own advantages :
2.Easy to use.
3.It works in short distance range(i.e. upto 10mtrs.)
4.Anyone can find free bluetooth apps on android and many more.
If you ask me, why I made this project?? My answer would be simple because I am way too lazy and want to control things sitting at one place. Don't want always to get up to the switch boards just to switch things ON and OFF.
Step 1: Parts & Components Required
Parts and components required as per the schematic provided:
1. ATmega8 micro-controller 1nos.
2. ULN2803 1nos.
3. SPDT 5v Relay 3nos.
4. V-reg 7805 & LM317 1nos. each
5. Terminal blocks 6nos.
6. Breadboard 1nos.
7. 5v Regulated Power Supply 1nos.
8. HC-05 Bluetooth module 1nos.
9. Resistors, capacitors, diodes, etc.
10. 16MHz crystal oscillator 1nos.
11. Some wires and jumper wires
12. Most importantly an Android phone with BluControl v1.0 or above installed on it.
Step 2: Bluetooth Module
The Bluetooth module used in this project is HC-05 Linvor Bluetooth module. It is an easy- to-use Bluetooth serial port protocol (SPP) module, designed for a transparent wireless serial connection set-up. The module has 34 PINS for configuration/interfacing of Bluetooth module with microcontrollers.
For setting up a bluetooth module, an i'ble can be found here. For creating 3.3v output for the bluetooth module, I have used LM317 IC v-reg with a 10k potentiometer.
Step 3: ULN2803A : What N Why???
To drive a relay, we need the ULN2803A IC which is a high-voltage, high-current Darlington transistor array. The device consists of eight NPN-Darlington pairs that feature high-voltage outputs for switching inductive loads. The collector-current rating of each Darlington pair is 500 mA.
Applications of ULN2803a include relay drivers, lamp drivers, etc. And that's what we need, relay driver. The ULN2803A has a 2.7-kΩ series base resistor for each Darlington pair which makes it operable directly with TTL or 5-V CMOS devices.
Step 4: Building the Circuit
Construct your circuit as per the schematic provided. I have developed my own PCB at home, to make yours you can refer here.
Bluetooth module works on 3.3v only for which another power supply section has to be made. For this I have used LM317 voltage regulator which can provide output ranging from 1.2v to 36v. The potentiometer is used to vary the output voltage.
Remember to use a potential divider circuit which steps down the 5v serial output(Tx) from the micro-controller to 3.3v for the bluetooth module.
Always make sure to connect Rx of your bluetooth module to Tx of the micro-controller and vice-versa.
Step 5: ALGORITHM
I won't be sharing my code but would love to tell about the algorithm used.
What the system does is it simply receives the instructions in ASCII format from the bluetooth enabled Android smartphone using the bluetooth module and pass it on to the micro-controller. The micro-controller does the main processing part and for that purpose we need the code, please make your own.
What happens when the controller receives a particular ASCII value it switches ON or OFF a relay. And the relay acts as a switch for AC appliances. I have used some flag variables which check whether a particular relay is ON or OFF. A particular ASCII value is assigned for one and only one relay.
When an ASCII value is passed for the first time, it switches ON the relay and if the same value is passed again, the relay gets switched OFF.
Step 6: Android Cellphone
Any smartphone with any version of Android installed on it will do the task.
We are using an Android application named “Bluetooth Terminal” which can be easily found on Google Play Store and installed on the phone.
Bluetooth Terminal is an Android application that is a VT-100 terminal emulator for communicating with serial devices using a Bluetooth module.
One can download this application from here https://play.google.com/store/apps/details?id=es.pymasde.blueterm&hl=en
All you need to do is just open up the bluetooth manager in your Android smartphone and connect to the Linvor bluetooth module. You may require a password to connect to the module, the default password is 1234.
When the pairing is done and the module gets connected, press the any key that you have set for switching the relays.
Step 7: Thanks
Thanks and hope you like it.