In this home automation project, I have explained how to make an Arduino relay project with EEPROM to control appliances using Bluetooth, IR Remote, and manual switches.

Arduino relay project with EEPROM

With this Arduino project, we can save the previous state in Arduino EEPROM, so after the power cut, when the power comes back, the relays will automatically turn ON according to the previous state.

Required Components for this Arduino Project

Required Components
  • Arduino UNO
  • HC-05 Bluetooth Module
  • 1838 IR Receiver IC (with metal case)
  • 2k Resistor 1/4 watt
  • 4.7k Resistor 1/4 watt
  • Pushbuttons or switches
  • 4-channel Relay Module 5V

Circuit of Arduino Relay Project

Circuit of Arduino Relay Project

The circuit is very simple, I have used D4, D5, D6 & D7 GPIO to control the 4-channel relay module.

And the GPIO D10, D11, D12 & D13 are connected with switches to control the relay module manually.

The output pin of the IR receiver is connected with A0.

For the serial communication with the Bluetooth module, I have used D2 as RX and D3 as TX with the SoftwareSerial library.

Here I have made a voltage divider using 2k and 4.7k resistors to drop down 5V logic level to 3.3V logic level for the serial communication with the HC-05 Bluetooth module.

I have used the INPUT_PULLUP function in Arduino IDE instead of using the pull-up resistors with each switch.

As per the source code, when the control pins of the relay module receive the LOW signal the relay will turn on and the relay will turn off for the HIGH signal in the control pin.

I have used a 5V 2Amp mobile charger to supply the circuit.

Circuit of Arduino Relay Project

If you want to use push-button for manual control, then just connect pushbuttons instead of latched switches.

Please take the proper safety precautions while working with high voltage.

Tutorial video on Arduino Home Automation

In the tutorial video, I have covered the following topics in detail.

  • Demonstrated Arduino relay projects with EEPROM.
  • Explained circuit of Arduino control relay.
  • How to get IR codes of any IR remote.
  • Program the Arduino UNO.
  • Install Bluetooth App for home automation project.

Control Relays with Bluetooth, IR Remote & Switch

Arduino Bluetooth control relay
Control relays with Bluetooth

To control the relays from mobile, you have to turn on the Bluetooth and connect the HC-05 Bluetooth module.

After connecting the Bluetooth you can easily control the appliances from the Bluetooth app.

Arduino IR Remote control relay
Control relays with IR Remote

You can use any IR remote to control the appliances.

First, get the HEX codes of unused IR Remote buttons, then update the HEX codes in the Arduino sketch.

Arduino control relay with switch
Control relays with switches

You can also control the appliances from manual switches or pushbuttons.

Download the Codes for the Arduino Projects

Click on the following buttons to download the source codes for this Arduino project.

Get the IR codes (HEX codes) of IR Remote

Get IR codes of IR remote

First, we have to upload the Code for Getting HEX codes to Arduino UNO and connect the IR receiver with A0

After that, open the serial monitor, select the Baud Rate at 9600.

Get IR codes of IR remote

Now, you have to press all the remote buttons (one by one) which you want to use to control the relays.

Now, save all the HEX codes or IR codes. You have to update the main sketch with these HEX codes.

Program Arduino UNO with Arduino IDE

In the Tutorial video, I have explained all the steps to program the Arduino UNO using Arduino IDE.

Install the required Arduino Libraries

  1. Install the IRremote library from Include Library or Click Here to download.
  2. Install the AceButton library from Include Library or Click Here to download.

Modify the main code for this Smart House project

Now, open the source code in Arduino IDE. and update the HEX code

Arduino IR codes

Copy-paste the HEX code after 0x [Ex: 0x[your HEX code]]. For this Arduino project, you need 6 HEX codes.

If you use the same circuit and Bluetooth App, then no other changes are required in the code.

PCB for this Arduino Home Automation system

arduino control relay pcb

To make the circuit compact, I have designed this PCB for this Arduino project.

Here, I have used the Atmega328P microcontroller, you can upload the same code to Atmega328P using FTDI232 USB to serial interface board.

Apart from that, you can also connect different sensors, OLED display, WiFi module with this PCB. I will cover that in upcoming projects.

If you want, you can also use this PCB to make the circuit compact and give the project a professional look. This PCB can be used for any Arduino Home Automation project.

PCBWay 750x161 Banner

About PCBWay and their services

PCBWay not only produces FR-4 and Aluminum boards but also advanced PCB like Rogers, HDI, Flexible and Rigid-Flex boards, at very reasonable price.
For the online instant quote page please visit – pcbway.com/orderonline
Inspect your Gerber file before placing the order – OnlineGerberViewer

You may order as small as 5pcs of PCB from the PCBWay. You can place an order as per your requirement.

You can explore different useful PCB projects from the PCBWay Open-source community – pcbway.com/project

For more details please visit the following articles.
Why PCBway
PCB Capabilities
High-Quality PCB

Required Components for the PCB

  1. Atmega328P microcontroller with bootloader
  2. 16MHz Crystal
  3. 22pF Capacitors (2 no)
  4. 100nF (104) Capacitor
  5. 1uF box Capacitors 1no
  6. 220uF Capacitor 2no
  7. AMS1117 3.3v Regulator
  8. Relays 5v (SPDT) (4 no)
  9. BC547 Transistors (4 no)
  10. PC817 Optocuplors (4 no)
  11. 510-ohm 0.25-watt Resistor (4 no) (R1 — R4)
  12. 1k 0.25-watt Resistors (6 no) (R5 — R10)
  13. 2k 0.25-watt Resistor
  14. 4.7k 0.25-watt Resistor
  15. LED 5-mm (6no)
  16. 1N4007 Diodes (4 no) (D1 — D4)
  17. Push Buttons (8 no)
  18. Terminal Connectors
  19. Jumper (5 no)
  20. Switch (1 no)
  21. 2mm Pitch Female BERG Strip
  22. 5V DC supply
  23. FTDI232 USB to Serial

Steps to connect the Bluetooth App with HC-05 module

Connect the ESP32 with Bluetooth

To control the ESP32 with Bluetooth, I have designed a Bluetooth App in MIT App Inventor.

Download the Bluetooth Switch App and install it. I have not submitted the App to Google Play Store. So you may get an alert while installing the App.

Now, you can connect the Bluetooth App with the HC-05 module.

  1. Turn ON mobile Bluetooth and Pair the HC-05 module.
  2. Open the Bluetooth Switch App and tap on “Tap to Connect“.
  3. Select the “HC-05” from the list.
  4. Now, you can control the relays from mobile with Bluetooth.

Our Arduino Home Automation system is now ready

Arduino home automation system

Now you can control the appliances from your smartphone, IR remote, and manual switches.

Please share your feedback on this home automation system using Arduino UNO.

Click Here for more such Arduino projects.

Please do share your feedback on this IoT project. Thank you for your time.

Leave a Reply