.
Hello friends.
Today i am going to share with you a project that i did some times back. This little gadget will let you control the lights with your smart phone ,i have this thing installed in my room and it is working fantastic from a long time.During winters i am a bit reluctant to go and switch of my light when once i enter into my quilt. this thing has solved my problem now.You can find link to source code file my eagle PCB design file at the end of the article.
lets see at the system before i explain how to make it.
![Creative Commons Licence](https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png)
CONTROL THE LIGHTS OF YOUR ROOM BY AN ANDROID APP by Deepankar Maithani is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Hello friends.
Today i am going to share with you a project that i did some times back. This little gadget will let you control the lights with your smart phone ,i have this thing installed in my room and it is working fantastic from a long time.During winters i am a bit reluctant to go and switch of my light when once i enter into my quilt. this thing has solved my problem now.You can find link to source code file my eagle PCB design file at the end of the article.
lets see at the system before i explain how to make it.
Hope you enjoyed that demosntration. now let look at the block diagram of the system.
BLOCK DIAGRAM OF THE SYSTEM
.
As you can see there are 4 different blocks.When the user will press a button on the app,the smartphone will send data using the on board bluetooth ,this data will be received by HC05 a bluetooth module. This module is serially connected with the MCU . The MCU will analyse the received data and according to the value of data received it will send a signal to turn on or turn off the relay which is the actuator here.
One point to note here is that the operating voltage of MCU , HC05 and the relay is different o they have to be supplied with appropriate voltages, any voltage higher than the prescribed voltage will damage the component.
COMPONENTS REQUIRED
1. Atmega 328P
2. HC-05 bluetooth module.
3. SPDT relay(also commonly known as sugarcube relay )
4. MCT2E-optocoupler.
5.16Mhz crystal and 22pf paper capacitor.
6. regulator 7806
7 IN4733A zener(5.1 V zener)
8.LM317 adjustable regulator(for 3.3v)
9. IN4001 diode.
10. BC547
11.Male female connector.
If you remember from the block diagram three different voltages are required by the systems to get these voltages i have made a circuit which is as below
using this circuit a power supply can be made which can provide the three different voltages. Input DC voltage is to be provided at J2 connector. There are ground on 2, 4, 6 pin of output connector ,actually i made it so because i wanted to use it as general purpose board for any future needs you can give only one ground pin.
At this juncture i would like to introduce you to HC05.bluetooth module. figure below shows the module and connections with the arduino. Please note that the voltage on Tx of arduino is 5v but the voltage that the RXD on the HC05 can tolerate is 3.3v so use two resistors of suitable value to create a voltage divider.
so as you can see HC05 has 6 pins and we just need to connect 4 of them as shown in the figure. the RXD of HC05 is conneted to txd of microcontroller and TXD to the hc05 to the RXD of microcontroller so there is a cross connection as we commonly call it. the state pin tells if the bluetooth is paisrd or not and the key pin is used when one need to go into ATMODE and alter the password of the module or baud rate and so on. the default password is 1234 when you buy the module.
obviously you can go with the arduino and things will be pretty simple but here what i am trying to do is to implement the circuit on a PCB . It willl cut down the cost of project .
now lets look at the circuit.
optocoupler is used to isolate the MCU circuit from the spikes that may generate when the relay is switched. similarly the diode aroude the relay often called fly wheel diode and the electroytic capacitor is used for the same purpose. the AC load will be connected at the pin 3 and 4 of J5 connector and AC supply will be given on pin 1 and 2.
SOFTWARE HARDWARE INTERACTION
the app will send the data of pin no and and its state to the microcontroller the microcontroller will make the pin PB2 high ,this will lead to the turning on of the GaAr LED ,which is inside the optocoupler MCT2E when the light of led will fall on the photo transistor it will get turned on and hence the current will start to flow from collector to emitter of photo transistor which is again situated inside the packaging of MCT2E ,now as you see in the picture there is a 10k resistance through which the emitter of optocoupler is grounded whenever there will be adrop of .7v across this the transistor BC547 will get turned on and hence the coil of relay will get magnetised and NO contact will filp over to complete the circuit of load applied .hence the light would glow.
the software that is inside the microcontroller is a cutshot version of work of Mr Hazim biter since i only needed the digital pins.
his code can be seen here
http://www.techbitar.com/ardudroid-simple-bluetooth-control-for-arduino-and-android.html
the app i am using can be found here.
my eagle files can be downloaded here
Please feel free to edit reuse redistribute,i would love to hear from you about your experience.
In my next post i will share about the modifications i have made to the code,till then .happy inventing.
Also if you dont have access to a board house,you can make your PCB at your home ,I have a video of mine showing how to do it.you may go through it.
![Creative Commons Licence](https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png)
CONTROL THE LIGHTS OF YOUR ROOM BY AN ANDROID APP by Deepankar Maithani is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.