SMART POWER OUTLET
Hi, welcome to my new Instructable on Home Automation.
This project was started to solve some common problems faced by everyone. Imagine it is a cold winter night,you are reading a novel on your bed, before going to sleep. After reading few pages,you are feeling drowsy and your eye getting closed.Oops! your room light is still on,but you have no more interest to wake up and go near to the power outlet.Then obviously you will want to do it from your bed.But how can you do it ? Don't worry your Smartphone will do the job.
In this tutorial, I will show you how to make your smart power Outlet by using an android smartphone and Arduino. This requires you to have no experience of android programming at all, as a free third party application will do the job.Though this project was started to control my bedroom light,but later I added some more interesting features on it.
Features :
1. Turn on or off lights, fan,air conditioning and other appliances in your room
2. Control a RGB led strips
3. Gather sensor data ( and create thresholds or alarms that react to that data )
Thanks to techbitar and InfidelFish for the inspiration to remix their ideas.
You can find the original projects from the link given below.
1. ArduDroid: A Simple 2-Way Bluetooth-based Android Controller for Arduino
2. Arduino Home Automation (Bluetooth)
Disclaimer: This project works on AC 230V which is quite dangerous and anything wrong may kill you. I will not responsible for any damages to the equipments or loss of life. Make this at your own risk.
Parts and Tools Required :
Parts Required :
1. Arduino Nano ( eBay )
2. Bluetooth Module - HC 06 ( eBay )
3. Relay Module (eBay )
4. 12V /2A smps ( eBay )
5.Buck Converter ( eBay )
6.Transistor TIP31C (eBay )
7. LM35 temperature Sensor ( eBay )
8.Headers pin ( eBay )
9.AC Socket
10.AC Plug ( eBay )
11. 3 Core Wire
12.Fuse Holder and Fuse ( eBay )
13. Screw Terminal (eBay )
14. 1K resistor
15. Perforated Board ( eBay )
16. Plastic Enclosure
17. Duct Tape
Tools Required :
1. Dremel
2. Drill
3. Hot Glue Gund
3.Ruler
5.Vernier Caliper
6.Wire Stripper/Cutter
7.Soldering Iron
8.Screw Driver
How It Works ?
The Smart Power Outlet project is based on “ArdudDroid ” . This application controls the various appliances connected to your arduino and relays. When the buttons( digital pins) on the apps are pressed, corresponding Bluetooth signals are sent from your android phone to the Bluetooth module (HC06 ) you have hooked up to your arduino. The arduino finds out which signal was sent and compares it to the predefined signals assigned for each appliance. When it identifies that signal, then the arduino activates the relay hooked up to its digital pin by passing 5V through it. Thus the relay is switched ON and the corresponding appliance connected to the relay is turned ON as well.
The apps have slider for all the arduino pwm pins.We can send signal from the apps to change the duty cycle of arduino pwm pins.The RGB strips is controlled by giving 3 PWM signal from the arduino.To carry more current a transistor based driver is used.
The apps also have option to read the value from Arduino analog pins. To use this feature a LM35 temperature sensor is hook up to arduino pin A0.When user press the button,it will show the room temperature.
Preparing the 12V Supply
Our mains AC supply voltage is 230V. The arduino board,Bluetooth Module,Relay module and RGB strip need DC Voltage .The RGB driver needs 12V and all other board requires 5V.To do the job we have two options
1. Step Down transformer and bridge rectifier
2. SMPS
I choose the second option, because I had so many unused 12V adapter in my stock.I will suggest this because
it is efficient,lighter and cheaper.You can easily get a ready-made SMPS from the market.
First identify the weak spot somewhere along the seams, and pry until the pack pops open.I carefully insert a screwdriver blade and twist to separate.
Mark the input and output terminals by a marker. Do not for get mark the polarity at the output.
Then cut the wires connected to the terminals.
Main Board
The main board is consists of an Arduino Nano board,a dc-dc converter and header pins for different modules
( Relay,Bluetooth,sensor,RGB) connections.
We can feed 12V supply from smps directly to the Arduino. But all the other modules work on 5V DC.So a separate DC-DC buck converter is used .
First cut the headers for Arduino Nano,and other connections.Then solder it as shown in the pictures.You can use duct tape to hold the headers during soldering.It will save a lot of time.
Then make the connections as per schematic.
For 12V power input solder a 2pin screw terminal.
RGB Board
The current and voltage form the arduino pwm pin is not sufficient to drive the RGB strips.So a separate power source and driver is required for it.
The driver circuit is made by 3 TIP31C NPN transistors and 3 1K resistors.
First solder the 3 transistors and resistors
Then solder the screw terminal and input/output headers.
Make all the connections as per schematic.
The input headers is 4 pins ( GND,R_PWM, G_PWM, B_pwm ) from the arduino.
The output headers is 4 pins ( 12V,R_PWM, G_PWM, B_PWM) to the RGB strips.
The screw terminal is used for 12V power input.
Prepare the Enclosure
First measure the socket size by using a vernier calliper or by ruler.
Mark the outlines on the enclosure by using a pencil and ruler.
Cut out the marked portion by using a Dremel Rotary tool.
Finish the edges by a hobby knife.
Make holes for power cord , fuse and RGB strips connector.I used my cordless drill to do the job.
Fix the Sockets
Insert the Sockets in to the prepared slots. Keep the socket side by side and aligned them.
Drill holes for mounting.I used 3mm drill bit .
Then screw the bolts provided with the sockets.
Prepare the Power Cord
Use a 3 core insulated cable for making the power cord.The length of the cable is your choice.
Strips out the insulations at both the ends.I use my leatherman ( got it as prizes from Instructables) to do the job.
The 3 wires are colour coded.
Red -> Line
Black-> Neutral
Green -> Earth
Connect the 3 wires to the 3 pin power plug.( It will goes to your Mains Outlet)
Insert the other end in to the holes made earlier.
The 3 wires are connected to a 3 pin terminals ( it will provide connections for SMPS )
Electrical Wiring
Insert the fuse holder to its slot made earlier.Then tighten the nuts and washers.
Connect the neutral pins and earth pins of the two sockets by a black wire and and green wire.
Join two pieces of red and black wires.
Insert it to the corresponding pins of the screw terminal and screw them.
Connect a piece of green wire for earth connection.
Out of two red wire one goes to SMPS Input and other goes to one terminal of the fuse.
Out of two black wire one goes to the SMPS input and other goes to the socket neutral.
Make the other connection as per line diagram.
Alert : Be careful during the wiring.Anything wrong may damage your appliances.
Mount All the Boards
First arrange all the boards.
Apply hot glue at the back side of the boards and stick it on the enclosure.
Hold it for sometimes, until it will dry out.
Then use cable tie to bind wires bunch.
Connect All the Modules to the Main Board
First connect all the modules Vcc and Ground to the power rail.Use female-female jumper wires making the connection.
5V-----------> Vcc
GND--------->GND
1. Blue Tooth Connection :
Arduino --> HC06
Rx-------------> Tx
Tx--------------> Rx
2. Relay Connection :
Arduino ---->Relay Module
D2 ----------> IN1
D4----------->IN2
3. RGB Board :
GND- > GND
Arduino---> RGB Driver Board
D6-----> R
D9------>G
D11-----> B
4.LM 35 Connection :
Arduino ---> LM35
A0------> Out
Arrangement for Indication
You do not need any separate LEDs for indication as all the modules have inbuilt led.Apart from these we need only two important indication.One is power and other is Bluetooth connectivity.
Power Indication : We can use the SMPS led for power indication.Drill a small hole (just above the SMPS led ) on top cover of the enclosure.
Bluetooth Connectivity Status : Make small hole on the side wall of the enclosure.Mount the Bluetooth module in such a way that the on-board led will coincide with the hole.I used duct tape to mount it.
To make the light diffuse, I used wax tap in the back side of the holes.
Programming
Download the code attached below.
Connect the Arduino Nano to your PC/Laptop through the USB cable.
Open the Arduino IDE.
Select Board as " Arduino Nano" and port no " XX " ( XX : com port no to which the hardware is connected )
Upload the code.
Downloads
Close the Enclosure
Carefully arrange all the connections wires inside the enclosure then close the top cover.
Screw the all the screws.
Stick any attractive sticker on the top cover.I stick a Skull sticker, which I was got from Hacakaday.
Testing
Plug in the power cord to the mains outlet.
The power indication led on the top will confirm that power is coming to the smart power outlet.You can also notice blinking of led on the Bluetooth module (HC-06).
Download the app from Play store and then installed it.
Open the app and pair it with the HC-06.In the first pairing it will ask password.Use "1234" or "0000".
After successful connection ,the blinking led on HC-06 will glow constantly.
Now touch different buttons to operates your devices.
Have fun with this DIY hacking tutorial!
If you enjoyed this article, don’t forget to pass it along!
Follow me for more DIY projects and ideas. Thank you !!!