Final Report 10dep19f1042 PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 92

POLITEKNIK SEBERANG PERAI

HOME AUTOMATION(IoT)

AIDIL AFIQ BIN MUHAMED HANIF


(10DEP19F1042)

JABATAN KEJURUTERAAN ELEKTRIK

DECEMBER 2020
POLITEKNIK SEBERANG PERAI

HOME AUTOMATION(IoT)

AIDIL AFIQ BIN MUHAMED HANIF


(10DEP19F1042)

This report submitted to the Electrical Engineering Department in fulfillment


of the requirement for a Diploma in Electronic Engineering
(Communication).

JABATAN KEJURUTERAAN ELEKTRIK

DECEMBER 2020
DECLARATION OF ORIGINALITY AND OWNERSHIP

HOME AUTOMATION(IoT)

1. I’m, AIDIL AFIQ BIN MUHAMED HANIF (IC NO:0109120-07-0837) is a student of Diploma in
Electronic Engineering (Communication), Polytechnic Seberang Perai , which is located at
Jalan Permatang Pauh, 13500 ,Permatang Pauh ,Pulau Pinang.

2. I acknowledge that 'the Project above' and the intellectual property therein is the result of our
original creation /creations without taking or impersonating any intellectual property from the other
parties.

3. I agree to release the 'Project' intellectual property to 'The Polytechnic' to meet the requirements for
awarding the Diploma in Electrictronic Engineering (Communication) to me.

Made and declared ownership by; )


AIDIL AFIQ BIN MUHAMED HANIF ) ………………………
(IC Number : 0109120-07-0837) ) AIDIL AFIQ BIN
MUHAMED HANIF

In front of me, NORLIZAH BINTI ISMAIL( ) …………………………..


As a project supervisor, on the date:…………….. ) NORLIZAH BINTI
ISMAIL
ACKNOWLEDGEMENT

I would like to express my gratitude towards my project’s supervisor, Madam Norlizah Binti Ismail, for
all the guidance and time spent on us throughout the project.

I would also love to thank all who are involved, whether directly or indirectly, that has helped me
throughout the project.
ABSTRACT

The main objective of this project is to construct a home automation system using a ESP32 and

ESP32CAM, being remotely controlled by any Android OS smart phone. As technologies is advancing,

houses are also getting smarter. Modern houses are gradually changing from conventional switches to

centralized control system, involving remotely controlled switches. Nowadays, conventional wall switches

are located at different parts of the house, which makes it difficult for the user to operate them. It becomes

more difficult to the elderly or physically handicapped people to do so. Remote controlled home

automation system provides the most modern solution. In order to achieve this it will need a Wi-Fi

module which is the ESP32 and ESP32Cam and a GUI(Graphical User Interface) application on the cell

phone to send commands to the receiver where loads are connected. By touching at the specified location

on the GUI, the loads can be turned controlled remotely through this technology.
TABLE OF CONTENTS

CONFIRMATION OF THE PROJECT i


DECLARATION OF ORIGINALITTY AND OWNERSHIP iii
ACKNOWLEDGEMENTS iv
ABSTRACT v
TABLE OF CONTENT vi
CHAPTER 1: INTRODUCTION 1
1.1 Introduction 1
1.2 Project background 2
1.3 Problem statement 3
1.4 Project objectives 4
1.5 Project scope 4
1.6 Significance of project 5
1.7 Expected results 5
1.8 Summary 6
CHAPTER 2: LITERATURE REVIEW 7
2.1 Introduction 7
2.2 Previous research 9
2.3 Summary 9
CHAPTER 3: METHODOLOGY 10
3.1 Introduction 10
3.2 Project design and overview 11
3.2.1 Block diagram of the project 11
3.3 Project hardware 12
3.3.1 Schematic of the circuit 12
3.3.2 Description of main components 14
3.3.3 Circuit operation 2012
3.4 Project software 23
23
3.4.1 Flowchart of the project
3.4.2 Description of the flowchart 26
3.5 Prototype development 28
3.5.1 PCB 28
3.5.2 Physical layout of prototype 34
3.5.3 Software development of the project 39

3.6 Summary 53

CHAPTER 4: RESULTS AND DISCUSSION 541

4.1 Introduction 541


4.2 Troubleshoot 55 2

4.3 Results and discussion 563


56
4.3.1 Final structure of the project
4.3.2 Working of the Home Security System 58

4.3.4 Working of the Home Automation System 59

4.4 Summary 676


CHAPTER 5: CONCLUSION AND RECOMMENDATIONS 687
5.1 Introduction 687
5.2 Conclusion 698

5.3 Future recommendations 7010

REFERENCES 71

APPENDICES 72

Appendix 1: Gantt Chart 72

Appendix 2: Project Costing 73


74
Appendix 3: Program Coding
CHAPTER 1: INTRODUCTION

1.1 INTRODUCTION

Home automation seems to be a buzzing amongst the younger generations, allowing them to control their

household’s lights and so on with a connected device. It’s an easy and affordable way to control home and energy

consumption. For others, such as the elderly and disabled, home automation can be the answer to great independence

and peace-of-mind for them and their loved ones. When mobility is limited, taking care of simple tasks around the

house becomes more difficult. This project of mine mainly focuses on achieving a better version of home compared

to conventional house and in the same time, helping the elderly, disabled, handicapped people to manage their house

just at their fingertip.

1
1.2 PROJECT BACKGROUND

The Home Automation system idea has existed for many years. The terms like Smart Home, Intelligent

Home followed and has been used to introduce the concept of networking appliances and devices in the house.

Home automation systems represents a great opportunity in creating new fields in engineering. Home automation

includes control of lighting, appliances, security locks of gates and doors and other systems, to provide improved

comfort, energy efficiency and security system. Home automation systems becoming popular nowadays and enter

quickly in this emerging market. However, the users, especially the disabled and elderly due to their complexity and

cost, do not always accept these Home Automation systems.

Due to the advancement of wireless technology, there are different of connections are introduced such

as GSM, WIFI, and Bluetooth. Each of the connection stated has their unique specifications and applications.

Among the four popular wireless connections that often implemented in Home Automation project, Wi-Fi is being

chosen with its suitable capability. The capabilities of Wi-Fi is more than enough to be implemented in the design.

Moreover, most of the current laptop or Smartphone come with built-in Wi-Fi adapter. It will indirectly reduce the

cost of the system.

2
1.3 PROBLEM STATEMENT

There is a huge energy waste in the present situation of our country. Moreover, people becomes negligent to

proper utilization of available energy. Many often forget to turn of the light sources and home appliance before getting

out from home. Even in those situations, home automation makes it possible to control them from a distant place in

simplest way with our smartphone.

People are early and late running from place to place, working to accomplish everything on our never-ending to-do

list. Because of the Home Automation system, we never have to take tension about opening the door, switching off

the appliances and so on. In short we can save valuable time and experiences more daily productivity

Not only that , the global population aged 60 years or over numbered 962 million in 2017, more than twice as large as

in 1980 when there were 382 million older persons worldwide. The number of older persons is expected to double

again by 2050, when it is projected to reach nearly 2.1 billion. The world must be prepared to face the increasing

number of elderlies by giving them the facilities to live their life. Elderlies has lesser energy compared to youngsters

which limits them from doing most of the works single handedly. The elderly and the handicapped user faced problem

to manually access control of light. With this Home Automation system , we can help them by giving them the ability

to manage house at their fingertip .

3
1.4 PROJECT OBJECTIVES

The main objectives of our object are as follows:

- To control households like lights and much more by using a Wi-fi connected mobile device.

- To develop a home security system to cut down the risk of getting robbed.

- To monitor the house temperature, light intensity, and humidity on mobile phone.

1.5 PROJECT SCOPE

This project is focusing on home automation and home security system. This project involves a ESP32 and

ESP32CAM. The home automation will be build to be controlled by a WiFi connected mobile phone. This is

anticipated to manage the households almost from anywhere inside the house. The ESP32, ESP32Cam and other

parts of the circuit (relays, motors, sensors) will be strategically placed inside the house to avoid any unwanted

accidents. The mobile phone and the ESP32 and ESP32Cam should be connected under the same WiFi , if both

microcontroller and user mobile is connected on separate networks ,the home automation can’t be controlled

through mobile phone but still be working like a conventional house using manual switches. The project will be

completed within 14 weeks.

4
1.6 SIGNIFICANCE OF PROJECT

The research finding will contribute towards the economy by utilizing only those resources that are needed.

With this Home Automation system, it ensures the energy and resources are used necessarily while at home. The most

beneficial impact the system will have is on people’s monthly utility bill. No longer will be spending money for

household appliances left on in anyone’s absence. This is certainly convenient. The user will have complete control

to make sure costs are low without exerting any additional effort.

1.7 EXPECTED RESULTS

At the end of this study, it is expected to produce a Home Automation system as a replacement to the

traditional old way of managing the house and a better security system that would contribute to the safety of the

user’s life and the life of many.

5
1.8 SUMMARY

In conclusion, controlling appliances at the end of fingertip without much movement would be a desirable

home automation system to many of the peoples out there, especially to the elderly and disabled people. Besides that,

the Home Security System which comes together with the home automation system ,can be a very useful home

security system. It could definitely reduces the chances of being a victim of a burglary. Lastly, with this home

automation system, fire accidents could be kept away from the very early stage by alerting the owner and people

nearby. Wi-Fi is used as the communication channel between android phone and the ESP32 and ESP32CAM.

Hence, it can be concluded that the required goals and objectives of home automation system will be achieved. In the

next chapter, the literature review on the project will be presented.

6
CHAPTER 2: LITEATURE REVIEW

2.1 INTRODUCTION

Different approaches have been made towards home automation systems. An SMS based method used GSM

technology available in phones to communicate with a microcontroller which acts as the main controller to access

home appliances. A GSM module is also required to be joined to the microcontroller through a port to enable SMS

abililty. The disadvantage of such a system is that it is not user-friendly, as there is no graphical user interface(GUI),

and command codes must be recalled to operate the system. Another method focuses on voice recognition to send

commands through a wireless RF network. The voice commands is recorded using a microphone, digitalized, and sent

to a computer to be processed by a program. Upon recognizing the voice commands, control signals are sent to the

specified appliance address to be taken action on. However, the tested system was not always accurate in recognizing

voice commands that were sent . Hand gestures were also suggested as a control for home automation systems . A

small camera is wore as a necklace to watch the various gestures made by a user’s hand in order to deciphered and

send command signals. To use such technologies, it requires the use of a high-end PC to process data, which results

in a higher setup cost.

7
2.2 PREVIOUS RESEARCH

According to author P. J. Rani(2017)et al, The devices connected to the Arduino board can be controlled by

voice commands, eliminating the need to control using the application interface.

The disadvantage is that since a user defined NLP(Neuro Linguistic Programming) algorithm is used, there is a

chance the assistant will not be able to recognize commands properly.

According to author N. Vikram et al(2017), The system can be controlled directly from the Wifi module which

eliminates the need of using Arduino board, the command can directly be given by the user to the Wifi module to

control the appliances accordingly.

The disadvantage is that since the equipment that is used is from low cost, there can be numerous occasions where

you will encounter errors or technical difficulties.

According to author H. Singh. et al(2018), The Arduino is connected to the Bluetooth module, all the appliances

can be controlled using the Arduino but it needs to be within a small distance for it to connect to the Bluetooth.

The downside is that since Bluetooth module is used, the range where the home appliances can be controlled is

limited.

According to author Nagendra et al(2016), Wi-Fi technology was used to control the devices which uses an

application on your smart phone, the system can be controlled even remotely.

The drawback is that since a Wifi module is used, the application that is uilized to control the home appliances

needed to be connected to the internet at all times.

8
According to author Baby et al(2017) , A home automation system was developed that can be controlled by either

an web application or a Chabot.

The catch is that since a texting Chabot is used instead of a voice Chabot, the user will be needed to manually

type in the commands, which not only will consume more time, but is also will not be convenient to the user.

2.3 SUMMARY

From the research that have been done regarding this project, it can be concluded that many advantages and disadvantages were

outlined from the previous Home Automation systems. Considering all this aspects above, through this project, a perfect Home

Automation system will be produced to give the user the best experience they would ever have. In the next chapter , the

methodology for the project will be presented.

9
CHAPTER 3: METHODOLOGY

3.1 INTRODUCTION

Research methodology is the specific procedures or techniques used to identify, select, process, and analyze

information about a topic. The method is used to achieve the objective of the project that will contribute to a perfect

result.

10
3.2 PROJECT DESIGN AND OVERVIEW

3.2.1 BLOCK DIAGRAM OF THE PROJECT

Home Automation System

Power Relay 1

Relay 2
ESP32

TEMPERATURE Relay 3
LDR SENSOR

Home Security System

POWER

ESP32CAM

IR SENSOR

11
3.3 PROJECT HARDWARE

3.3.1 SCHEMATIC CIRCUIT

Home Automation System

12
Home Security System

13
3.3.2 DESCRIPTION OF MAIN COMPONENTS

3.3.2.1 ESP32 DEVKIT V1

The ESP32 DEVKIT V1 is one of the development board created to evaluate the ESP-WROOM-32

module. It is based on the ESP32 microcontroller that boasts Wifi, Bluetooth, Ethernet and Low Power support all in

a single chip. ESP32 is already integrated antenna and RF balun, power amplifier, low-noise amplifiers, filters, and

power management module. The entire solution takes up the least amount of printed circuit board area. This board is

used with 2.4 GHz dual-mode Wi-Fi and Bluetooth chips by TSMC 40nm low power technology, power and RF

properties.

SPECIFICATIONS:

Microcontroller: Tensilica 32-bit Single-/Dual-core CPU Xtensa LX6 UARTs: 3

Operating Voltage: 3.3V SPIs: 2

Input Voltage: 7-12V Flash Memory: 4 MB

Digital I/O Pins (DIO): 25 SRAM: 520 KB

Analog Input Pins (ADC): 6 Clock Speed: 240 Mhz

Analog Outputs Pins (DAC): 2 Wi-Fi: IEEE 802.11 b/g/n/e/i:

14
3.3.2.2 ESP32CAM

The ESP32-CAM has a very competitive small-size camera module that can operate independently as a minimum

system with a footprint of only 27*40.5*4.5mm and a deep sleep current of up to 6mA. ESP-32CAM can be widely used in

various IoT applications. It is suitable for home smart devices, industrial wireless control, wireless monitoring, QR wireless

identification, wireless positioning system signals and other IoT applications. It is an ideal solution for IoT applications. ESP-

32CAM adopts DIP package and can be directly inserted into the backplane to realize rapid production of products, providing

customers with high-reliability connection mode, which is convenient for application in various IoT hardware terminals.

FEATURES:

- The smallest 802.11b/g/n Wi-Fi BT SoC Module - Support image WiFI upload

- Low power 32-bit CPU,can also serve the application processor - Support TF card

- Up to 160MHz clock speed,Summary computing power up to 600 DMIPS - Supports multiple sleep modes

- Built-in 520 KB SRAM, external 4MPSRAM - Embedded Lwip and FreeRTOS

- Supports UART/SPI/I2C/PWM/ADC/DAC - Supports STA/AP/STA+AP operation

- Support OV2640 and OV7670 cameras,Built-in Flash lamp.

15
3.3.2.3 RELAYS

Relays are the switches which aim at closing and opening the circuits electronically as well aelectromechanically.

It controls the opening and closing of the circuit contacts of an electronic circuit. When the relay contact is open (NO), the

relay isn’t energize with the open contact. However, if it is closed (NC), the relay isn’t energize given the closed contact.

However, when energy (electricity or charge) is supplied, the states are prone to change.

SPECIFICATIONS:

• Rated load: 10A 250VAC/28VDC

• Coil resistance: 70 ohms

• Coil rated voltage: 3-48VDC

• Coil pick-up voltage: 5 VDC

• Coil Current: 71-90mA

16
3.3.2.4 DHT11 TEMPERATURE SENSOR

The DHT11 is a commonly used Temperature and humidity sensor that comes with a dedicated NTC to measure

temperature and an 8-bit microcontroller to output the values of temperature and humidity as serial data.

SPECIFICATION:

Operating Voltage: 3.5V to 5.5V

Operating current: 0.3mA (measuring) 60uA (standby)

Output: Serial data

Temperature Range: 0°C to 50°C

Humidity Range: 20% to 90%

Resolution: Temperature and Humidity both are 16-bit

Accuracy: ±1°C and ±1%

17
3.3.2.5 LDR SENSOR

Photoresistors, also known as light dependent resistors (LDR), are light sensitive devices most often used to indicate

the presence or absence of light, or to measure the light intensity. In the dark, their resistance is very high, sometimes up to 1

MΩ, but when the LDR sensor is exposed to light, the resistance drops dramatically, even down to a few ohms, depending on

the light intensity.

SPECIFICATION:

-Input Voltage: DC 3.3V to 5V

-Output: Analog and Digital

-Sensitivity adjustable

18
3.3.2.6 IR SENSOR

The IR sensor or infrared sensor is one kind of electronic component, used to detect specific characteristics in its

surroundings through emitting or detecting IR radiation. These sensors can also be used to detect or measure the heat of a target

and its motion. In many electronic devices, the IR sensor circuit is a very essential module. This kind of sensor is similar to

human’s visionary senses to detect obstacles.

SPECIFICATIONS:

• The operating voltage is 5VDC

• I/O pins – 3.3V & 5V

• Mounting hole

• The range is up to 20 centimeters

• The supply current is 20mA

• The range of sensing is adjustable

• Fixed ambient light sensor

19
3.3.3 CIRCUIT OPERATION

Home Automation System

There are two ways to power up the circuit, either by using a DC 5V/5A as an input signal or by connecting the

circuit with a AC 240V supply which will be converted to DC 5V by the HILINK 5V/5W.When the circuit is first powered-up,

it will initiate the ESP32 and powers up DHT11 Temperature Sensor, LDR sensor, and Relays. When the ESP32 receives its

VCC input, it will automatically look for the configured Wi-fi network that it should be connected. The blue light of the ESP32

will blink faster which indicates that the module is not connected to the Wi-fi network whereas when the blue light of the

ESP32 blinks slower, it shows that the module has been connected to the Wi-fi network. If there is a Wi-fi network, the ESP32

would be able to communicate with the device assigned for this home automation system. It would be able to send the real-time

feedback of the temperature using DHT11, humidity using DHT11 too, light intensity using LDR sensor and the current state of

the Relays (whether its in ON or OFF mode) to the device assigned for this home automation system through BLYNK app. The

Relays can be turned ON and OFF using the mobile phone assigned to this system.

20
Meanwhile, when the ESP32 is not connected to the Wi-fi network, it would be operating in manual mode where

the switches can be used to control the Relays to turn ON and OFF appliances at home. The downside of the manual mode of

this home automation system is that it won’t be able to update real-time feedback of the temperature, humidity, light intensity

and the current state of the Relays to the device that is assigned to this system. Not only that, the mobile device wouldn’t be

able to control the Relays when the system is in manual mode.

21
Home Security System

This circuit here only can be operated with DC 5V input. When the input is given to the circuit, it will initiate the

ESP32CAM and powers up the IR Sensor. After the ESP32CAM is initiated, it will look for the Wi-fi connection configured to

it. When the Wi-fi connection is there, the circuit will be operable. When someone stands before the door, it will be detected by

this IR sensor and hence it will trigger the ESP32CAM’s camera to capture the picture of the person standing before the door.

After it has captured a photo, it will send a notification to the mobile device of the owner with the photo attached to it. Then the

owner can decide either to open the door or not. Unfortunately, when the Wi-fi network is not there, this system would not be

online hence it will not work. It will still capture a photo of the person standing before the door but it won’t be sending

notifications to the mobile phone of the owner and the photo would not be stored because there is no storage provided for it.

22
3.4 PROJECT SOFTWARE

3.4.1 FLOWCHART OF THE PROJECT

Home Automation System

Start

Check if the owner


No pressed manual No
Wi-fi? buttons to turn on or
off Relays
(appliances)
Yes

Read and update to the


device the status of the Yes
Relays

Relay 1 or
Relay 2 or
Monitor and update the Relay 3?

temperature from the


DHT11 to the owner Relay 1
device
Turn Relay 2 Relay 3
On/Off
Relay 1
Monitor and update the
humidity from the DHT11
to the owner device
Turn
On/Off
Relay 2
Record and update light
intensity level from the
LDR to the owner device
Turn
On/Off
Relay 3

23
Check if the owner
No pressed virtual buttons
to turn on or off
Relays (appliances )
through the device

Yes
Relay 1
Relay 3 Turn
Turn Relay 1 or
Relay 2 or On/Off
On/Off
Relay 3? Relay 3
Relay 1

Relay 2

Turn
On/Off
Relay 2

24
Home Security System

Start

No
Wi-fi?

Yes

IR Sensor
triggered?

Yes

Capture
image

Send
notification
to owner
device with
the image

25
3.4.2 DESCRIPTION OF THE FLOWCHART

Home Automation System

As soon as the circuit is powered up, the ESP32 will look for the Wi-fi connection that it was assigned to be

connected to. If the Wi-fi connection is there, the ESP32 will connect to it. It will first update the information about

the current state of the Relays (appliances connected to Relays) whether it is in ON or OFF state. Next, it will record

the temperature of the surrounding through DHT11 Temperature Sensor and update the recorded value to the mobile

device of the owner. Not only that, it will also record the humidity level of the surrounding through DHT11 and update

it to the owner device. After that, the ESP32 will be monitoring the light intensity of the surrounding and update it on

the owner device. After all of this information updated to the owner’s device, the owner can choose to turn ON or OFF

the Relays by just tapping on the Relays icon displayed on the Blynk App on the owner’s device which acts as a virtual

button. This process will be repeating itself until the system is turned off. If the Wi-fi connection is not there, the

system will be running in manual mode where the owner can control the Relays to turn on and off appliances using

manual buttons.

26
Home Security System

When the system is powered up, the ESP32CAM will be searching for the Wi-fi connection it was programmed to

be connected to. If the Wi-fi connection is there, the ESP32CAM then checks if the IR Sensor is triggered. If someone

were to stand infront of the door, it will trigger this IR sensor and hence the ESP32CAM will capture the image of the

person and send a notification with the image captured by it. If there is no Wi-fi connection, the system will go offline

and not be working until it gets its Wi-fi connection.

27
3.5 PROTOTYPE DEVOLEPMENT

3.5.1 PCB

Firstly, the PCB layout were designed on a software called EasyEDA.

28
Next, the layout were printed and placed on the copper board so the copper board can be downsized to the size of the
PCB layout.

After that, the surface of the copper board is made shinnier with sand paper.

29
And then the dusts on the copper surface is cleaned off using Acetone.

Then the PCB layout that have been created with EasyEDA will be printed on glossy paper using Laser Printer.

30
Next, the PCB layout printed on the glossy paper will be transferred to the copper board using an Iron Box for about 10 minutes
at 200°C.

After that, the copper board were immediately placed into a container of cool water so that the design sticks onto the copper

board.

31
After two minutes of cooling down, the glossy paper is pulled off.

Then the copper board is placed in ferric chloride solution and be agitated until the board is completely etched (turns green).

32
Then, the holes were drilled before the toner on the PCB scratched off.

After that, by using a sand paper, the black toner on the board were scratched out so the copper trace can be seen.

Before the PCB was ready to be used, all the components were soldered onto the board so that it sticks and to make sure all the

components is connected to the connection line of the PCB board.

Finally, after all the steps above is done, the PCB was ready to use.

33
3.5.2 PHYSICAL LAYOUT OF PROTOTYPE

The walls of the prototype house will be 41x41. There are in total of 4 walls created with the same dimensions. A soft plywood

is used here as the material of the prototype.

34
One of the four walls have been chosen as the wall where the Home Security System will be attached to. The size of it is

15x9. The part of the wall that has been chosen for the Home Security System will be cut off and replaced by the Home

Security System with plywood on top and on the back of it, covering the cables and other part except the camera of ESP32CAM

and IR Sensor. This wall will be the entrance wall of the prototype house where the Home Security System will be in the door

of the house.

35
Then, another wall is chosen to place the Home Automation System onto of it. The size of the Home Automation System is

12x18. A plywood wood with the same size of the Home Automation System will be placed onto the Home Automation

System, so that the it hides all the cabling involved behind it. The plywood that was placed onto the Home Automation System,

will be cut off to allow the DHT11 Temperature Sensor and LDR Sensor to emerge into the house so that it can take reading of

the environment accurately while covering other parts and cables of the Home Automation System.

36
The Relays of the Home Automation System can be connected to any appliances which is operating with AC or even DC

supply. In this case, as there are 3 Relays, 3 lights will be connected to the Relays and be attached to walls of the prototype

house representing the lights or any appliances when it comes to the real-world situation. Each light was placed on each wall of

the prototype except on the wall that has the Home Automation System attached on it.

37
The prototype will look somewhat similar to the figure below:

The yellow box will be the door of the prototype house. It is also where the Home Security System will be in. Next, the red box

inside the house is where the circuit of the Home Automation System will be placed at. The DHT11, push buttons and LDR

sensor will be placed beside the Home Automation System circuit in the house. Then, that part of the wall, where the Home

Automation System circuit is placed, will be covered with another layer of soft plywood on top of it, so it covers all the

circuitry, cables involved for the project behind it. The cover will be precut off to allow the DHT11, push buttons, LDR sensor

to merge into the house. Other than that, the three LEDs in the diagram above represents the lights in the prototype. The lights

will be positioned in the prototype of the house at the same position as the LEDs are in.

38
3.5.2 SOFTWARE DEVELOPMENT OF THE PROJECT

HOME AUTOMATION SYSTEM

Firstly, a Blynk account is created at https://blynk.cloud/dashboard/login and logged in.

39
Next, a template has been created.

40
After that, the datastreams for all the components in the Home Automation System such as Relays, LDR Sensor and DHT11

Temperature Sensor were created. As shown below, the datastream for the first relay has been created.

The datastreams to turn ON and OFF for all the Relays were created first.

41
Then, a datastream to turn OFF all the Relays at once were created.

42
After all datastreams for the Relays are done, the datastream for DHT11 Temperature Sensor were created. As shown below,

the datastreams for temperature and humidity is created.

43
Finally, the datastream for LDR Sensor were created.

After all the steps above is done, now the Blynk app can be configured on the owner device.

First, the Blynk app were downloaded from Play Store.

44
Then, logged into the Blynk app using the same email address registered where the template were placed.

After that, logged into the Developer Mode, it’s the mode where the Home Automation System template that have been created

on the Blynk website is stored.

45
Next, the virtual buttons to control the Relays were added into the given space.

46
Right after that, a display gauge is used to merge the temperature datastream that were created.

Then, another display gauge is placed into the space to merge the humidity datastream created.

47
And finally, the last display gauge is placed into the space to merge the LDR datastream that have been created.

The final result were as below.

48
For the very last step, the coding for the Home Automation System would be uploaded with the following code attached on top

of the coding so that the ESP32 will straight connect to the owner’s Wi-fi network after the coding has been successfully

uploaded. (The coding are attached on the Appendix section)

49
HOME SECURITY SYSTEM

Firstly, the Blynk (legacy) app was downloaded.

Then, logged into the Blynk App using the same account created for Home Automation System. After logging in, an auth token

were sent to the email. The token were saved for later on purposes.

50
After that, went to create a new project and named it as “SecuritySystemAidil”.

Then, in the given space, an image gallery icon, a styled push button and a push notification were placed.

51
All the parameters for the icon and buttons were set as below.

The final result were as below.

For the very final step, the coding for Home Security System were uploaded into the ESP32CAM with the auth token written on

top of the coding.


52
3.6 SUMMARY

As a conclusion, every project will have different methodologies that is being used to make the project successful and

working well. In this chapter, everything about the project were described in detail. The schematic designs of the circuits, the

description of the main components such as ESP32, ESP32CAM, DHT11 Temperature Sensor, LDR, and IR Sensor were

presented. The working flow of the system were displayed through a created flowchart and the working of the system have been

explained in depth in the Flowchart Description section. Not only that, the making of PCB for this project from scratch were

unveiled at the PCB section under Prototype Development section. Every step of the making were recorded closely. The details

about the physical layout of the prototype discussed and showed at the Physical Layout of Prototype section. Finally, the

software development steps were also presented in this chapter. The gantt chart, the total cost to make create the whole project

and the coding related to the project are attached at the Appendix section. In the next chapter, the result and the discussion

regarding the result will be put on view.

53
CHAPTER 4: RESULTS AND DISCUSSION

4.1 INTRODUCTION

Technology has enabled peoples to automate numerous aspects in business. Now, it can be enjoyed within the four walls of

homes. Technology is allowing homeowners to run, manage and monitor their homes through their smart phones. Such homes

are known as automated or smart homes. Through automation, the owner can get the ability to control appliances in owner’s

home from any location with the touch of a button. It can control the lighting too. This allows the owner to ensure that the lights

and appliances are turned off when the owner is not home, to save on electricity. Meanwhile, smart home security system is

based on a vigorous internet integrated technology that works together with other smart home automation systems to provide

the advanced level of protection for its users at a designated premise. The security cameras are helpful for increasing the family

safety. These gadgets keep on monitoring and captures photos of people standing before the door at the specific time span of the

day or night whenever is prompted or programed. To get a clearer picture of this Home Automation System build in this

project, lets have a look on the results and the analysis related to it.

54
4.2 TROUBLESHOOT

Troubleshooting of an electronic circuit is a process of having a special outlook on components. The unexpected

behavior exhibited by the circuit maybe due to improper locating or soldering of components, component damage due to aging,

faults, overheat, and so on. Such a type of behavior can cause undesired results or even circuit damage. Therefore, these

unexpected results of the electronic circuit may require some troubleshooting and testing procedures for making it a ready to use

project. The best way to become proficient in troubleshooting, even to tackle difficult electronic problems is decided by hands-

on experience with the electronic circuits.

Earlier when the etching process was done, one important to-do thing were left out, which is the use of solder mask

to cover the copper traces. As the solder mask is not there, the copper traces started to oxidize (rusting) which was very

unfortunate. The rusting of the copper traces made the circuits to not be able to function as what it was supposed to be.

So to solve things back, the components on the PCB board were plugged out by heating the soldered point on the

legs of the components. As soon as the soldered point is heated, the components were plugged off the PCB board. Then, it was

transferred onto a donut board. All the components were arranged on top of it in such a way that the components like The

Relays, that will be dealing with AC 240V is arranged on the top right of the donut board meanwhile the components that will

run on DC 5V is arranged in quite a distance from The Relays to avoid any kind of interference caused by the high AC voltage

to the components running on DC 5V. After the components are arranged, the components were soldered onto the board. The

cables were used to connect components that are far from each other. After all of this were done, the cables involved in the

board were labelled to make the troubleshooting easier if there were to be any problem with the circuit in future. Finally, the

circuit was working fine, as how it was intended to be.

55
4.3 RESULTS AND DISCUSSION

4.3.1 FINAL STRUCTURE OF THE PROJECT

Front view of the prototype house

Top view of the prototype house

56
The push buttons and the sensors were placed side to side in the house

All the cables and the circuit responsible for the project were hided behind these walls as how it was mentioned in the previous

chapter.

57
4.3.2 WORKING OF THE HOME SECURITY SYSTEM

To test the working of the Home Security System developed, a polystyrene imitating a person in real life were placed before the

door of the house. As soon as the person approaches the house door, with the help of IR sensor, the Home Security System were

able to detect the person and sent a notification to the user’s phone with an image of people standing before the door attached

with it.

58
4.3.3 THE WORKING OF THE HOME AUTOMATION SYSTEM

Next, the working of the Home Automation System were tested. Initially, the bulbs were in ON condition.

The bulbs were turned off remotely through the Blynk App on user’s phone.

The first bulb was turned down by tapping the OFF button at SW1 on the Blynk App.

59
The second bulb was turned down by tapping the OFF button at SW2 on the Blynk App.

The final bulb, the 3rd bulb was turned off by tapping the OFF button at SW3 on the Blynk App.
60
The bulbs were also turned ON back by pressing the ON buttons on the Blynk App.

The first bulb get turned on by tapping the ON button at SW1 on the Blynk App.

The second bulb get turned on by tapping the ON button at SW2 on the Blynk App.

61
Finally, the last bulb get turned on again by tapping the ON button at SW3 on the Blynk App. Next, the push buttons that was

responsible to turn ON/OFF the bulbs manually were tested.

When the 3rd push button were pressed, the 3rd bulb get turned off and the state of the 3rd bulb were updated to the Blynk App.

62
When the 2nd push button were pressed, the 2nd bulb get turned off and the current state of the 2nd bulb were updated to the

Blynk App.

When the 1st push button were pressed, the 1st bulb get turned off and the current state of the 1st bulb were updated to the Blynk

App.
63
Then, the bulbs were turned on back using the push buttons manually.

When the 3rd push button were pressed, the 3rd bulb get turned on and the current state of the 3rd bulb were updated to the Blynk

App.

When the 2nd push button were pressed, the 2nd bulb get turned on and the current state of the 2nd bulb were updated to the

Blynk App.
64
Finally, when the 1st push button were pressed, the 1st bulb get turned on and the current state of the 1st bulb were updated to the

Blynk App. Next, LDR sensor were put into test.

When the surrounding is dark, the light intensity shows lower scale, which in this case, it displays it as 1. When the surrounding

is bright, it displays 10.

65
For the very final feature, the DHT11 which records the temperature and humidity level in the house were put into test. Initially,

the temperature shown in Blynk App were relatively close to the current temperature of the environment.

Then, to test the if the DHT11 really working well, fire were ignited close to the DHT11 to test if the temperature increases, and

the results shows increasing level of temperature until 40.2°.

66
When there is no Wi-fi connection, the push buttons were tested and it was working exactly the same as above except that the

user wasn’t able to control the lights remotely and the environmental information such as temperature reading, humidity reading

and the light intensity reading were not updated to the Blynk App. A point that should be remembered here is that this project

here works just like normal conventional houses when there is no Wi-Fi connection in the house. In order to fully utilize the

benefits of the project, the user should be able to give continuous Wi-Fi connection to this project

4.4 SUMMARY

In conclusion, in this chapter, all the results were presented successfully. All the problems were tackled with

troubleshooting. The Home Security System was able to capture an image of the person standing before the door and alerts the

user through the mobile phone by sending notification to the user with the image of the person standing before the door attached

with it. Next, the Home Automation System was able to work perfectly as how it was built for. The lights in the prototype house

were able to be controlled remotely through mobile phone. The environmental factors such as the temperature of the

surrounding, the humidity level and light intensity were able to be recorded and displayed on mobile phone through Blynk App.

Not only that, the push buttons that were integrated into the Home Automation System so that the lights can be controlled

manually were working fine too. The live feedback system works as planned. It updates its current state of the lights to Blynk

App incase the lights were controlled through push buttons. This will help the user to be alert of unswitched off appliances

around their home through the Blynk App. Finally, when there is no Wi-Fi connection available, the lights were able to

controlled through the push buttons provided but the user wont be able to control the lights remotely and the environmental

information wouldn’t be able to updated to the user until the Wi-Fi connection is there again.

67
CHAPTER 5: CONCLUSION & RECOMMENDATIONS

5.1 INTRODUCTION

Home automation makes life more convenient and can even save money on heating, cooling and electricity bills. Home

automation can also lead to greater safety with Internet of Things devices like security cameras and systems. Just like building

Rome, automating home can’t be done in a day. Rather, it can be started small and then build up home automation system over

time. With so many new IoT devices being put on the market every day, there’s truly no limit to what can be automated, making

life safer and more convenient than ever before.

68
5.2 CONCLUSION

The system ‘Home Automation’ makes the system more flexible and provides attractive graphical user interface compared

to other home automation systems. In this system, a mobile device is integrated into the home automation systems. A novel

architecture for a home automation system were proposed using a relatively new communication technologies . The system

consists of mainly five components, ESP32, ESP32CAM, DHT11, LDR, IR Sensor and Relays. Wi-fi is used as the

communication channel between the mobile phone and ESP32 and ESP32CAM. The complexity of the notions involved in this

home automation system is hided by including them into a simple, yet a comprehensive set of related concepts. This

simplification was needed to fit as much of the functionality in the limited space offered by a mobile device’s display. This

paper proposes a low cost, secure, remotely controlled solution. The approach presented in this paper is novel and has achieved

the target to control home appliances remotely using the Wi-fi technology to connect system parts, satisfying the user needs and

requirements. Wi-fi technology is a capable solution that has proved to be controlled remotely, provide home security and it is

cost effective as compared to the previously existing systems. Hence it can be concluded that the required goals and objectives

of home automation system have been achieved successfully. The system design and architecture were discussed, and a

prototype that presents a basic level of home appliance control and remote monitoring has been implemented. Finally, the

proposed system is better from the scalability and flexibility point of view than the commercially available home automation

systems.

69
5.3 FUTURE RECOMMENDATIONS

As the technology is evolving day by day, at one point in the future, maybe this aspects below can be considered and

integrated into this Smart Home.

1) These days, smart lighting is all the rage. They can be scheduled to turn on/off and change their intensity. However, in future,

it is possible for this to be taken a step further. With IoT enabled across the home, the lights can respond to other actions the

owner takes. For example, the lights can respond to home cinema. They can turn off or dim whenever the owner start watching

a movie. Going further, they may even react to the type of movie. For example, they can turn off completely if the lights sense

that the owner is watching a horror movie, giving owner the proper atmosphere.

2) In the future, doors can become smarter as well. Imagine doors opening only when the owner enter or close. This may be

made possible via a smart device or facial recognition. This can be taken to the next step by getting the rest of the house take

actions in tandem with the owner entry. For example, the lights can turn on as soon the owner enters through the door.

Alternatively, if the owner are leaving, they can turn off.

3) Windows can become smarter as well. Imagine them automatically open the shutters when the sun rises and close at sunset.

It may even be able to program them to close automatically when it rains. Consider the previous example of a home movie. The

curtains can lower whenever the owner are watching a movie.

4) These days, the owner can control home thermostat remotely via apps. In the future, it may not even need to do that. The

thermostat will be able to recognise if the owner are nearing home. It will then check the room and external temperature and set

the right one for the owner. It may even recognise when the owner are taking certain actions and adjust accordingly such as

when the owner are showering or exercising.

70
REFERENCES

1) P. J. Rani, J. Bakthakumar, B. P. Kumaar, and S. Kumar, "Voice controlled home automation system using Natural

Language Processing and Internet of Things," 2017 Third International Conference on Science Technology

Engineering & Management , Chennai, 2017, pp. 368-373.

2) N. Vikram, K. S Harish, M. S. Nihaal, R. Umesh and A. Kumar, "A Low Cost Home Automation System Using

Wi-Fi Based Wireless Sensor Network Incorporating Internet of Things (IoT)," 2017 IEEE 7th International Advance

Computing Conference (IACC), Hyderabad, 2017, pp. 174-178.

3) H. Singh, V. Pallagani and U. Venkanna, "IoT based smart home automation system using sensor node," 2018 4th

International Conference on Recent Advances in Information Technology (RAIT), Dhanbad, 2018, pp. 1-5.

4) P. S. Nagendra Reddy, K. T. Kumar Reddy, G. N. Kodanda Ramaiiah and S. N. Kishor, "An IoT based home

automation using android applications," 2016 International Conference on Signal Processing, Power and Embedded

System (SCOPES), Paralakhemundi, 2016, pp. 285-290

5) C. J. Baby and J. N. Swathi, "Home automation system using IoT and a chatbot using natural language processing,"

2017 Innovations in Power and Advanced Computing Technologies (i-PACT), Vellore, 2017, pp. 1-6.

6) https://www.espressif.com/en/products/socs/esp32

7) https://www.arducam.com/esp32-machine-vision-learning-guide/

71
APPENDICES

APPENDIX 1: Gantt chart

72
APPENDIX 2: Project costing

BIL THING QUANTITY PRICE


S
1. ESP32 DEVKIT V1 1 RM 33.00
2. JUMPER CABLE (MALE-FEMALE) 1 RM 5.00
3. JUMPER CABLE (FEMALE-FEMALE) 1 RM 5.00
4. BC547 TRANSISTOR 4 RM 4.00
5. ESP32-CAM 1 RM35.00
6. IR SENSOR 1 RM 4.00
7. 330 OHM ¼ WATT RESISTOR 10 RM 2.50
8. lN4007 DIODE 4 RM 15.00
9. LED 5MM 4 RM 1.40
10. RELAY 5V 4 RM 80.00
11. HI-LINK 5V CONVERTER 2 RM 30.00
12. LDR SENSOR 1 RM 5.00
13. DHT11 TEMPERATURE SENSOR 1 RM 9.00
14. PUSH BUTTON 5 RM2.00
15. TERMINAL BLOCK 10 RM2.50
TOTAL 40 RM234

73
APPENDIX 3: PROJECT CODING

#define BLYNK_TEMPLATE_ID "TMPL9lbdKQLv"

#define BLYNK_DEVICE_NAME "Home Automation System By Aidil"

#define BLYNK_FIRMWARE_VERSION "0.1.0"

#define BLYNK_PRINT Serial

//#define BLYNK_DEBUG

//#define APP_DEBUG

#include <DHT.h>

#include <IRremote.h>

#define IR_RECV_PIN 35 // D35 (IR receiver pin)

IRrecv irrecv(IR_RECV_PIN);

decode_results results;

#define DHTTYPE DHT11 // DHT 11

#define DHTPIN 16 //D16 pin connected with DHT

#define LDR_PIN 34 //D34 pin connected with LDR

// define the GPIO connected with Relays and switches

74
#define RelayPin1 23 //D23

#define RelayPin2 22 //D22

#define RelayPin3 21 //D21

#define RelayPin4 19 //D19

#define RelayPin5 18 //D18

#define RelayPin6 5 //D5

#define RelayPin7 25 //D25

#define RelayPin8 26 //D26

#define SwitchPin1 13 //D13

#define SwitchPin2 12 //D12

#define SwitchPin3 14 //D14

#define SwitchPin4 27 //D27

#define SwitchPin5 33 //D33

#define SwitchPin6 32 //D32

#define SwitchPin7 15 //D15

#define SwitchPin8 4 //D4

#define wifiLed 2 //D2

#define VPIN_BUTTON_1 V1

#define VPIN_BUTTON_2 V2

#define VPIN_BUTTON_3 V3

#define VPIN_BUTTON_4 V4

#define VPIN_BUTTON_5 V5

#define VPIN_BUTTON_6 V6

#define VPIN_BUTTON_7 V7

75
#define VPIN_BUTTON_8 V8

#define VPIN_BUTTON_C V9

#define VPIN_TEMPERATURE V10

#define VPIN_HUMIDITY V11

#define VPIN_LDR V12

// Relay State

bool toggleState_1 = LOW; //Define integer to remember the toggle state for relay 1

bool toggleState_2 = LOW; //Define integer to remember the toggle state for relay 2

bool toggleState_3 = LOW; //Define integer to remember the toggle state for relay 3

bool toggleState_4 = LOW; //Define integer to remember the toggle state for relay 4

bool toggleState_5 = LOW; //Define integer to remember the toggle state for relay 5

bool toggleState_6 = LOW; //Define integer to remember the toggle state for relay 6

bool toggleState_7 = LOW; //Define integer to remember the toggle state for relay 7

bool toggleState_8 = LOW; //Define integer to remember the toggle state for relay 8

// Switch State

bool SwitchState_1 = LOW;

bool SwitchState_2 = LOW;

bool SwitchState_3 = LOW;

bool SwitchState_4 = LOW;

bool SwitchState_5 = LOW;

bool SwitchState_6 = LOW;

bool SwitchState_7 = LOW;

bool SwitchState_8 = LOW;

76
float temperature1 = 0;

float humidity1 = 0;

int ldrVal;

#include "BlynkEdgent.h"

BlynkTimer timer2;

DHT dht(DHTPIN, DHTTYPE);

void readSensor(){

ldrVal = map(analogRead(LDR_PIN), 0, 4095, 10, 0);

float h = dht.readHumidity();

float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

if (isnan(h) || isnan(t)) {

Serial.println("Failed to read from DHT sensor!");

return;

else {

humidity1 = h;

temperature1 = t;

// Serial.println(temperature1);

// Serial.println(ldrVal);

77
}

void sendSensor()

readSensor();

// You can send any value at any time.

// Please don't send more that 10 values per second.

Blynk.virtualWrite(VPIN_HUMIDITY, humidity1);

Blynk.virtualWrite(VPIN_TEMPERATURE, temperature1);

Blynk.virtualWrite(VPIN_LDR, ldrVal);

//BLYNK_CONNECTED() {

// // Request the latest state from the server

// Blynk.syncVirtual(VPIN_BUTTON_1);

// Blynk.syncVirtual(VPIN_BUTTON_2);

// Blynk.syncVirtual(VPIN_BUTTON_3);

// Blynk.syncVirtual(VPIN_BUTTON_4);

// Blynk.syncVirtual(VPIN_BUTTON_5);

// Blynk.syncVirtual(VPIN_BUTTON_6);

// Blynk.syncVirtual(VPIN_BUTTON_7);

// Blynk.syncVirtual(VPIN_BUTTON_8);

// Blynk.syncVirtual(VPIN_TEMPERATURE);

// Blynk.syncVirtual(VPIN_HUMIDITY);

// Blynk.syncVirtual(VPIN_LDR);

//}

78
// When App button is pushed - switch the state

BLYNK_WRITE(VPIN_BUTTON_1) {

toggleState_1 = param.asInt();

if(toggleState_1 == 1){

digitalWrite(RelayPin1, LOW);

else {

digitalWrite(RelayPin1, HIGH);

BLYNK_WRITE(VPIN_BUTTON_2) {

toggleState_2 = param.asInt();

if(toggleState_2 == 1){

digitalWrite(RelayPin2, LOW);

else {

digitalWrite(RelayPin2, HIGH);

BLYNK_WRITE(VPIN_BUTTON_3) {

toggleState_3 = param.asInt();

if(toggleState_3 == 1){

digitalWrite(RelayPin3, LOW);

79
else {

digitalWrite(RelayPin3, HIGH);

BLYNK_WRITE(VPIN_BUTTON_4) {

toggleState_4 = param.asInt();

if(toggleState_4 == 1){

digitalWrite(RelayPin4, LOW);

else {

digitalWrite(RelayPin4, HIGH);

BLYNK_WRITE(VPIN_BUTTON_5) {

toggleState_5 = param.asInt();

if(toggleState_5 == 1){

digitalWrite(RelayPin5, LOW);

else {

digitalWrite(RelayPin5, HIGH);

BLYNK_WRITE(VPIN_BUTTON_6) {

toggleState_6 = param.asInt();

80
if(toggleState_6 == 1){

digitalWrite(RelayPin6, LOW);

else {

digitalWrite(RelayPin6, HIGH);

BLYNK_WRITE(VPIN_BUTTON_7) {

toggleState_7 = param.asInt();

if(toggleState_7 == 1){

digitalWrite(RelayPin7, LOW);

else {

digitalWrite(RelayPin7, HIGH);

BLYNK_WRITE(VPIN_BUTTON_8) {

toggleState_8 = param.asInt();

if(toggleState_8 == 1){

digitalWrite(RelayPin8, LOW);

else {

digitalWrite(RelayPin8, HIGH);

81
BLYNK_WRITE(VPIN_BUTTON_C) {

all_SwitchOff();

void all_SwitchOff(){

toggleState_1 = 0; digitalWrite(RelayPin1, HIGH); Blynk.virtualWrite(VPIN_BUTTON_1, toggleState_1);

delay(100);

toggleState_2 = 0; digitalWrite(RelayPin2, HIGH); Blynk.virtualWrite(VPIN_BUTTON_2, toggleState_2);

delay(100);

toggleState_3 = 0; digitalWrite(RelayPin3, HIGH); Blynk.virtualWrite(VPIN_BUTTON_3, toggleState_3);

delay(100);

toggleState_4 = 0; digitalWrite(RelayPin4, HIGH); Blynk.virtualWrite(VPIN_BUTTON_4, toggleState_4);

delay(100);

toggleState_5 = 0; digitalWrite(RelayPin5, HIGH); Blynk.virtualWrite(VPIN_BUTTON_5, toggleState_5);

delay(100);

toggleState_6 = 0; digitalWrite(RelayPin6, HIGH); Blynk.virtualWrite(VPIN_BUTTON_6, toggleState_6);

delay(100);

toggleState_7 = 0; digitalWrite(RelayPin7, HIGH); Blynk.virtualWrite(VPIN_BUTTON_7, toggleState_7);

delay(100);

toggleState_8 = 0; digitalWrite(RelayPin8, HIGH); Blynk.virtualWrite(VPIN_BUTTON_8, toggleState_8);

delay(100);

Blynk.virtualWrite(VPIN_HUMIDITY, humidity1);

Blynk.virtualWrite(VPIN_TEMPERATURE, temperature1);

Blynk.virtualWrite(VPIN_LDR, ldrVal);

82
void setup()

Serial.begin(115200);

pinMode(RelayPin1, OUTPUT);

pinMode(RelayPin2, OUTPUT);

pinMode(RelayPin3, OUTPUT);

pinMode(RelayPin4, OUTPUT);

pinMode(RelayPin5, OUTPUT);

pinMode(RelayPin6, OUTPUT);

pinMode(RelayPin7, OUTPUT);

pinMode(RelayPin8, OUTPUT);

pinMode(wifiLed, OUTPUT);

pinMode(SwitchPin1, INPUT_PULLUP);

pinMode(SwitchPin2, INPUT_PULLUP);

pinMode(SwitchPin3, INPUT_PULLUP);

pinMode(SwitchPin4, INPUT_PULLUP);

pinMode(SwitchPin5, INPUT_PULLUP);

pinMode(SwitchPin6, INPUT_PULLUP);

pinMode(SwitchPin7, INPUT_PULLUP);

pinMode(SwitchPin8, INPUT_PULLUP);

//During Starting all Relays should TURN OFF

digitalWrite(RelayPin1, HIGH);

83
digitalWrite(RelayPin2, HIGH);

digitalWrite(RelayPin3, HIGH);

digitalWrite(RelayPin4, HIGH);

digitalWrite(RelayPin5, HIGH);

digitalWrite(RelayPin6, HIGH);

digitalWrite(RelayPin7, HIGH);

digitalWrite(RelayPin8, HIGH);

irrecv.enableIRIn(); // Enabling IR sensor

BlynkEdgent.begin();

dht.begin();

// Setup a function to be called every 2 seconds

timer2.setInterval(2000L, sendSensor);

void loop() {

BlynkEdgent.run();

manual_control(); //Manual Switch Control

ir_remote(); //IR remote Control

timer2.run();

84

You might also like