How to Make Smart Home Using Arduino Control Relay Module | Home Automation Ideas

24K18017

Intro: How to Make Smart Home Using Arduino Control Relay Module | Home Automation Ideas

In this home automation project, 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.

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.

LDR Control

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:

https://drive.google.com/uc?export=download&id=180s0bidnq6u6ilYs4vcLQwcjJ2zMrFZP

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 liked 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.

You can also visit our website for more such project: https://easyelectronicsproject.com

For more such project Please follow TechStudyCell. Thank you & Happy Learning.

10 Comments

Wieviel kostet
Esid Eine
Thanks the project its covers a lot of important stuff but l doing a different project but similar to this one so l was wondering if l could have the mobile app which you used
I can not found the code .. can anyone post ir please...thanks in advance
Really appreciate your efforts
I have already attached the Arduino code in this instructable.
that s so good thank you
well done for the post!!! one thing I missed was the energy comsuption? is it possible? how?
In next project I will try to add the features.
well explained...thank you for sharing....