---
title: "iot_based_home_automation_sol"
url: "https://maker.wiznet.io/Hannah/projects/iot-based-home-automation-sol/"
markdown_url: "https://maker.wiznet.io/Hannah/projects/iot-based-home-automation-sol/md"
type: "UCC: User Created Content"
author: "Sourabh Shenoy"
author_url: "https://github.com/sourabhshenoy04/iot_based_home_automation_sol"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Sourabh Shenoy"
original_url: "https://github.com/sourabhshenoy04/iot_based_home_automation_sol"
published: "2024-08-05"
language: "en"
likes: 0
views: 762
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# iot_based_home_automation_sol

> To control home devices using Blynk IoT app through Blynk Cloud Server.

Original author: Sourabh Shenoy (source: https://github.com/sourabhshenoy04/iot_based_home_automation_sol)

## Article

### IoT Based Home Automation Solution

**Project Overview:** This project is focused on creating an IoT-based home automation solution that allows remote control of various home devices such as garden lights, a temperature system, and a water tank using the Blynk IoT app. The system integrates hardware components like sensors and actuators, and it is simulated using the PICSim Lab Emulator.

### Tech Stack and Components:

**Hardware:**

1. **LDR Sensor**: Used for detecting light intensity to control garden lights.

2. **LED**: Acts as the garden light.

3. **CLCD hd 44780**: A character LCD for displaying system status.

4. **Arduino UNO (atmega328p)**: The main microcontroller used for interfacing with sensors and actuators.

5. **Ethernet Shield (ETH w5500)**: Provides internet connectivity to the Arduino.

6. **Temperature System**: Includes a heater and cooler for managing home temperature.

7. **Water Tank (Serial Remote Tank)**: For simulating a water tank's inlet and outlet control.

**Software/Tools:**

1. **Arduino IDE**: For programming the Arduino board.

2. **PICSim Lab Emulator**: For simulating the hardware setup.

3. **Blynk Application**: Both mobile and web versions to control and monitor the system.

**Languages Used:**

- Embedded C/C++

### Key Features and Working:

**Garden Light Control:**

- **Goal**: Lights are off during the day and on at night.

- **Working**: Uses an LDR sensor to measure light intensity. When the ambient light is low, resistance increases, turning the LED on. Conversely, during high light conditions, the LED turns off.

**Temperature System Control:**

- **Goal**: Remote control of heater and cooler using the Blynk app.

- **Working**: The system reads temperature from the sensor and displays it on the CLCD and mobile app. If the temperature exceeds 35°C while the heater is on, it automatically turns off and sends a notification to the mobile app.

**Water Tank Control:**

- **Goal**: Manage water tank levels and control inlet/outlet valves.

- **Working**: The system reads the tank's water volume and displays it on the CLCD and mobile app. If the water level drops below 2000L, the inlet valve turns on automatically, and a notification is sent. When the level reaches 3000L, the inlet valve turns off, and another notification is sent.

### W5500 Ethernet Shield Usage:

The **W5500 Ethernet Shield** plays a crucial role in providing internet connectivity to the Arduino board, enabling it to communicate with the Blynk Cloud Server. Here’s how it is used in the project:

**Initial Setup:**

- Libraries for SPI and Ethernet are included (`SPI.h` and `Ethernet.h`).

- The `BlynkSimpleEthernet.h` library is used to interface with the Blynk app.

**Network Configuration:**

- The Ethernet shield is configured to connect to the local network using DHCP or a static IP address.

- The Blynk authentication token, device name, and template ID are set up to link the hardware with the Blynk server.

**Communication:**

- The Ethernet shield enables the Arduino to send and receive data from the Blynk cloud.

- Sensor data (temperature, light intensity, water volume) is sent to the Blynk app.

- Control commands from the Blynk app (e.g., turning on/off the heater or cooler) are received and executed by the Arduino.

### Code Structure:

**home_automation_blynk_controlled.ino**: Main Arduino sketch

- **Setup and Definitions**: Includes libraries and sets up Blynk, LCD, temperature system, LDR, and serial tank.

- **Looping**: Executes Blynk and timer tasks.

- **Display**: Updates temperature and water volume on the CLCD.

- **Control Logic**: Manages garden lights, temperature control, and water tank valves based on sensor readings and Blynk app inputs.

**ldr.cpp and ldr.h**: LDR sensor handling

- **Initialization**: Sets up LDR sensor pin modes.

- **Brightness Control**: Adjusts garden light brightness based on LDR readings.

**serial_tank.cpp and serial_tank.h**: Water tank control

- **Serial Communication**: Manages communication with the water tank system.

- **Valve Control**: Functions to enable or disable inlet and outlet valves.

**temperature_system.cpp and temperature_system.h**: Temperature system control

- **Initialization**: Sets up temperature sensor and control pins.

- **Temperature Reading**: Converts analog readings to temperature values.

- **Heater/Cooler Control**: Functions to control heater and cooler states.

### Setting Up Blynk IoT App:

1. **Create Account**: Register on the Blynk web version.

2. **Create Template**: Define a template named ‘Home Automation’.

3. **Add Device**: Link the device with the Blynk server using the template ID and auth token.

4. **Add Datastreams**: Configure data streams for sensors and actuators.

5. **Setup Widgets**: Add widgets in the mobile app to control and monitor the system.

6. **Arduino IDE Setup**: Install necessary libraries, write the code, compile, and upload the HEX file to the PICSim Lab Emulator.

### Demonstration:

A complete demonstration of the project is available in a YouTube video: [Home Automation using Blynk and Arduino](https://www.youtube.com/watch?v=JTmT7ICp2aE&ab_channel=SourabhShenoy).

This project illustrates how IoT technology can be leveraged for home automation, providing convenience, efficiency, and remote monitoring/control capabilities through a user-friendly mobile interface.

---

Source: https://maker.wiznet.io/Hannah/projects/iot-based-home-automation-sol/
