---
title: "Development of a home automation system using Arduino."
url: "https://maker.wiznet.io/emimamanna/projects/development-of-a-home-automation-system-using-arduino/"
markdown_url: "https://maker.wiznet.io/emimamanna/projects/development-of-a-home-automation-system-using-arduino/md"
type: "UCC: User Created Content"
author: "emimamanna"
author_url: "https://maker.wiznet.io/emimamanna/"
original_author: "Chen, Yiman"
original_url: "https://www.theseus.fi/handle/10024/145404"
published: "2022-10-25"
language: "en"
hardware: ["Arduino Ethernet Shield"]
likes: 5
views: 1214
comments: 1
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Development of a home automation system using Arduino.

> This system in the electrical sector is commonly known as home automation or smart home, which is one of the most emblematic nowadays .

Original author: Chen, Yiman (source: https://www.theseus.fi/handle/10024/145404)

## Components

- **Arduino Ethernet Shield** x 1 ([docs](https://docs.arduino.cc/retired/shields/arduino-ethernet-shield-without-poe-module))

## Article

** INTRODUCTION **This project is divided into sections, the first section is the specifications and design restrictions, where the specifications of the materials used in the project will be discussed, the second section is the description of the proposed solution with a detailed description of the functions who will carry out this project. then there is the section of the sensors, and within this section there are 6 mini sections that will make an explanation with the most relevant characteristics of each sensor in detail. then there is the Arduino section, which is the heart of our project, in this section there will be an explanation of what the Arduino is, its development ideology, the Arduino model used in this project and the shields compatible with Arduino. In the next section speaks of the ethernet shield with the explanation of each of its part, then this is the design of the automation system and focuses on the hardware, software and applications used for implementation. The last one is the conclusion of the project.

**SPECIFICATIONS AND DESIGN RESTRICTIONS **The specifications of the different used technologies are the following:

Ethernet shield W5100: It is based on the Wiznet W5100 ethernet chip providing a network (IP) stack capable of both TCP and UDP. The on-board micro-SD card slot can be used to store files for serving over the network. The W5100 and SD card share the SPI bus, only one can be active at a time. If you are using both peripherals in your program, this should be taken care of by the corresponding libraries. If you're not using one of the peripherals in your program, however, you'll need to explicitly deselect it. The shield provides a standard RJ45 ethernet jack.

Arduino MEGA 2560: USB feed with Atmel AVR micro controller, use memory static random access SRAM with Flash storage capacity and EEPROM.

830 point solder-less test plate with male connection cables.

RGB LEDs (diodes that emit light) that work with a voltage between 2V and 3.2V, a maximum current of 20 mA and a maximum brightness (RGB) of 2800 mcd, 6500 mcd and 1200 mcd.

The HC-SR501 motion sensor is based on infrared technology, module Automatic control, with the design of the LHI778 probe, high sensitivity, high Reliability, ultra low voltage operating mode. The Android controller of Arduino via ethernet.

DHT11 humidity and temperature sensor with power supply between 3V and 5V, Temperature measurement range from 0ºC to 50º C, temperature resolution of 0.1ºC, Humidity measurement range 20% to 90% RH and Humidity Resolution: 1% RH, the time it takes to measure the humidity is 1 second.

- We will use the C ++ programming language in the Arduino software.

- The flame sensor that can detect ordinary wavelength light source in the range of 760 nm to 1100 nm and a maximum detection distance of 100cm.

**DESCRIPTION OF THE PROPOSED SOLUTION **

- The main objective of this project is the development and study of a automation system of home installations based on a free hardware platform, Arduino, in which we will need other auxiliary devices for its implementation. The main functionalities that will be analysed and studied in this project are the following:

- Detection of the temperature and humidity of the environment through a temperature and humidity sensor (DHT11) and display the information on an LCD screen and can also check the ambient information with web server. This information will be updated every 10 minutes.

- A security system if it detects some movement with the PIR motion sensor will activate and send a message to the mobile phone of the tenant to notify him of the entrance of the home of some strangers.

- Connection of the Arduino MEGA 2560 to the mobile phone through a ethernet shield, which allows us to do some operations through the web server or applications. It can receiving connections from a PC, Tablet or mobile, is able to generate connections with others devices equipped with web server.

- Control the lights of the home from a PC or a mobile phone through the connection previously done with the ethernet shield, in which we can perform operations such as turning the light on and off from the web server, with some virtual switch or voice control.

**AUTOMATION SYSTEM **

In this part will show how is the connection of all used material, the specification of the used software, how is the Arduino code work with a flowchart and some demonstration of final circuit with all implementation.

** Design **

In this project the system design is devised in three layers: Hardware, Software and Application layer. The hardware layer consists of electrical specifications of the design. In this layer describes how to connect the ethernet shield, the different sensors to Arduino Mega. The second layer is software, where include the programming design of the automation system and the communication, it also describes function to control the ethernet shield and technique used to read sensor data. In the application layer introduces the design of a web server, control of the mobile phone, the application we have used and the way data is transferred from software and application layer. The block diagram of the automation is in the figure 13.

![](https://maker.wiznet.io/upload/ckeditor5/945076809%5F1666706816%2Ejpeg)

FIGURE . Block Diagram of Automation System

** Hardware **

Arduino Mega 2560 is the core of the automation system of the smart home. Mega can be connected and read multiple sensors simultaneously, it also provides enough processing power and memory to run the web server. The network shield W5100 is used for the network connectivity in this project, it is added on the top of the main board. The network shield enables web server hosting to local area network (LAN) and it has included SD card slot to store big term data. You can see in the figure 14 left network shield is visible on top of Arduino. The temperature and humidity sensor DHT11 is connected to digital pin 2 of the micro-controller.

The LCD display has 16 micro-controller, in the figure 7 you can see the name of each pin. The first pin is VSS and the last pin is backlight cathode, those have to be connected to GND. The second pin called VDD and the pin number 15 called backlight anode have to be connected to the alimentation with 5 V. The third pin is VE it is a contrast voltage so it has to be connected to a potentiometer to able to modify the contrast of the display, but there is another possibility to modify, is connecting the VE pin to Arduino PWM pin. The forth pin is a register select and it is connected to the digital pin number 28 of the Arduino, the pin 5 is connected to the digital pin number GND, the pin 6 is a enable pin connected to pin number 29 of Arduino, the pin 7 to 14 are data pin and they are connected to the digital pin 24 to 27.

The motion sensor has 3 micro-controller the alimentation pin to 5V, the ground pin to and the data pin, it is connected to pin 7 of the Arduino. The buzzer have the same number if pins like motion sensor and its data pin is connected to pin number 9 of Arduino. The flame sensor has four pins, the data pin can be analog or digital, in this project is using digital pin and its connected to the pin number 6 of Arduino.

For the led its needed a resistance of 220 Ohm to regular the alimentation tension and another pin is connected to GND. The physical circuit with all components is in the figure right.

 

 

**Software **

In Arduino programming there are two main functions, setup() and loop(). The setup function is only operated one time when device is booted up, usually is used to initialise the variables. Loop() is ran after setup() function, this function will be running constantly until power off or reset button is pushed. In Arduino programming, there is open-source libraries are available from Arduino community and also you can import another libraries to the Arduino environment. The flowchart of this Arduino program is in the figure .

 

The sketch of Arduino was started from the sensors, use Arduino IDE provides libraries to simplify the code of DHT11 and LCD display. All the information about sensors are read directly from digital pins. Data from temperature, humidity sensor and flame sensor are printed out to Arduino serial monitor (figure). To provide user remotely controls the house needs to establish a web-server. Web-server libraries are created for Arduino using HTML language to design a precisely user interface. The web-server receive Arduino´s order to modify the temperature and humidity, on the other hand, the web-server can send dato to Arduino to change the state of the light.

There are 5 different functions in the sketch, once the code runs in the Arduino IDE, after enter the loop, the first function is the flame sensor, initially is declared low level, if there are some flame detected, the flame sensor will turn to high level, then it will turn the buzzer on. The second function is the serial monitor, firstly the program will ask if it is available, if it is, so the serial monitor can be a input to change the state of the led, if it is not available then it will return to the loop. The third one is the connection of the web-server, once it is connected, the program will ask if there is client available, if it is, so the program will send information of the temperature and humidity sensor to the web-server, furthermore, we can see the state of the light and there are two switches to change the state. The fourth function is the detection of the temperature and humidity, once it is read, it will be written on the LCD display, we can control the time of update by wait (number_milisecond), this function is a infinite loop. The last one is the motion sensor, at the beginning it is declared with low level, if there is motion detected, then it will change to high level, after that Arduino will send this information to google´s android cloud and we will receive the notification with the mobile phone with Newtifry that is connected to a google account.

In the section below there are all the applications that are used in this project:  

The first application called EvenGhost ( figure ), it is a home automation tool that allows some technologies to work together by providing them a platform to facilitate them to communicate with each other. With EventGhost you are able to create sets (macros) of tasks (actions) to perform. In that macro you would place the notification(s) (event) that you want to run that macro that contains the actions you wish to perform. The events that are displayed (triggered) can be generated by anything that has the ability to communicate. One of the features about EventGhost is that it is extensible, and has over 300 unique extensions (plugins) available. Some examples of devices that EventGhost is able to talk to are Yamaha, Denon/Marantz, Pioneer, Sony, Sonos, Samsung, RTI, Amazon Echo, MicasaVerde Vera, Phillips Hue, and many others. Supported automation protocols include but not limited to MQTT, IFTTT, TCP/IP, Serial (RS-232), CIR (IR remotes), X10, xAP, xPL. EventGhost can even automate tasks on the computer it is installed on. EventGhost is simple tool program for nowadays its only available for Microsoft Windows to personalise or automate. It normally used with different input devices like infrared, USB or wireless remote controls to run macros, that on their part control a computer and its attached hardware. For that reason, it can be used to control a computer with a normal consumer remote.

![](https://maker.wiznet.io/upload/ckeditor5/945076809%5F1666708807%2Ejpeg)

FIGURE . Evenghost Program.

The second application is called Newtifry (figure right), is an Android program and a server backend to deliver notifications to Android phones using the Google Cloud Messenger (GCM) APIs. This is designed to replace services like SMS messages, which would normally be used to send server notifications. The application delates the received messages periodically to free the space of the mobile phone. When you receives the notification the mobile phone will read for you the message that you have received.

The next one is Autoremote (figure left), is a powerful app allows a communication system designed for the devices to communicate, you can control one of your devices from another device, And with a Tasker plugin to send messages via AutoRemote, for the connection is necessary have a google account, it will provide you a personal URL. This URL is both used for registering your device with other devices, and for accessing AutoRemote’s web access. Opening the URL in a browser will present you with a page where you can send messages to your device, as well as instructions for accessing AutoRemote’s second personal code, the key, which is used for some parts of the AutoRemote system. After you access to the application, there is a menu to get into the list of registered devices. Here you can register a new device by using the personal URL of that device, and this way connect devices together. You’ll have to do this on both devices in order for both of them to be able to send messages to the other. Any devices registered in this list will be available as an option when you go to send a message.

![](https://maker.wiznet.io/upload/ckeditor5/1015659894%5F1666722264%2Ejpg)

FIGURE . Autoremote Application in Android Mobile Phone(left) and Newtifry Application

(right).

The last application used in this project is Tasker (figure ), is a paid automation application for Android that lets you trigger certain actions to be run if and only if certain conditions are met, performs tasks based on contexts like gestures, event, time.The idea is simple, assign an event to an action. It can be manual or automatic, Tasker monitors the phone for the contexts and performs tasks based on the contexts. The conditions are stored in profiles, profiles are connected to tasks that you want to run in response to any conditions you have chosen. One task can be formed with a group of actions, all the actions will run one after the others when the task is triggered. Furthermore, once a profile has been made, you can active or desactive it at any time without affecting any other profiles.

![](https://maker.wiznet.io/upload/ckeditor5/1015659894%5F1666722216%2Ejpg)

FIGURE . Tasker Application.

**CONCLUSION **

The home automation system has implemented successfully, this project discussed the designed modules like sensors circuits, mobile phone push notifications and web server. A several experiments have been carried out on the proposed automation system. These experiments show how to detect any intruder to the home sending a push notification to the tenant, detect the fire and the ambient weather of the room. In addition, helps people with reduced movement to be more independent and able to control their environment themselves. It also helps to reducing the power consumption because in the web server shows all the information of room’s light is turned on with mobile phone and turn it off easily.

To improve this implemented system, it could be added a watering system for the garden, first the humidity sensor detect the Soil moisture, there is a established percentage number, if it is lower than that, so the system will watering the garden. A voice control for all system, it could simplify the way of control system. Furthermore, for a better security of the house, there are another sensor and devices that can be used, for example, a monitoring camera. Moreover, you can replace the ethernet network connection with WIFI technology, Bluetooth or GSM module to make this system more professional, the connection won't need an ethernet cable to connect to the wire. On the other hand, there is the choice to do a smart garage that measure the length of the car and put it in the most suitable block to make the parking easy for the tenant in his garage.

There is no doubt that the automation system will make our life easier, this field is continuing to evolve, the number of customers are increasing and the manufacturers are creating and innovating products to better suit customers needs. However, there still has some serious hurdles to overcome before it reaches ubiquity.

---

Source: https://maker.wiznet.io/emimamanna/projects/development-of-a-home-automation-system-using-arduino/
