Arduino Room Automation! [BLUETOOTH/SOUND/REMOTE CONTROLLED]
by treyes4 in Circuits > Arduino
14700 Views, 113 Favorites, 0 Comments
Arduino Room Automation! [BLUETOOTH/SOUND/REMOTE CONTROLLED]
Turn any room digital! with the help of the "BlackBox" control your electronic devices from a far with a remote,a phone or even a clap. There are thousands of possibilities to make this thing function at your own will. With the help of some sensors and programming skills but for today we will just be sticking something simple. Something that will be fitting my Lab which can switch quite a lot of device including my computer and guitar amplifier more on those high power devices you know. So lets get back to it
WATCH THE SAMPLE VIDEO!
FEATURES
1. [Bluetooth] Can be controlled with android devices using the app my brother made just for this
2. [IR CONTROLLED] Can be controlled by any old IR remotes
3. [CLAP ACTIVATED] Now this is one of my favorite just clap 2 times and something will switch!
4. [5 Relay switches = 5 AC Terminals + 1 terminal for raw AC supply no switching] The Relay's I used can handle 1000W at 250V
5. [Auto Connect] This enables the android device to connect with the Black box with out scrolling down and looking for the specific Bluetooth device module. As you know most bluetooth apps require you to scroll down a menu and look for the device you want to control. In this guide I will show you how to solve that problem.
Plans and Ideas for my Lab automation
With the Use of different sensors I will try to make everything in room automated from windows closing or opening using distance sensor. Curtains sliding automatically according to the sunlight with the use of photo diode or LDR sensors.For this project I plan on making it simple then slowly upgrade its features in the near future.
Home automation vs Room automation
Home automation means the whole house wherein room only means room right but its technically almost the same right. So basically home automation is harder to DIY since wiring or rewiring the whole house is extremely hard. Compared to a small box that can turn any room automated this thing can be made by any person at a very affordable price.
Future plans and upgrades
For real efficiency
I plan on combining a high current power bank and a solar panel. This will really save a lot of energy. instead of using a transformer or a switch power supply.
Wireless communication
WiFi! bluetooth has some delay and some bugs we feel more comfortable dealing with WiFi since for my brother programming it is easier.
Voice recognition improvement
Hmm I would add a real voice recognition module wherein it has nice mic built in and recognize voices or words correctly.
Sensors!
there are many possibilities here as in thousands! If you notice one of the picture I uploaded in the steps you will notice a SHARP IR SENSOR 20-180cm this is for something im planning for my room wherein i will wave my hand somewhere in the room and all of the windows will open or close this will take time to build but its worth sharing and it proves the combination of sensors you can add 3D printed CASING SMALLER AND PORTABLE!
3D printed Casing for a better and smaller size.
This project can be made smaller its just there is no recyclable casing around me that will be perfect for this project
OK If you are ready lets get started!
Downloads
Step 1: Tools and Materials
Parts FOR the project
5x 5V RELAY SWITCH at least something that can handle 1000W mine cost 5$ total
5x 2n222 transistors 0.72$
5x 1N4004 Diode 0.54$
1x TSOP38238 IR RX or anything similar 1.3$ "Recycled"
1x 4"x 3" Presynthesized PCB 1.5$
2x 40mm standoff .68$
Arduino Uno
Bluetooth Module (recycled from cheap local headphones)
Clap sensor module 2$
2A Cellphone charger......I have dozens of them here "recycled"
Toggle switch or anything that can handle 240V up to 5A........ 1$
AC plug w/wire "Recycled"
6x AC SOCKET (RECYCLED)
1x Enclosure big enough for the project
1X40 male pin header 1$
M3 screws (Recycled)
A spool of wire 16awg
IR REMOTE (RECYCLED)
TOTAL COST FOR ME ABOUT 15$-
TOOLS
Dremel
3.2mm drill bit
Soldering Iron
Lead
Tweezers
Helping hands
Wire stripper
Philipps screw driver
nut driver
mini drill
1mm drill bit
Where to Start?
OK the first thing we need here is the PCB for the relays. I made mine with the use of eagleCAD so I hope you can follow me. So first things first is to download the PDF file I uploaded and then print it on an acetate make sure the print is solid black that no light will pass through.
IF the layout does not fit your relay switches message me and let me help you out!
|Steps in making your PCB|
1. Print on acetate [SOLID BLACK PRINT]
2. Prepare your exposure box or florescent lamp rated at least 10W and some elevation/support
3. Prepare the developer solution in a container with the mixture of 3 tsp developer to 1 cup of tap water. mix it in hot water
4. Get your 4"x 3" Presynthesized PCB and remove the film.
5. Lay the print out the ink side facing the copper side.
6. Get your phone or timer and set it to 6 min
7. Now make sure the print out is positioned correctly on the pcb get the florescent lamp and turn it on as well as the timer.
8.When its time immediately turn off the lights and remove the printout
9. Place the exposed PCB into the container that has the developer solution.
10. agitate well untill you see the circuit.
11. Wash it gently [do not wipe with any cloth or tissue]
12. Dip it in ferric chloride and again agitate it until the unnecessary copper is etched.
13. Check for broken lines and fix it later.
14 drill all the holes
PROCEED TO NEXT STEP -->
Assembling the Relay Board
ok now get your soldering iron and components and lets get started.
1. After drilling all the holes lets start with the small components.
2. Start with the diodes. bend it in the way its presented in the pictures and place them in the proper holes
3. Solder them onto the board and cut the excess pins.
4. Using the Excess pins of the diode recycle it and serve it a jumping pin
5. Jump the top side of the diode just like in the photo. also jump another one on the left the two remaining holes
6. Get your 5x 2n222 and solder them facing the diodes look at image for reference
7. break a 1 x 8 pin header from your 1 x 40 and solder them onto the proper position
8. Get your IR RX and solder them properly.
9. Get your standoffs and attach it at the end part of the arduino once done lay it on the side of the PCB and using a marker mark the holes on the relay pcb.
10. Drill the marked holes on the pcb using a 3.2mm drill bit.
11. Get your relay switches and solder them accordingly.
12. screw the standoffs including the arduino onto the PCB
DIY SCREW TERMINALS
IF you look at the circuit you will realize there are 6 holes 5 for the relay and 1 near the pin headers.
The one near the pin header is the main line which will flow on when the relay switches are turned on.
ok going back DIY SCREW TERMINALS. the idea of this is to make wiring solderless as possible.
1. So we get our M3 nut and align it with the hole.
2. Solder the nut onto the copper "make sure your soldering iron is hot enough" or else the lead wont stick on the nut therefore making it impossible to solder the screw onto the pcb.
3. Get your M3 screw and screw it in! and there you have your own DIY screw terminals on the pcb.
WIRING & Troubleshooting
So yeah now you have the PCB but wait is it working? Well lets find out
facing the relay board the pinheaders arranged in this way 1 2 3 4 5 [5V] 6/IO [GND]
1. OK more jumping guys dont give up jump the 5V pin facing the copper side to the arduino 5V and do the same for the GND.
2. connect 5 from the relay pcb to arduino digital 10.....6to11...... 4to9........ 3to8..... 2to7.......1to6 VIA Female crimp to male crimp or using some extra pin headers female crimps to pin headers.
3. First we are going to test the relays connect your arduino to the computer and temporarily jump 5v to 1 or 2 or 3 or 4 or 5 on the relay board while doing so you should hear a switching sound. If you hear that then your circuit should be working.
The IR testing should work with out a doubt unless the pin arrangement of your IR RX is different just remember the arrangement of the IR rx i am using is [1~2 - 3+]
Connecting Clap Sensor and BT Module
KNow your modules this is a must in this step
Supply the clap sensor with the following
5V to 5v
GND to GND
and then Signal to Digital 5
-------------------------------------------------
Bluetooth module
Supply with 3.3V
GND
TX to RX
RX to TX
DONE easy right
!!!! Keep your wiring clean and short as much as possible things can get confusing.
Recycle That Cellphone Charger
Since I am going to use the blackbox always I decided to recycle a samsung charger I got from a note 2. Knowing its from samsung I believe it has that quality touch in it making this project of mine efficient and reliable.
It was hard opening this charger so i manually milled the top side with a dremel tool and forcefully open the top
the pins were properly labeled including the the USB terminal pins so right I away I knew which will go to the arduino and which one will go to the AC line.
ENCLOSURE TIME!
Now its time to get our enclosure, Toggle switch and AC socket
1. Lay out where you want the AC sockets to be and then mark them... later we will mill them manually using a dremel tool
2. Drill a hole for your toggle switch an another hole for your AC wire plug
3. Ok now using a drill bit I milled the outline I made on the enclosure and did the same thing for each socket .
4. Supper glue the socket onto the plastic enclosures are thick that the AC socket wont really lock itself in the hole unless you are using a metal enclosure.
5. Attach the toggle switch
6. Drill a big hole wherein the IR RX will be facing
Wiring
Ok almost done I skipped a few steps but I will still explain
1st I replaced my old setup with a cellphone charger as a power supply.
Before I used a transformer but my dad was against it. Him knowing cellphone chargers are like switch power supply I decided to use the charger instead .
Transformers are not the best power supplies out there but they are the cheapest all you really need is a rectifier to convert the AC supply to DC.and then a ubec to regulate voltage at a constant current.
.............WATCH THE VIDEO IN HD............
==I Replaced the OLD transformer with a Cellphone charger==== smaller and lighter
Relay Output to AC SOCKETS
ok so now the last step for the wiring
1.From the ground line or 0 from the transformer I connected it on one side of the ac sockets
2.then from the switch 220V line I connected it near the Screw terminal near the pin headers.
3. from the screw terminals near the relay switches I Connected one wire to one AC socket to the same for all the sockets and relays.
4. Now that we have 5 AC sockets connected we give the last remaining socket a non switching feature only a RAW 220V supply.
Clean/ Organize the Wiring Again.
Make sure everything is fine and safe by any means insulating the live wires if possible.
Programming Part 1 IR SIGNALS
First Download the file uploaded and extract it. and go back here and read the following steps.
you will need an open source library by 2009-2012 Ken Shirriff~IRremote and Decoder_IR And An OLD REMOTE CONTROL and IR rx
Using the old arduino 1.0 open file location -> libraries -> and Paste the IRremote folder in it do not include the Decoder~ Why arduino 1.0 well there are some issues with the latest versions and you might see this type of error C:\Users\Timmy\Documents\arduino-1.5.4\libraries\RobotIRremote\IRremoteTools.cpp:5: error: 'TKD2' was not declared in this scope anyways going on once the library has been updated open up the arduino program again and open Decoder_IR once again if you are using arduino 1.0 you will not see any problems uploading or compiling and if 1.5.4 you may see one
UPLOAD THE DECODE_IR
Downloads
Get Your IR REMOTE!
So now everything is connected supply your project with some more power since voltage drop will surely happen here and your computer wont be able to see the arduino so to avoid that give some juice by plugging it and then turning it on after that temporarily remove the BT TX and RX because this will interfere with the uploading procedure.Ok going back and then click on upload After that open up your serial monitor on your arduino program
and start pressing some buttons on your remote and if you observe you will be able to see numbers similar to this 12533951, 12558431, 12538031 these are the signals the remote is giving.
on your remote decide which buttons will turn a device on and of 1 button for on and another for off
write that down on a piece of paper then start pressing the buttons and write down its signal this will be very important for the next step.
Downloads
Main Program
As you open the program you will notice the code is quite long you dont have to understand but make sure you know the things you need to change like the thing we have been doing the IR signals. Everything is commented on the program so you should be able to follow it. And if you dont get it feel free to message me VIA instructables or Facebook..
Downloads
Android APP
This app is created by my Brother with out him this project wont be possible always check this step for we have more updates for this for more interesting features.. imagine what you can do with bluetooth and WIFI in the future but since this is his first android app we expect to achieve the WIFI compatible app about a few months later.
There are 8 buttons first is the direct connect button wherein you dont have to scroll down and look for your bluetooth device. and then the 2nd to the 6th is for the 5 relay switches for the last 2 there is the all on and all off button. No i prefer this compared to the voice activation since its kinda weird talking inside your room just to turn something on.
1. Make sure you have downloaded the android SDK install all plugins for android firmware compatibility.
2.Download our program
3. Open eclipse
4. FILE->IMPORT->Existing Projects into Workspace then look for the the folder you downloaded ENTER!
4.1. Go to black box -> com.example.blackbox-> src -> MainActivity.java
4.2. Look at the pictures or download tha .rar file and observe the comment on RED saying Replace the mac address.
5.After that connect your android phone enable debugging mode and click the play or run button on the ECLIPSE PROGRAM.
6. YOU should now see the app running on your phone
7. If you do not know the mac address of the bluetooth go to your Bluetooth setting and press the device it should have its address.
REALLY CANT DO IT?
WELL ITS OK BUT YOU DO LOSE THE FEATURE BLUETOOTH control
But there is another option using an app on the android appstore Android Meets Robots : Voice. Just open connect and touch then talk its that simple. Its Something similar to another project I made [3D Printed Sumobot [Autonomous bot with voice activated attack functions]
Using this you are able to voice control your LAB automation BOX. all you have to do is to change the STRINGS in the code like TV on, COMPUTER on ,ALL off, ALL on
Also you can still use the CLAP and IR REMOTE so its ok to skip that tricky part.
But if you really want it you can again PM me and maybe I could do a live skype :D
Real TESTING
AHHHHHH Finally done. All we have to do is test it with some REAL AC connection.
Get a lamp
A speaker/ amplifier
Fan or what ever you have there .
Plug it at the back of your box and turn it on
1. Start with the CLAP! :D clap two times it should hear a switching sound
2. Clap again twice slowly it should turn off
3. Get your IR remote and test it out all buttons you functioned/named on the program should work if it does not check the program again it should work.
4. Testing with our program. Open the app Connect and touch all the buttons all of it should have a switching sound.
5. Testing with the AMR_VOICE APP connect and say some specific words and it should now work.
Now Where to Place It in Your LAB/Room
Hmmm a tricky part here well since I love electronics, playing video games and technically doing most of my thing on my computer table part work station I would put it there. But I guess if your use is only for the bedroom then I guess near the bed. If you love watching movies etc then obviously near the TV.
Now that I have this blackbox I would connect it to some of my handy tools like the soldering iron,LAMPS,FAN,Guitar amp and dremel tool and maybe the computer but then I need to do some more wiring to make the switch for the computer but anyways it should work out fine.
Thank You!
Guys I would like your full support by clicking on the thumbs up button :D