ESP01 Arduino Home Automation Cover

Home Automation using Arduino ESP8266 WiFi module & Blynk App

Arduino home automation system explained with the Circuit, Source Code. Control relays from Blynk DHT11 sensor IR remote using Arduino ESP8266

In this Arduino ESP8266 project, I have explained how to make the Arduino home Automation project using an Atmega328 microcontroller and ESP01 wifi module.

ESP01 Arduino Home Automation

This IoT based home automation system has the following features:

  1. Control Home appliances from the smartphone through the internet with Blynk App.
  2. Control Home appliances with manual switches.
  3. Control Home appliances with TV Remote (Infrared)
  4. Automatic LDR & temperature control relays.
  5. Monitor LIVE room temperature & humidity reading on the Blynk App and OLED display.
  6. Monitor real-time status of all switches on the Blynk App
  7. Inbuilt Arduino. Upload any Arduino sketch to the Atmega328P.

Circuit Diagram of Arduino ESP8266 project

Circuit Diagram of Arduino ESP8266 project
Mapping of Atmega328 microcontroller pins

Required Components for Arduino Home Automation

  1. ATMEGA328P microcontroller with the bootloader installed
  2. ESP01 WiFi Module
  3. DHT11 Sensor
  4. 1738 Infrared Receiver IC
  5. BC547 NPN Transistors (5 no)
  6. PC817 Optocoupler (5 no)
  7. 1N4001 Diode (1 no)
  8. 1N4007 Diodes (5 no)
  9. LEDs 5mm (6 no)
  10. 22pF Capacitors (2 no)
  11. 100nF (104) Capacitor (1 no)
  12. 470uF 25V DC Capacitor (1 no)
  13. 220-ohm Resistors (15 no) (R1-R10)
  14. 1k Resistors (1 no)
  15. 10k Resistors (9 no)
  16. 2k (1no) & 4.7k (1no) Resistors
  17. LDR (1 no)
  18. 16MHz Crystal
  19. Push Buttons (9 no)
  20. 5V relays (5 no)
  21. Jumper (2no), connectors, IC base
  22. AMS1117 3.3V voltage regulator (1no)
  23. OLED Display 96″ (optional)
  24. FTDI 232 USB to Serial interface board or Arduino UNO

Tutorial video on this Arduino ESP01 control Relay

In this tutorial video, I have explained how to make this Arduino home automation using the atmga328p microcontroller and ESP01 wifi module.

Different Modes of Smart Relay

In this Smart home project you can control the home appliances in two modes:

  1. Manual Mode:
    In manual mode, you can control the home appliances manually from Blynk App, pushbuttons & IR remote.
  1. Auto Mode:
    In Auto Mode, the relay module can be controlled by predefined room temperature and ambient light sense by the DHT11 sensor and LDR.

To change the mode of relay module, you have to press the CMODE button.

Configuring the Blynk App

Configuring the Blynk App
  1. Download the Blynk App from the Google play store or App store.

2. Tap on the new project and Enter the project name and choose the device ESP8266 as in this project I have used the ESP01 module.

3. After that Blynk will send an Auth Token to the registered email id. The Auth Token will be required while programming the ESP01.

Adding widgets in Blynk App

Adding widgets in Blynk App

First open the project and tap on the “+” icon on the top.

Add 2 Gauge widgets from the widget box to show the temperature and humidity reading. I have used V5 and V6 pins.

Then add 5 Button widgets to control 5 relays. Here, I have used V1, V2, V3, V4 & V5 pins.

Then add 1 Styled button widget to change the Mode of the Smart Relay.

Please refer the tutorial video for configuring the Blynk App

Code for this Arduino Home Automation

Code for Arduino home automation

For this Arduino home automation project you have to program both Atmega328P microcontroller and ESP01 wifi module.

I have explained the both codes in the tutorial video.

After downloading the code you have to unzip the file, then you will get the codes from Arduino (Code_Arduino_OLED0.96_SmartRelay_V5.ino) and the Code for ESP01 (Code_ESP8266_SmartRelay_V5.ino).

You can refer this articles on How to program ESP-01.

PCB for Arduino Home Automation

PCB for Arduino Home Automation

To give this home automation project a professional look and make the circuit compact, I have designed the PCB for this project.

You can also download the PCB Gerber file of this smart home project.

Soldering components on PCB

Soldering components on PCB

Now, places all the components on the PCB as mentioned on layout, then start soldering.

After soldering the components connect the Atmega328P and ESP01 with the circuit.

Connect Home Appliances with Relay

Connect home appliances with Relay

Now, connect 6 home appliances with the Arduino ESP01 control relay as per the circuit.

Please take proper safety precautions while working with the 110V or 220V supply.

Control Relays from Blynk App

ESP01 Arduino Home Automation

If the ESP01 is connected with the WiFi, then you can control the home appliances from Blynk app. You can also monitor the LIVE room temperature and humidity reading in Blynk app.

Control Relays from Manual Switches

Control relay from manual switches
Controlling relays from manual switches

You can also use the push buttons to control the home appliances. If the ESP-01 is connected with WiFi then Blynk App will show the current status of the switches.

IR Remote control Relays

IR Remote control Relays
Controlling Relays from IR Remote

In this Arduino ESP8266 project, you can also use IR remote to control the home appliances.

Here, you have to map the Hex codes of IR remote in the Arduino Code. Please refer to the article on IR Remote control Relay.

Control Relays with Temperature & LDR

Temperature control relay with Arduino
Relays control by room temperature

In this IoT-based home automation project, Arduino compares the predefined maximum and minimum temperature values with the temperature sensed by the DHT11 sensor.

You can set the temperature in the Arduino Code. as per the code in the Auto Mode, Relay-1 and Relay-2 will be controlled by the room temperature.

Relays control by Dark sensor
Relays control by the LDR (Covering the LDR with finger)

In a similar way, Relay-3 and Relay-4 can be controlled by the ambient light. You can set the parameter in the Arduino Sketch.

I hope you like this article on the Arduino ESP01 home automation system.

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