Intro: QULO: the Smart Switch.....!
Hi guys, I am sharing a simple and low cost android bluetooth based home automation system in this instructable.
This device can control the appliances including bulb,fan etc. The android app sends commands to the device and controls the AC appliances connected to the ports of the device. It has three ports so we can control three devices.
The android app has seven buttons, one to connect to the bluetooth and the other three to control (ON/OFF) three appliances connected to the device .
We can connect the QULO device inside the wall switch board easily and control things wirelessly .
Not only AC device, we can connect anything as small as an LED with the device to control.
Please vote me for the microcontroller contest :)
Step 1: Steps
The steps involved in making are
1. Design the circuit.
2. Make the PCB.
3 Program the microcontroller.
3. Design and make the enclosure.
4. Make the app.
Step 2: Things Required.......
1. For making the PCB
- Double sided copper clad board.
- Etching solutions.
- ATmega 328 microcontroller.
- HC 05/06 bluetooth module.
- 5 VDC power supply.
- 5 V PCB rellays.
- resistors and capacitors.
- BC 547 transistors.
- XY 126 terminal connectors.
- 1N 4007 diodes.
- 16Mhz crystal.
- Eagle cad software.
2. For programming the microcontroller
- Arduino nano.
- Arduino IDE.
3. For making the enclosure
- 3D printer.
- Tinkercad website.
4. For making the app
- MIT app inventor site.
Step 3: Circuit Explanation
The circuit diagram consists of 328 microcontroller, HC 06 bluetooth module, 5v DC power supply module, Crystal oscillator, and the relay with relay driver. The bluetooth module receives the signal sent by the app and the microcotroller processes the signal as per it is programmed. Pin number 28,27 and 26 are defined as the output pins and the 328 is programmed in such a way that when the app sends a bit 1, the 328 makes pin number 28 go high making the appliance connected to it turn ON. When the app sends bit 2, pin number 28 goes low making the appliance turn OFF. And if the bit 3 and 4 in sent by the app, pin number 27 goes high and low respectively.
To turn on and off the third device , the app sends bit 5 and 6 to put pin number 26 high and low respectively.
Pin number 26,27 and 28 are the output pins to drive the devices we connect. But their current output is not enough to drive the load and so we use a relay along with the relay driver circuit. The output pin is connected to the base of transistor bc 547 through resistor. This base current gets amplified by 100 (hfe). The collector current is the amplified base current, so we connect the relay to the collector current path as shown. A diode 4001/4007 is connected across the relay for reverse current protection of the transistor. Each output pin is connected to a relay driver so there is three relay drivers.We connect the relay pins to a terminal connector. The AC devices we have to control is connected to the terminal connectors
The power supply a 5 V DC board from an old mobile phone charger.
Step 4: Designing the PCB
We have to design the pcb according to the circuit diagram.. We are going to design the layout pcb layout diagram using Eagle cad software.
1. Open Eagle .
2. Start a new project.
3. Draw the schematic diagram carefully.
- Choose DIL package for 328.
- Choose a 4 pin resistor network if you do not find hc 05 in the library.h
- Pay attention and add the components with desired size.
4. After completing the schematic diagram, switch it into the layout diagram.
5. Choose the dimension of the pcb as 97x47 (LxW) in mm because we are designing its enclosure with 100x50.
6. Place all the components other than the 3 relays on the top side and the relays on the bottom side of the double sided pcb.
6. After placing all the components in the right place, click the autoroute option to get all our connections rooted.
7. After this, all the tracks are with equal width . But in our design the output port tracks from the relay output is designed to carry a high AC voltage and hence to pass high current , so to withstand this high current, those tracks should have much width. For this reason width of all the tracks from relay output to the output terminal in increased much by manual routing.
8. Print the layout diagram of both the sides on a glossy paper (Print the mirror image of top side and normal image of the bottom).
Step 5: PCB Etching and Component Soldering
The layouts of the two sides printed on the glossy papers now has to be copied to the pcb. We use iron box method for this.
1. Cut a two sided copper clad board with dimension 97x47 (in mm) and clean it.
2. Place the top side print of glossy paper on one side of the board. Use an iron box with its maximum temperature to transfer the layout to the board. Place the iron box on the top of it for 4 to 5 minutes. Then remove the glossy paper from the board and the layout will be sticked on it.
3. Now use the same procedure with the bottom side's print. Give keen attention to print it on the right possition with respect to the top side. Otherwise the component placing will not be possible.
4. After copying the diagrams to the board, Keep the board in the etching solution for some time. Keep watching the board to avoid over-etching.
5. Take out the board , clean and drill it. Now we have the pcb we designed for the project.
Solder the three relays on the bottom side and all the other components on the top.
Solder a 28 pin DIL ic base instead of soldering the microcontroller directly.
Connect the power supply board using wires.
Step 6: Microcontroller Programming
The main part of this is coding and programming the microcontroller.
We have a ATmega 328 microcontroller and Arduino Uno.
The code is very simple one. We declare pin number 28,27 and 26 as the output pins. Conduct a serial read to check whether there is a signal on the bluetooth module came from the android app. If there is a signal from the app if it is "1" the turn the output pin 28 ON as mentioned before.
To upload the code to the 328
1. Remove the microcontroller from the Arduino.
2. Place our 328 microcontroller on a bread board.
3. Connect Rx pin of arduino to pin:2 of 328.
4. Connect Tx pin of arduino to pin :3 of 328.
5. Connect RESET pin of arduino to pin:1 of 328.
6. Open arduino IDE and type the program.
7. Now select Tools > Board > Arduino Duemilanove.
8. Select Tools > Processor > 328.
9. Click upload.
After a few seconds the program will be uploaded to the microcontroller.
Here is the link for more details on programming 328 using Arduino : https://www.instructables.com/id/Program-ATmega-32...
Step 7: Making the Enclosure
The enclosure is designed using Tinkercad ,an online 3d designer keeping the exact dimension.
The size is 100x50x40 (LxWxB) in cms.
There are two files i designed . One for the enclosure and the other for the top cover.
I am attaching the 3d printer files here with .stl and .obj extensions.
I used Ultimaker for printing.
Step 8: Make the QULO App
The app is built using MIT appinventer website. This is the simplest way to make your own app if you do not have much knowledge in android java programming.
There are two parts for making an app in appinventer,
1. designing the user interface in designer section.
2. relating the blocks in blocks section.
We first design the user interface including buttons,popups,icons etc and then relate them in the "blocks" section.
Step 9: Working
The three ports are acting as just switches. So, we should make a connection as in the diagram.
We can connect three devices at a time on Qulo.