Introduction: How to Make Smart Home Using Arduino Control Relay Module | Home Automation Ideas
In this home automation tutorial video, we will design a smart home relay module that can control 5 home appliances. This relay module can be controlled from Mobile or smartphone, IR remote or TV remote, Manual switch. This smart relay also can sense the room temperature and sunlight to turn on and off the fan and light bulb.
This smart relay has the following features:
1. Home appliances controlled by mobile Bluetooth
2. Home appliances controlled by TV Remote (Infrared)
3. Home appliances controlled by temperature & Humidity sensor automatically
4. Home appliances controlled by Dark Sensor
5. Display the LIVE temperature & Humidity reading.
6. Home appliances controlled with manual switches
7. Inbuilt Arduino so Arduino code can be uploaded to the relay module.
Required Components for the Smart Home Projects:
1. ATMEGA328P microcontroller
2. HC05 Bluetooth Module
3. DHT11 Sensor
4. OLED Display (128 X 32)
5. 1738 Infrared Receiver
6. PC817 Optocoupler (5 no)
7. BC547 NPN Transistors (5 no)
8. 1N4007 Diodes (5 no)
9. 1N4001 Diode (1 no)
10. LEDs 5mm (6 no)
11. 22pF Capacitors (2 no)
12. 100nF (104) Capacitor (1 no)
13. 100uF Capacitor (1 no)
14. 220-ohm Resistors (10 no) (R6 to R10)
15. 1k Resistors (7 no) (R1 to R5)
16. 10k Resistors (8 no)
17. 2k (1no) & 4.7k (1no) Resistor
18. LDR (1 no)
19. 16MHz Crystal,
20. Push Buttons (8 no)
21. 5V relays (5 no)
22. Jumper (2no), connectors, IC base
23. FTDI 232 USB to Serial interface board or Arduino UNO
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Circuit Diagram
This is the complete circuit diagram for this home automation project. I have explained the circuit in the tutorial video.
I have used the ATMEGA328P micro controller to control the 5 channel relay module. I have also connected the HC05 Bluetooth module, 1738 IR receiver to control the relays from Bluetooth and Infrared remote. And DHT11 temperature & humidity sensor and LDR to control the relay automatically.
In this circuit, we can use both 5V or 12V relay but we have to change the resistors accordingly as mentioned in the circuit.
Step 2: Make the Circuit on Breadboard for Testing
Before designing the PCB first I have made the circuit on the breadboard for testing. During testing, I have uploaded the Arduino sketch to the Atmega328P microcontroller using a USB to Serial interface board (FTDI232) then tried to control the relays with Bluetooth, TV remote, temperature sensor, LDR, etc.
I have also mapped all the microcontroller pin that used in this circuit.
Step 3: Different Mode of the Smart Relay Module
In this Smart home project we can control the relay module in different modes:
1. Bluetooth Mode
2. Infrared Mode
3. Auto Mode
4. Manual Mode
We can easily change the mode with the CMODE and SMODE button fitted on the PCB.
To change the mode:
1. Press the CMODE button.
2. Then press the SMODE button to select the mode.
3. After selecting the mode again press the CMODE button.
Step 4: Bluetooth Controlled Mode
Here we will use the HC05 Bluetooth module and Bluetooth Arduino app from the play store to control the relay module from the smartphone. You can use other apps but you have to modify the code accordingly.
As the logic level of the HC05 is 3.3volt but for the microcontroller the logic level is 5volt. So I have used a voltage divider with 2k and 4.7k resistor while connecting RX of the HC05 to TX of the Atmega328P.
Step 5: Infrared Controlled Mode
Here we will use the 1738 Infrared receiver to control the relay module from the TV remote. You can use any infrared remote but you have to get the respective Hex codes of the remote buttons and modify the code accordingly.
You can refer to the embedded video where I have explained how you can easily get the hex code from the TV remote button.
You can use any unused button from the remote to control the relay module.
Step 6: Temperature and Light Controlled Mode
In Auto mode, this smart relay module can be controlled by pre-defined room temperature and sunlight. It has a DHT11 temperature and humidity sensor sense the temperature and humidity after every 5-second interval.
When the temperature crosses the predefined max temperature value mentioned in the Arduino code the relay 1 and the relay 2 turns on.
When the temperature becomes lower than the predefined min temperature value mentioned in the Arduino code the relay 1 and the relay 2 turns off.
An LDR is fitted on the PCB to sense the ambient light. It acts as a dark sensor.
When the brightness level becomes below the predefined value the Relay 3 and Relay 4 turns on.
When the brightness level crosses the predefined value the Relay 3 and Relay 4 turns off.
Please refer to the Embedded video on the top for better understanding.
Step 7: Manual Mode
The Relay module also can be controlled manually from the push buttons fitted on the PCB.
There are 5 push buttons S1, S2, S3, S4, S5 to turn on and turn off the Relay1, Relay2, Relay3, Relay4, Relay5 respectively.
And there is a RESET button to turn off all the relays at a time.
I have explained the functionality of the circuit in the tutorial video.
Step 8: Designing the PCB
As I am going to use the circuit daily, so after testing all the features of the smart relay module on the breadboard, we can start designing the PCB.
You can download the PCB Gerber file of this home automation project from the following link:
Step 9: Order the PCB
After downloading the Garber file you can easily order the PCB
1. Visit https://jlcpcb.com and Sign in / Sign up
2. Click on the QUOTE NOW button.
3 Click on the "Add your Gerber file" button. Then browse and select the Gerber file you have downloaded.
Step 10: Uploading the Gerber File and Set the Parameters
4. Set the required parameter like quantity, PCB color, etc
5. After selecting all the Parameters for PCB click on SAVE TO CART button.
Step 11: Select Shipping Address and Payment Mode
6. Type the Shipping Address.
7. Select the Shipping Method suitable for you.
8. Submit the order and proceed for the payment.
You can also track your order from the JLCPCB.com
My PCBs took 2 days to get manufactured and arrived within a week using the DHL delivery option. PCBs were well packed and the quality was really good at this affordable price.
Step 12: Solder All the Components
After that solder all the components as per the circuit diagram.
Then connect atmega328P microcontroller, HC05, and all the sensors.
Step 13: Program the Microcontroller
1. Connect the USB to Serial interface board (FTDI232).
2. Download the Arduino sketch. (Attached)
3. Select the Arduino UNO board and proper PORT. Then upload the code.
Step 14: Connect the Home Appliances
Connect the 5 home appliances as per the circuit diagram. Please take proper safety precautions while working with high voltage.
Connect 5Volt DC supply to PCB as shown in the circuit. (I have used my old mobile charger)
Step 15: Finally
Turn on the 110V/230V supply and 5V DC supply.
Now you can control your home appliances in a smart way.
I hope you have licked this home automation project. I have shared all the required information for this project.
I will really appreciate it if you share your valuable feedback, Also if you have any query please write in the comment section.
For more such project Please follow TechStudyCell. Thank you & Happy Learning.