Title

Title: Automated Home Security System Utilizing Microcontrollers
Name: Derrell Joshua David
Identification Number: 79772
Statement of Award: This Report is Submitted in Partial Fulfillment of Requirements for the Diploma in Electrical Electronic Engineering
Department: Electrical Electronic Engineering
University: The University of Trinidad and Tobago
Supervisor: Glen Joseph
Submission Date: 08/03/2018
Declaration
We, the undersigned students, declare that the work contained in this report is the result of our own study and is free from plagiarism.
The contributions to the project by each student are as follows:
Student Name Student ID Contribution Signature
Derrell David 79772 100% Final Year Project Abstract
Homeowners have always been faced with the fear of losing their sense of security due to accidents such as fires or even theft and break in. As such home security has become high in demand. Advancements in technology have been the one to answer the call and assist in alleviating these fears. Technology through the implementation of microcontrollers has provided us with the solution in terms of home security as it provides a system that is based on security, convenience, and affordability.

The project aims to design a home security system based on microcontrollers, specifically the Arduino microcontroller as it relates to this project. This project module includes a motion sensor and another sensor to monitor both the changes in temperature and motion, and an alarm system. The automated system is controlled by a password encrypted system which incorporates a keypad and LCD display that enables and disables the entire home security system. The driving force of this system includes an Arduino Mega 2560 as the microcontroller, a PIR Motion Sensor, and a DHT11 Temperature and Humidity Sensor.

Through the design and implementation of this project, it can be seen that this system offers a cost effective, readily available and highly reliable system which rivals current home security systems. It also displays the scope and how adaptive a microcontroller system can be, in that it operates many different tasks without fail and is only limited to certain hardware restraints and lack of human knowledge or creativity. Although the Arduino Microcontroller is made readily available to the masses it also comes with a learning curb, in that those who intend to incorporate any type of microcontroller systems needs to be educated in basic coding and electrical and electronic knowhow.

Table of Contents
Title
Declaration Page
Abstract
List of Tables
List of Figures
Introduction
Literature Review
Model Development
Results and Discussion
Conclusion
Bibliography
Appendices I
Appendices II
Appendices III
Appendices IV

List of Tables
Table 1. Illustrating Building Components of the Home Security System
Table 2. Showing the features of a Basic Home Security System compared to the Arduino Based Security System
Table 3. Describing Various Components in the Arduino based Home Security System
List of Figures
Figure 1. Illustrating Flow Diagram of the Arduino based Home Security System
Figure 2. Illustrating Circuit Diagram for Connecting a Keypad to Arduino board
Figure 3. Illustrating Circuit Diagram for Connecting a LCD Display to an Arduino board
Figure 4. Illustrating Circuit Diagram of a PIR sensor Connected to an Arduino board
Figure 5. Illustrating Circuit Diagram of a DHT11 Temp. & Humidity sensor Connected to an Arduino board and LCD Display
Figure 6. Illustrating Circuit Diagram of a LED Connected to a resistor and an Arduino board
Figure 7. Illustrating Circuit Diagram of a Buzzer Connected to an Arduino board
Introduction
Throughout the past years issues of home security has always been in the forefront of every homeowner’s mind. According to studies taken place in the country of Trinidad and Tobago, some of the techniques utilized to combat the issue of home security are, installing a burglary alarm (22%), keeping a “trained dog” (17%), keeping lights on a night (39%), and installing security locks (38%) 1. Installing a security system is the most effective form of defense as it relates to household security but as it can be seen, it is not the most popular technique utilized by homeowners.
Over the years various forms of home security systems has been utilized, such as a PC-based home security system, wireless alarm system and transmitter-based home security systems to name a few. These systems provide its owners with basic features such as a control panel, access monitors, a siren and a keypad and some opt for more advanced features such as smoke detection systems, glass break detectors and motion detectors. All these features are considered since home security doesn’t only entail protection against burglary or theft but also the protection of your entire home 2. Most of these features are what all home owners sought after, as it provides its owner with a reasonable amount of security, but this comes at an extremely higher cost.

This project seeks to provide an alternative security system that competes with other existing forms of security and comes at an economically affordable cost, and as such to demonstrate how microcontrollers (specifically Arduino based controller) can be integrated into a home security system. A microcontroller board such as an Arduino controller is a device which is capable of storing a program and running it. It receives the sensory signals, processes them, and then activates them, and then activates and controls the actuator devices, which are devices such as alarms, speakers, locks, and switches 3.

The history of Arduino began in 2005, when the founders Massimo Banzi and David Cuartielles wanted to make a device that would be easy to program by non-experts, so that their students in design could build projects that used microcontrollers. The Arduino platform was created to be not only about the boards and the microcontrollers, but also as a complete hardware and software ecosystem that made the life of the user much simpler compared to other microcontroller solutions 4.

This project module consists of some of the basic features of the above mention home security systems such as a keypad, a siren/buzzer, a control panel and some advance features such motion sensor all of which can be easy installed. Thus, developing and implementing an automated home security system that monitors and indicates when there is a fire or apparent break-in using a microcontroller (Arduino). The reach in which this project can extend to is that of implementation into industrial and business settings as well in that these areas demand increased levels of security one in which this system can easily provide.

Literature Review
Background
Home security systems and the advancements in the technology backing these systems have forever been changing and improving over the past years. Through the midst of all these technologies, the microcontroller has been the one form of technology that has either been central to these systems or in some way or form involved. Years ago, home security systems were only made available to those with rich homes and those with the means to afford it 2, but with the arrival of microcontrollers this system could be made available to wider demographics due to advantages such as low cost, open design, ease of assembly, and the ability to adjust to a specified parameter 3.

Microcontrollers are used to process information from the natural word, decide a course of action based on the information collected and then issue control signals to implement the decision 5. Because of this the microcontroller is equipped with the input and output pins in that it inputs a signal and outputs a result. The basis of a home security system depends on similar processes in that inputs such as keypads and sensors produce outputs in the form of alarms, LED etc. This system monitors all specified input (sensors) and once it picks up a signal the microcontroller unit sounds the alarm system.

Prior Technologies Utilized
Previous home security systems that were utilized incorporated a variety of different technologies and techniques to accomplish its task. A system which comprises of a main station having a central control unit which monitors a plurality of intruder sensors positioned in one or more security zones throughout the home is one example of a previously existing system 6. Comparing this system to that of a microcontroller-based system various advantages and disadvantages needs to be considered. The main advantage of this system over that of a microcontroller security system is that it is susceptible to less false alarms. The disadvantages of this system are the complexity and build requirements that is needed for this system.

Another system that has been incorporated as a home security system is one which relies on an infrared (IR) sensor and transmitter, the invention senses an intrusion by the reception of abrupt changes in IR levels as sensed by an IR receiving diode. Once the intrusion has been detected, and the silicone-controlled rectifier (SCR) is triggered, the IR receiving diode supplies electrical energy activating a transmitter and a timer 7. This system works well as a standalone system but compared to others it lacks a variety of features opposed to the microcontroller and main station-based systems.
Integrated security system which allows it user to wirelessly interface with and control security systems from within a home or business and extend such control and interface to remote devices outside the premise is another technique that has been utilized in home security systems, one in which Marc Baum and his team proposed 8. This system as with the others came with its own individual strengths and weaknesses. An advantage of this system is that it offers something that has not yet been introduced from the different technologies looked at and that is the ability to remotely interface and operate with the home security system off site. This comes as a major advantage as it offers the same level of security but also comes with a mean of alerting its users of alarms and such and allows them to react appropriately. The more complex the system the more expenses are required, and this comes as a disadvantage.

Prior Microcontroller Based Technologies Utilized
Previously we briefly looked at other technologies that has been utilized as home security systems, similarly this section would be allocated to looking at microcontroller-based home security systems and its advantages and drawbacks which comes with the system. N. David and his team designed a “Home Control and Environmental Monitoring System” which employs an embedded micro web server in Arduino Mega 2560, with IP connectivity for accessing and controlling devices and appliances remotely 9. This is a low cost and flexible system that can be remotely interfaced with using web application, but where it differs and falls short is that it requires a certain level of knowledge when it comes to web application, in that the setting up this feature might be challenging to those who are not familiar to this technology.

V. Sathya Narayanan and S. Gayathri designed a “Wireless Home Automation and Security System Using PIC Microcontroller” named IHAM (Intelligent Home Automation System). This system is developed using PIC microcontroller with ZigBee wireless communication technology, speech recognition technique and GSM network technology that control the home appliance 10. This system incorporates voice commands, which is used to control all lights and electrical appliances in a home or office. This system also has a security system for fire hazards, which alerts the user through a GSM module which allow for a SMS to be sent to the user alerting them of the hazard. The advantage of incorporating a feature such as voice recognition targets person who are differently able or elderly in which little to no effort is needed to control the entire system.
M. Shweta and team designed an “Arduino Based Wireless System for Temperature and Humidity Monitoring”, the system was developed on the ATmega328 microcontroller and utilizes a DHT11 Temperature and Humidity sensor which is used to collect data pf ambient temperature and humidity the process data is then transmitted through a wireless transceiver module. He results is then communicated on an LCD 11. The system also is set up in a manner that once a set temperature is reached a buzzer is set off, this forms the basis of a temperature monitoring system which is utilize in home security systems. The system offers all these features at low cost and provides a low power intensive system with real time and accurate capabilities. The drawback of this system that it suffers from misreading’s done by the sensors which can lead to false alarms.

Lastly a report carried out by Sujoy Kumar Saha and team introduced a “Smart Home Security System” that is a GSM (Global System for Mobile Communications) based device control, gas leakage monitoring, and home security system. The project proposed by this group aimed to provide a system that detects the presence of any unauthorized personnel using a PIR sensor and offers monitor and control of the parameter Temperature and Gas Leakage. The entire system also operates in a manner in that when one of the sensors are triggered an alarm and a call to a predefined number through a GSM modem is activated 12. The system can provide advantages to users in that it is a simple system to create and operate, in terms of industrial application it can be used to indicate or alert users of machinery failure or if someone is coming into proximity to it for example and it is a very reliable system. A disadvantage is one that this system shares with its counterparts is that it is susceptible to false alarms in that the sensors can be a bit too sensitive and result in a false alarm.
Objective
The primary objective of this project is to demonstrate how microcontrollers can be fully integrated into a home security system and act as the brains of the system whilst providing features that compete with existing security systems and in doing so display the wide and almost endless capabilities of a microcontroller.

Scope
The scope of this project can be narrowed into strictly designing a system which acts as a catalyst to display the capabilities of a microcontroller, in this case a home security system equipped with sensors, alarms, and indicating displays is utilized. The system should also act and operate in a way that competes and even outperforms existing home security systems. The project is not intended or aimed at reinventing microcontrollers or microcontroller-based security systems.

Model Development
The project is centered around building a home security system that competes with other existing systems in that it offers similar features such as a control panel, access monitors, a siren and a keypad and more advanced features such as temperature sensor and motion detectors. To accomplish this, a microcontroller (specifically an Arduino based) Mega2560 R3 was utilized to operate as the brains of this project. Amidst the wide variety of available Arduino microcontrollers such as Arduino/ Genuino Uno and Arduino Nano, the Arduino Mega 2560 was best suited for this project in that not only did it have the required processing power but also the memory and input/output pins necessary for such a multi-faceted system.
Connected to the Mega 2560 is a set of sub-systems that form the basis of the entire system. One of the first sub-systems that are connected to the microcontroller is a keyboard system; this is connected to the input pin section of the microcontroller board and acts as means of inputting a password, as the system is password protected and allows for the activation and deactivation of the alarm system. The second sub-system works in combination with the first and forms a complete system feature which is the control panel; this sub-system is the LCD display. The LCD display is connected to the output pins of the microcontroller and acts as a means displaying relevant information such as whether the system is armed or disarmed etc.
The following sub-systems include two sensors, one of which is a temperature and humidity sensor and the other is a motion sensor. Both were connected to the input pins of the microcontroller and act as a means of detecting changes in temperature and motion, the DHT11 Temperature and Humidity Sensor was utilized for the latter and a PIR sensor for the former. Lastly the remaining sub-systems that combine to make up the entire security systems can be labeled as the indicating/ alarm system in that both LEDs and Buzzers connected to the microcontroller through this section, both being connected to the output pins. This final set of sub-systems acts as a means of indicating to the user that an alarm has been raised.
All the sub-systems come together to form the home security system and it operates as follows, the control panel which consist of the Keyboard and LCD panel indicates to its user whether it wants to “Activate” the system or to “Change the Password”, once activated a signal is sent to the microcontroller board which engages the PIR motion sensor and the DHT11 Temperature and Humidity sensor. The Passive Infrared (PIR) responds to heat emitted from a body, and when it senses this heat the sensor will go HIGH, thus indicating that motion is detected which triggers the alarm system which includes the LEDs (specially a yellow LED) and the Passive Buzzer. The DHT11 operates in a more complex manner but basically serves the same purpose as the previous sensor; this sensor however is calibrated with a digital signal output. By using this exclusive digital- acquisition technique and temperature ; humidity sensing technology accurate and reliable readings can be acquired 12. A range is set through the microcontroller and once that range is exceeded the alarm triggers similarly to that of the motion sensor, the red LED is lit, and the active buzzer goes off.
After the alarm is set off a password is required to be entered to disarm the system thus making up the entirety of the system. The entire system not only relies on the above-mentioned hardware but also software as well. The software utilized was called Arduino Integrated Development Environment (IDE) which allows the user to write programs and upload them to the board 12. The table below displays all the components that we present in the building process of creating a home security system.

Components Utilized
Hardware Software
Arduino Mega2560 R3
Arduino IDE
1602 LCD 9V Battery Clip 9V Battery
DHT11 Temperature and Humidity Sensor
5V Active Buzzer
16R Passive Buzzer
PIR Motion Sensor
USB Cable
Mini Breadboard
5mm Green LED
5mm Red LED
1 pcs 5mm Yellow LED
Female to Male Jumper Wires
Male to Male Jumper Wires
4×4 Matrix Keypad
10k potentiometer
PC/Laptop Table 1. Illustrating Building Components of the Home Security System
System Operation Flow Diagram
The proposed system architecture design is displayed in the figure below it and it illustrates how each component interacts with each other. The Arduino Mega 2560 acts as the brains of the entire system which handles all the inputs coming in from the sensors and keypad whilst all the information is outputted in the LCD and alarm system which comprises of both indicating LEDs and alarm buzzer.

Figure 1. Illustrating Flow Diagram of the Arduino based Home Security System
Component Picture Description
Arduino Mega 2560 The Arduino Mega 2560 is a microcontroller board based on the ATmega2560. It has 54 digital input/output pins (of which 15 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller.

PIR Motion Sensor PIR (Passive Infrared Detection) are used to detect motion of human movement
DHT11 Temp. ; Humidity Sensor A unique capacitive sensor element measures relative humidity and the temperature is measured by a negative temperature coefficient (NTC) thermistor. It has excellent reliability and long term stability.
LCD 1602 Display This is a 16 character by 2 line LCD display with Blue background and White backlight. This LCD is ready-to-use because it is compatible with the Arduino Liquid Crystal Library. To use this with your Arduino you must have six free digital pins
4×4 Matrix Keypad This 16-button keypad provides a useful human interface component for microcontroller projects.

LEDs Stands for “Light-Emitting Diode.” An LED is an electronic device that emits light when an electrical current is passed through it. Early LEDs produced only red light, but modern LEDs can produce several different colors, including red, green, and blue (RGB) light. Recent advances in LED technology have made it possible for LEDs to produce white light as well.

Buzzer A buzzer or beeper is an audio signaling device. As a type of electronic buzzer with integrated structure, which use DC power supply, are widely used in computers, printers, photocopiers, alarms, electronic toys, automotive electronic equipment, telephones, timers and other electronic products for voice devices. Buzzers can be categorized as active and passive buzzers (See the following pictures).

Table 3. Describing Various Components in the Arduino based Home Security System Results and Discussion
This projected resulted in the creation of a system based on the Arduino Mega 2560 board accompanied with the components listed in Table 3, which was utilized to create a home security system capable of detecting motion when activated this feature acts burglary and theft preventative measure. The system is also equipped with a temperature and humidity sensor feature which acts as a means of detecting change in temperature and then indicates through an alarm system that the temperature has passed a defined range. Although the hardware aspect is mostly prevenient within this study the significance of the software utilized is equally important in that it literally instructs the entire system on how each component is expected to operate.
The project however aimed to create a system that rivals existing security systems and as such it resulted in these key features being implemented in the creation of this system. Features which include a control panel, keyboard, siren and sensors make up the core of this entire system. Most of these features were intended to be used together and as such they are examined and explored upon below.

Control Panel ; Keyboard
This feature consists of the Arduino Mega 2560 microcontroller which acts as the means of transmitting signals back and forth and utilizes the Keyboard and LCD display to properly view and input various defined commands. The LCD was connected The LCD was connected to the Arduino board through Analog Pins A0-A5 whilst the Keyboard was connected to the Digital Pins 1-8. The following circuit diagrams displays how this was achieved.

Figure 2. Illustrating Circuit Diagram for Connecting a Keypad to Arduino board

Figure 3. Illustrating Circuit Diagram for Connecting a LCD Display to an Arduino boardSiren ; Sensors
This feature comprises of the sensors such as the PIR sensor and the DHT11 Temp. and Humidity sensor but also all existing alarm systems which include buzzers and LEDs. The sensors act as the monitoring aspect of the system in that it constantly monitors any deviation from a defined variable, such as a raise in temperature or motion. The PIR sensor connects to the Digital Pin of the Arduino board, in this case Pin 22 and the remaining pins went to ground and 5V supply. Similarly, the DHT11 Temperature and Humidity sensor follows the same connection as the PIR sensor but instead utilizes pin 28 on the Arduino board.

Figure 4. Illustrating Circuit Diagram of a PIR sensor Connected to an Arduino board

Figure 5. Illustrating Circuit Diagram of a DHT11 Temp. ; Humidity sensor Connected to an Arduino board and LCD Display
The LEDs are connected to the Arduino board on Pins 10 and 11 respectively and both are coupled with 1K resistors on the negative lead. The buzzers, one passive and the other active are connected in a similar manner. The Passive Buzzer is connected to Pin 24 of the Arduino board and the Active Buzzer is connected to Pin 30 of the Arduino board, both Buzzers were ground off. The resulting connections can be referred to in Figure below.

Figure 6. Illustrating Circuit Diagram of a LED Connected to a resistor and an Arduino board

Figure 7. Illustrating Circuit Diagram of a Buzzer Connected to an Arduino board
Arduino Software
Accompanied with the hardware, the Arduino Integrated Development Environment IDE software works hand in hand as it provides the means of communication between the Arduino board and the various hardware features that were looked at above. The Arduino IDE software makes it easy to write code and upload it to the board. It runs on Windows, Mac OS X, and Linux. 14. Following the steps laid out on the Arduino website, each of the features such as control panel, keyboard, siren and sensors resulted in the accompanied code that can be viewed within the Appendices section.

The resultant features of the Arduino based home security system is not the only aspect that can be derived from the implemented system. Through the building and creation of this home security system key attributes were defined and looked at some of which explored in detail in the following below.
Open Source
The Arduino microcontroller is an open sourced electronic based platform which offers both hardware and software customization. These customizations offer its users with the ability to edit, create and modify both hardware and software to suit their specific needs. Not only is customization a major selling point but the accessibility at which the Arduino microcontroller offers is second to none, in that it provides its users with access to not only a while variety of different hardware pieces that suit different application but also accompanied with the software it provides its users with access to a library of codes and programs that previous makers such students, hobbyists, artists, programmers, and professionals have created.

Level of Security
The system that is being put forward in this project seeks to provide security to homeowners not only as it relates to theft and burglary but also in the case of house fires as well. Because of this this system utilizes both motion sensors and temperature sensor to combat these two security issues. Components accompanied with these sensors are a control panel which includes an LCD display and a Keyboard and some LEDs and Buzzers which acts as an alarm system. The features offered within this system can be compared with that of basic home security system in the table below.

Features Offered Basic Home Security System Arduino Based Security System
Control Panel
Keyboard
Siren
Access Monitor
Motion Sensor
Temperature/ Smoke Sensor
Video Monitoring
Table 2. Showing the features of a Basic Home Security System compared to the Arduino Based Security SystemLevel of Accuracy
The main components utilized for this project other than the Arduino Mega 2560 were the two sensors which were the PIR motion sensor and the DHT11 Temperature and Humidity sensor. Various simulated test, with the aid of the Arduino IDE software were carried out to test each sensor’s reliability. The PIR sensors which responds to heat as a means of detecting motion falls short in that the consistency in which it does detect motion is a bit underwhelming, due to a delayed and highly unreliable response time. The DHT11 Temperature and Humidity sensor on the other hand seemed to be much more reliable in that it constantly detects the surrounding temperature and humidity and using the Arduino IDE software the frequency and consistency in which this sensor reads the surrounding temperature and humidity can be monitored. It is important to note that a fault in the programmers coding can be a factor in how each of these sensors operate. The results of each simulated test can be view below.
DHT11 Simulation
The simulation was achieved by utilizing the Arduino IDE software which has a “Serial Monitor” option which displays serials sent from the Arduino board over USB or serial connector 14, which acts as the perfect debugging tool used for simulation.

To run the simulation for the DHT11 Temperature and Humidity sensor the hardware was set up as seen in Figure 5. Using the accompanied code found in Appendices II, certain parameters were set some of which defined when the temperature would be considered either “too cold”, “too hot” or “perfect”. The “too cold” parameter was set at less than or equal to 20 Degree Celsius, the “too hot” parameter was set at temperatures equaling or exceeding 31 Degree Celsius and the “perfect” parameter was set at temperatures ranging between 28-30 Degrees Celsius. After setting the specified parameters heat was generated close to the sensor and the results were recorded through the debugging software as seen in Figure 8.

Figure 8. Displaying Simulated Results of DHT11 Sensor
PIR Simulation
Similarly to the simulation that was carried out on the DHT11 sensor, the Arduino IDE software was utilized to carry out the simulation. In order to run the simulation for the PIR sensor however, the hardware was set up as seen in Figure 4 and the accompanied code in Appendices III. Unlike the procedure in which various parameters were set like in the case of the DHT11 sensor, the coding for the PIR sensor just needed to define HIGH and LOW states which act as it detecting motion when it’s HIGH and not detecting motion when it’s LOW. The resulting debugging information was obtained and displayed in Figure 9.

Figure 9. Displaying Simulated Results of PIR Sensor

Level of Usability
The security system that was implemented in this project provides users with a simple to operate and highly customizable system that not only can be utilized or constrained to home use, as indicated by the scope of this project but it can extend into businesses and industries, practically any establishment which seeks the security features that this system offers. Areas that seek protection from burglary or theft such as banks and business, or even industries that need systems to monitor temperature levels and the like can benefit from utilizing a system such as this.

Conclusion
The objective and aim of this project was realized through the building and implementation of a home security system that was based entirely on a microcontroller, specifically an Arduino microcontroller. This system serves to act as a low cost and readily available system that can compete with other existing home security systems. Where it falls short is its reliability in that through the implementation of this system one of the existing components which is crucial to the entire system under performed. Many factors could be considered on how to remedy this existing component short comings and should be looked at in the future as it is a means of improving the system.

This project also served as a means of displaying the capabilities of the microcontroller, which has been accomplished in that through the implementation of this system we see that not only was the microcontroller capable of operating as the brain of the system, but it also managed various information inputted into the system and responded with the appropriate output without fail. So much so that the scope of this system can not only be limited by what was presented in this project but systems and various components such as Video Cameras, Magnetic Locks and a Wireless Remote Operated component to name a few can be added on in future studies.

To reiterate we displayed the capabilities in which a microcontroller can provide and as such built a fully operational security system that not only could be utilized for domestic use but can be applied to other various application such as industries, as a means of monitoring and alarming when various parameters are exceeded or even apply it to high security situation such as banks etc.
Bibliography
1 J. Williams, B. Singh and B. Singh, “Urban Youth, Fear of Crime, and Resulting Defensive Actions”, Questia.com, 2018. Online. Available: https://www.questia.com/read/1G1-15622131/urban-youth-fear-of-crime-and-resulting-defensive. Accessed: 30- Jun- 2018.

2 P. Perry, Home Security: 14 Things You Must Know About Security Systems. 2016.

3 J. Castro, Building a Home Security System with Arduino. Packt Publishing, 2015.

4 M. Schwartz, Home automation with Arduino. Estados Unidos: CreateSpace Independent Publishing.

5 S. Barrett, Arduino microcontroller. S.l.: Morgan & Claypool, 2012.

6 R. Gaffigan, “Home security system”, US4833449A, 1988.

7 D. Dockery, “Home security system for detecting an intrusion into a monitored area by an infrared detector”, US5570079A, 1995.

8 iControl Networks Inc, “Forming a security network including integrated security system components”, US9450776B2, 2005.

9 N. David, A. Chima, A. Ugochukwu and E. Obinna, “Design of a Home Automation System Using Arduino”, International Journal of Scientific & Engineering Research, vol. 6, no. 6, 2015.

10 V. Narayanan and S. Gayathri, “Design of Wireless Home Automation and Security System using PIC Microcontroller”, International Journal of Computer Applications in Engineering Sciences, vol. 3, 2013.

11 S. Manghnani, C. Rajitha and K. Priyanka, “ARDUINO BASED WIRELESS SYSTEM FOR TEMPERATURE AND HUMIDITY MONITORING”, International Journal of Advanced Technology in Engineering and Science, vol. 5, no. 3, 2017.

12 Regent Education & Research Foundation (n.d.). SMART HOME SECURITY SYSTEM. online India: Shahudullah Khan. Available at: http://www.academia.edu/7481382/SMART_HOME_SCEQURITY_SYSTEM Accessed 10 Jul. 2018.

13
14 Arduino.cc. (n.d.). Arduino – Home. online Available at: https://www.arduino.cc/ Accessed 17 Jul. 2018.

Appendices I
Program Code
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#include <Keypad.h>
#include <LiquidCrystal.h>
//Temp Sensor
int speakerPin = 30;
int length = 1;
#define DHTPIN 28 //DHT11 sensor
#define DHTTYPE DHT11
#define LED_TOO_HOT 10 //DHT11 led
DHT dht(DHTPIN, DHTTYPE);
int temp=0;
//Keypad + Motion
String password=”1234″;
int ledPin = 24; // PIR led
int inputPin = 22; // PIR sensor
int pirState = LOW; // we start, assuming no motion detected
int val = 0; // variable for reading the pin status
int pinSpeaker = 26; //PIR buzzer
int screenOffMsg =0;
String tempPassword;
boolean activated = false; // State of the alarm
boolean isActivated;
boolean activateAlarm = false;
boolean alarmActivated = false;
boolean enteredPassword; // State of the entered password to stop the alarm
boolean passChangeMode = false;
boolean passChanged = false;
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char keypressed;
//define the cymbols on the buttons of the keypads
char keyMapROWSCOLS = {
{‘1′,’2′,’3′,’A’},
{‘4′,’5′,’6′,’B’},
{‘7′,’8′,’9′,’C’},
{‘*’,’0′,’#’,’D’}
};
byte rowPinsROWS = {1,2,3,4}; //Row pinouts of the keypad
byte colPinsCOLS = {5, 6, 7, 8}; //Column pinouts of the keypad
Keypad myKeypad = Keypad( makeKeymap(keyMap), rowPins, colPins, ROWS, COLS);
LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);
void setup() {
//Temp viod setup
lcd.begin (16,2);
Serial.println(“DHT11 test!”);
dht.begin();
pinMode(speakerPin, OUTPUT);
pinMode (10 , OUTPUT);
//PIR void setup
pinMode(pinSpeaker, OUTPUT); // Set pinSpeaker as an output
pinMode(ledPin, OUTPUT); // Sets the inputPin as an Output
lcd.begin(16, 2);
lcd.setCursor(2, 0); // Set LCD cursor position (column, row)
lcd.print(“Home Security”); // Print text to LCD
lcd.setCursor(5, 1); // Set LCD cursor position (column,row)
lcd.print(“System”); // Print text to LCD
delay(4000); // wait 4s // Delay to read text
lcd.clear(); // clear LCD display // Clear the display
}
void loop() {

float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(“Failed to read from DHT sensor!”);
return;
}
Serial.print(“Humidity: “);
Serial.print(h);
Serial.print(” % “);
Serial.print(“Temperature: “);
Serial.print(t);
Serial.println(” *C “);
/* if (t >= 31) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(” Temp Alert!”);
delay(1000);
Serial.println(“Too hot!”);
digitalWrite(10, HIGH);
digitalWrite(speakerPin, HIGH);
delay (1000);
digitalWrite(speakerPin, LOW);
digitalWrite(10, LOW);
}*/

if (activateAlarm) {
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“Alarm will be”);
lcd.setCursor(0,1);
lcd.print(“activated in”);
int countdown = 5; // 9 seconds count down before activating the alarm
while (countdown != 0) {
lcd.setCursor(13,1);
lcd.print(countdown);
countdown–;
tone(pinSpeaker, 700, 100);
tone (speakerPin, 700, 1000);
delay(1000);
}
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“Alarm Activated!”);
val = digitalRead(inputPin);
activateAlarm = false;
alarmActivated = true;
}
if (alarmActivated == true){ val = digitalRead(inputPin); // read input value
if (val == HIGH) { // check if the input is HIGH
digitalWrite(ledPin, HIGH); // turn LED ON
tone(pinSpeaker, 300);
lcd.clear();
enterPassword();
}
if (t >= 34){ temp = digitalRead (DHTPIN);
if (temp == HIGH) {
digitalWrite (LED_TOO_HOT, HIGH);
tone(speakerPin, 1000);
lcd.clear();
enterPassword();
}
}
}
if (!alarmActivated) {
if (screenOffMsg == 0 ){
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“A – Activate”);
lcd.setCursor(0,1);
lcd.print(“B – Change Pass”);
screenOffMsg = 1;
}
keypressed = myKeypad.getKey();
if (keypressed ==’A’){ //If A is pressed, activate the alarm
tone(pinSpeaker, 1000, 200);
activateAlarm = true;
}
else if (keypressed ==’B’) {
lcd.clear();
int i=1;
tone(pinSpeaker, 2000, 100);
tempPassword = “”;
lcd.setCursor(0,0);
lcd.print(“Current Password”);
lcd.setCursor(0,1);
lcd.print(“>”);
passChangeMode = true;
passChanged = true;
while(passChanged) {
keypressed = myKeypad.getKey();
if (keypressed != NO_KEY){
if (keypressed == ‘0’ || keypressed == ‘1’ || keypressed == ‘2’ || keypressed == ‘3’ ||
keypressed == ‘4’ || keypressed == ‘5’ || keypressed == ‘6’ || keypressed == ‘7’ ||
keypressed == ‘8’ || keypressed == ‘9’ ) {
tempPassword += keypressed;
lcd.setCursor(i,1);
lcd.print(“*”);
i++;
tone(pinSpeaker, 2000, 100);
}
}
if (i > 5 || keypressed == ‘#’) {
tempPassword = “”;
i=1;
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“Current Password”);
lcd.setCursor(0,1);
lcd.print(“>”);
}
if ( keypressed == ‘*’) {
i=1;
tone(pinSpeaker, 2000, 100);
if (password == tempPassword) {
tempPassword=””;
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“Set New Password”);
lcd.setCursor(0,1);
lcd.print(“>”);
while(passChangeMode) {
keypressed = myKeypad.getKey();
if (keypressed != NO_KEY){
if (keypressed == ‘0’ || keypressed == ‘1’ || keypressed == ‘2’ || keypressed == ‘3’ ||
keypressed == ‘4’ || keypressed == ‘5’ || keypressed == ‘6’ || keypressed == ‘7’ ||
keypressed == ‘8’ || keypressed == ‘9’ ) {
tempPassword += keypressed;
lcd.setCursor(i,1);
lcd.print(“*”);
i++;
tone(pinSpeaker, 2000, 100);
}
}
if (i > 5 || keypressed == ‘#’) {
tempPassword = “”;
i=1;
tone(pinSpeaker, 2000, 100);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“Set New Password”);
lcd.setCursor(0,1);
lcd.print(“>”);
}
if ( keypressed == ‘*’) {
i=1;
tone(pinSpeaker, 2000, 100);
password = tempPassword;
passChangeMode = false;
passChanged = false;
screenOffMsg = 0;
}
}
}
}
}
}
}
}
void enterPassword() {
int k=5;
tempPassword = “”;
activated = true;
lcd.clear();
lcd.setCursor(0,0);
lcd.print(” *** ALARM *** “);
lcd.setCursor(0,1);
lcd.print(“Pass>”);
while(activated) {
keypressed = myKeypad.getKey();
if (keypressed != NO_KEY){
if (keypressed == ‘0’ || keypressed == ‘1’ || keypressed == ‘2’ || keypressed == ‘3’ ||
keypressed == ‘4’ || keypressed == ‘5’ || keypressed == ‘6’ || keypressed == ‘7’ ||
keypressed == ‘8’ || keypressed == ‘9’ ) {
tempPassword += keypressed;
lcd.setCursor(k,1);
lcd.print(“*”);
k++;
}
}
if (k > 9 || keypressed == ‘#’) {
tempPassword = “”;
k=5;
lcd.clear();
lcd.setCursor(0,0);
lcd.print(” *** ALARM *** “);
lcd.setCursor(0,1);
lcd.print(“Pass>”);
}
if ( keypressed == ‘*’) {
if ( tempPassword == password ) {
activated = false;
alarmActivated = false;
temp = 0;
digitalWrite(ledPin, LOW);
digitalWrite(LED_TOO_HOT, LOW);
noTone(pinSpeaker);
noTone(speakerPin);
screenOffMsg = 0;
}
else if (tempPassword != password) {
lcd.setCursor(0,1);
lcd.print(“Wrong! Try Again”);
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(” *** ALARM *** “);
lcd.setCursor(0,1);
lcd.print(“Pass>”);
}
}
}
}
Appendices II
#include <DHT.h>
#include <DHT_U.h>
#include <Adafruit_Sensor.h>
int speakerPin = 30;
int length = 1;
#define DHTPIN 28
#define DHTTYPE DHT11
#define LED_TOO_COLD 10
#define LED_PERFECT 11
#define LED_TOO_HOT 24
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
Serial.println(“DHT11 test!”);
dht.begin();
}
void loop() {
pinMode(speakerPin, OUTPUT);
pinMode (10 , OUTPUT);
pinMode (11 , OUTPUT);
pinMode (24 , OUTPUT);
delay(2000);
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(“Failed to read from DHT sensor!”);
return;
}
Serial.print(“Humidity: “);
Serial.print(h);
Serial.print(” % “);
Serial.print(“Temperature: “);
Serial.print(t);
Serial.println(” *C “);
if (t <= 20) {
Serial.println(“Too cold!”);
digitalWrite(24, HIGH);
digitalWrite(speakerPin, HIGH);
delay (1000);
digitalWrite(speakerPin, LOW);
digitalWrite(24, LOW);
}
if (28 < t < 30 ) {
Serial.println(“Perfect temperature!”);
digitalWrite(11, HIGH);
delay (2000);
digitalWrite(11, LOW);
}
if (t >= 31) {
Serial.println(“Too hot!”);
digitalWrite(10, HIGH);
digitalWrite(speakerPin, HIGH);
delay (1000);
digitalWrite(speakerPin, LOW);
digitalWrite(10, LOW);
}
}
Appendices III
int ledPin = 24; // choose the pin for the LED
int inputPin = 22; // choose the input pin (for PIR sensor)
int pirState = LOW; // we start, assuming no motion detected
int val = 0; // variable for reading the pin status
int pinSpeaker = 26; //Set up a speaker on a PWM pin (digital 9, 10, or 11)
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(inputPin, INPUT); // declare sensor as input
pinMode(pinSpeaker, OUTPUT);
Serial.begin(9600);
}
void loop(){
val = digitalRead(inputPin); // read input value
if (val == HIGH) { // check if the input is HIGH
digitalWrite(ledPin, HIGH); // turn LED ON
playTone(300, 160);
delay(150);

if (pirState == LOW) {
// we have just turned on
Serial.println(“Motion detected!”);
// We only want to print on the output change, not state
pirState = HIGH;
}
} else {
digitalWrite(ledPin, LOW); // turn LED OFF
playTone(0, 0);
delay(300);
if (pirState == HIGH){ // we have just turned off
Serial.println(“Motion ended!”);
// We only want to print on the output change, not state
pirState = LOW;
}
}
}
// duration in mSecs, frequency in hertz
void playTone(long duration, int freq) {
duration *= 1000;
int period = (1.0 / freq) * 1000000;
long elapsed_time = 0;
while (elapsed_time < duration) {
digitalWrite(pinSpeaker,HIGH);
delayMicroseconds(period / 2);
digitalWrite(pinSpeaker, LOW);
delayMicroseconds(period / 2);
elapsed_time += (period);
}
}
Gantt Chart