Introduction: Complete Home Automation Pack
I made a complete home automation system for my home. Now, I can control my electrical devices by a TV remote and from my smartphone. It is a low-cost solution and each unit will cost approximately $10 by which you can control four appliances.
In next few steps, I will explain how I made it. I will add all necessary schematic, PCB layout, and Arduino sketch so that you can easily replicate it. Before going further watch the demo video.
Step 1: Shopping List
Before ordering the components, you need to determine how many devices you want to control. I am adding the bill of materials for 8 devices, four in each room.
1. Arduino UNO (3 pcs): You can buy one Arduino UNO and 2 Arduino IC (ATmega328) without buying 3 Arduino UNO because we will use only the Arduino microcontroller in our circuit without using whole Arduino board. But, for uploading the sketch in the standalone ATmega328 you need to burn the bootloader first. If you never burn bootloader before please visit the official tutorial from here (From Arduino to a Microcontroller on a Breadboard).
2. HC-05 Bluetooth Module (1 pc): If you want to control an Arduino using a smartphone, you need a Bluetooth module like HC-05. Comparing it to the HC-06 module, which can only be set as a Slave, the HC-05 can be set as Master as well which enables making a communication between two separate Arduino Boards also. There are several different versions of this module but I recommend the one that comes on a breakout board because in that way it’s much easier to be connected. The HC-05 module is a Bluetooth SPP (Serial Port Protocol) module, which means it communicates with the Arduino via the Serial Communication. If you are new in HC-05 you may reed the tutorial ( Arduino and HC-05 Bluetooth Module Tutorial).
3. NRF24L01 wireless module (3 pcs): The NRF24L01 transceiver module is a wireless module. It uses the 2.4 GHz band and it can operate with baud rates from 250 kbps up to 2 Mbps. If used in open space and with lower baud rate its range can reach up to 100 meters. If you want to make a network of multiple Arduino it can be a good option. I am using this device to send a signal from a smartphone to multiple Arduino (multiple rooms) using a single Bluetooth connection. For more information about nRF24L01 and Arduino visit RF24L01 2.4GHz Radio/Wireless Transceivers How-To tutorial.
4. 5V, 600mA SMPS Circuit (mobile phone adapter circuit) (3 pcs): For powering electronics AC to 5V DC converter is required. SMPS are small in size and have high efficiency. You can easily find the circuit from old mobile phone charger circuit. Before using be sure it has minimum 600mA current capacity.
5. TV Remote (1 pc): You can use any TV remote for the purpose. I will show you how you can read a remote using Arduino. You can read this nice tutorial about Arduino & IR Remote.
6. IR receiver 1838B (2 pcs): The 1838B is a miniaturized infrared receiver for remote control and other applications requiring improved ambient light rejection. The separate PIN diode and pre-amplifier IC are assembled on a single lead frame. The epoxy package contains a special IR filter. This module has excellent performance even in disturbed ambient light applications and provides protection against uncontrolled output pulses. The receiver can be powered from a 3.3V or 5V supply and with just one data output pin allows it to be easily interfaced with many types of microcontrollers.
7. Triac BT134 (8 pcs) & Optoisolated Triac Driver MOC3021 (8 pcs): If you want to control AC appliances from a DC signal or Microcontroller or transistor you need to use an electro-mechanica relay or solid state relay. I am using here solid state relay because solid state relays has some advantages over mechanical relay. The main part of a solid state relay is a triac.
Unlike electro-mechanical relays (EMR) which use coils, magnetic fields, springs and mechanical contacts to operate, the solid state relay, or SSR, has no moving parts but instead uses the electrical and optical properties of solid state semiconductors to perform its input to output isolation and switching functions.
Just like a normal electro-mechanical relay, SSR’s provide complete electrical isolation between their input and output contacts with its output acting like a conventional electrical switch in that it has very high, almost infinite resistance when nonconducting (open), and a very low resistance when conducting (closed). Solid state relays can be designed to switch both AC or DC currents by using an SCR, TRIAC, or switching transistor output instead of the usual mechanical normally-open (NO) contacts. While the solid state relay and electro-mechanical relay are fundamentally similar in that their low voltage input is electrically isolated from the output that switches and controls a load, electro-mechanical relays have a limited contact life cycle, can take up a lot of room and have slower switch speeds, especially large power relays and contractors. Solid state relays have no such limitations.
8. 3.3V Regulator AMS1117 (2 pcs): We are using nRF24l01 for wireless communication. The device operates on 3.3V. So two 3.3 V regulators are required for two rooms.
9. Tactile Button Switch 12mm (8 pcs)
Step 2: Schematic
Before going to the details of schematic let me explain how the system works. I divided the complete system into two units. Each room has a control unit called as a NODE. The number of the node will be equal to the number of rooms you want to automate. There will a central control unit called a GATEWAY. The whole system will have only one gateway. All the nodes will be connected to the gateway wirelessly with a nRF24L01 wireless transceiver. The gateway is physically connected to a wireless transceiver and a Bluetooth HC-05 module. If you want to control the devices from your smartphone you should connect with the gateway through Bluetooth. I developed an Android application through which you can control the appliances of every room. You need to press the control button for the specific device of a specific room. When you press a button the application sends a specific data to the gateway. The gateway can identify for which specific device of which room the command was received and send it to the specific receiver.
In this way, you can send a message to multiple control unit or node from a single smartphone with a single Bluetooth connection.
I designed two nodes each has a capability of controlling 4 devices but the number of the device can be increased very easily from the schematic. I divided the schematic into 3 parts. One for the node, one for the gateway and another for the button panel. I attached all the schematic herewith.
Let's first discuss the node circuit. The purpose of the node circuit is to control AC appliance by the trigger of a microcontroller. For controlling AC device from a microcontroller you need electro-mechanical or solid state relay. As solid state relay has some advantages over electro-mechanical relay I used solid state relay. The main parts of a solid state relay are TRIAC and optoisolated TRIAC driver. The microcontroller sends a logic signal to the optoisolator and the optoisolator drive the TRIAC. You should & must use a 270-330 ohm resistor between optoisolator and microcontroller otherwise you may burn the optoisolator. If you want to drive a high inductive load with TRIAC you should also use a Snubber circuit.
The microcontroller is the main unit of a node and I used most popular Arduino microcontroller ATmega328 for my project. For the communication with the gateway, I used nRF24L01 wireless transceiver module. The wireless module requires a 3.3V power supply and for the reasons, I used a 3.3V regulator. As the microcontroller can run from 3.3 V supply, I provided 3.3 V the power for the Arduino to keep the node simple.
The schematic of the gateway is very simple, just connect Arduino to the wireless transceiver and the Bluetooth module. As it is simple I attached a Fritzing schematic for the gateway.
The connection of the button panel is also very simple. Four buttons and one IR receiver are connected with a common ground. The button panel and the control unit will be connected with a jumper cable.
All the schematic were made in Eagle. I attached the corresponding Eagle file so that you can easily modify it if you feel.
Step 3: PCB Design
From the three schematics attached in the previous step, I develop three separate PCB layout for the control unit, switchboard, and the main gateway. I also designed two PCB layout for the control unit and switchboard. For the gateway, I don't design any PCB layout but you may design yourself if you like, from the Fritzing sketch. All the Eagle board file were also attached to the previous step. From the board file, I made PCB using toner transfer method. I think it is the simpler method for DIY PCB making. There are lots of tutorials available on the Internet on toner transfer method. If you are new in the field take a look onto the tutorial PCB Etching Using Toner Transfer Method & http://www.dr-lex.be/hardware/tonertransfer.html before making your own. The process is very easy and good quality PCB etching is possible in this method. I attached some image I took during the development process.You may also watch the following video.
Step 4: Soldering All the Components
Soldering is not a very easy task. The quality of the soldering depends on your experience. In my design, all the components are through-hole without the 3.3V regulator. I recommend using IC base for the microcontroller. It will be also good if you use IC base for optoisolator especially if you are new in soldering. Otherwise, you may damage the ICs when soldering. I also suggest you to carefully solder the nRF24L01 module. Other components are not so sensitive. To keep the board small the design space was very limited and for that, there is not enough space between two traces. So, careful soldering is required to avoid sorting the traces during soldering.
Soldering of the switchboard will be easy and two board will be connected together through jumper cable. So, use 7 wires jumper cable to attached the switchboard to the control board. Take 15cm long jumper cable to bring enough flexibility.
Are you new in soldering? Watch the video.
Step 5: Connecting All
After making and soldering all the components on the PCB board you need to join control board with the button board using jumper wires. Then, you need to connect 5V power adapter to the control board. Before connecting the power adapter to the control board be sure about the polarity of the power output otherwise, you may damage your circuit.
Step 6: Uploading Program & Testing
As you connected all the necessary electronics now you need to instal life in the circuit. I attached the necessary sketch for the Arduino microcontroller. Download all the sketch. Upload the sketch node.ino for each room and gateway.ino for the main gateway. After uploading the Arduino program connect four devices to the control unit for one room and test it using button & remote. To control it from the smartphone you need to develop an android application. I will show it in a later step.
Step 7: Making a Box
If you tested and found all the thing OK and working perfectly you should put all the electronics on a standard switchboard box. I made the PCB layout according to the size of a standard switch board box (80mm X 80mm). So, if you cut the PCB according to the outside line it will exactly fit inside the box. Before placing the main board in the box, place the power circuit inside the box and fix it using hot glue. Then place the control circuit in the box above the power circuit.
Step 8: Front Panel
Make five holes (four for the buttons, one for the IR receiver) according to the spacing and position of the button or switchboard. From the inner side place a piece of thin red color plexiglass to close the hole of IR receiver. It will increase the beauty and protect IR receiver from dust. I place the glass with the help of hot glue.
Step 9: Placing the Switchboard
You already made the holes for the switches. Now place the switchboard in the exact place and add plenty of hot glue to keep it in its place. Be careful when adding glue. If you add glue in the button it will be hard to press. After placing the button board with the front panel fix it to the bottom box with the screw.
Step 10: Developing Android Application
The Android application for the project was developed using MIT App Inventor. Developing android application on App Inventor environment is very easy. You don't need any programming knowledge to do this. I attached the build android application and App Inventor source code in the step. If you want to modify the application use the source.
We have a be nice policy.
Please be positive and constructive.