Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

You have nothing in your shopping cart yet.

Title: Design and Implementation of a Smart Home System
Description: A smart home or building is a home or building, usually a new one, that is equipped with special structured wiring to enable occupants to remotely control or program an array of automated home electronic devices by entering a single command

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


Design and Implementation of a Smart Home
System

Helsinki Metropolia University of Applied Sciences
Bachelor of Engineering
Information Technology
Bachelor’s Thesis
29 August 2013

Abstract

Author(s)
Title

Design and Implementation of a Smart Home System

Number of Pages
Date

46 pages + 1 appendix
29 August 2013

Degree

Bachelor of Engineering

Degree Programme

Information Technology

Specialisation option

Embedded System Engineering

Instructor(s)

Sami Sainio, Project Supervisor

The goal of the project was to implement a smart home by controlling electronic devices at
home remotely and to get an alert on intrusion or movement around the restricted premises
...

The application consisted of two units, the microcontroller and the mobile unit
...
Different operations were performed based on the given instructions
...

The Arduino platform was used as the system platform with Arduino Uno Board as the
microcontroller board
...

The system could be installed at any place and could be controlled by any mobile phone
supporting the SMS service
...
The system consists of three
sensors which are used as heat detector, intrusion detector and motion detector along with
a remotely managed light system
...
However, the system is limited to the
availability of the GSM network as the GSM network is responsible for communication between the mobile station and the GPRS module
...

Keywords

GSM, Arduino, SIM900, AT command, sensor, SMS, LM35,
PIR, hall effect, mobile station
...
1

Arduino Platform

3

2
...
1

Arduino Uno Board

3

2
...
2

ATmega328 Microcontroller

4

2
...
3

Sensor

9

2
...
1

10

2
...
2

Infrared Sensor

14

2
...
3
3

Temperature Sensor
Magnetic Sensors

17

Design and Development of the System

21

3
...
2

Interfacing Sim900 GPRS/GSM Module

23

3
...
3
...
3
...
3
...
4

Implementation of remotely managed light system

29

3
...
6

Testing the system

34

4

Result

38

5

Discussion

42

6

Conclusion

45

References
Appendices
Appendix 1
...
The advancement of technology has increased the safety
and security of people along with their belongings
...

The busy lifestyle of people is leading to the necessity of controlling the devices at
home remotely and increasing the necessity of keeping surveillance over their homes
...
The use of mobile phones is
changing with the development of technology and they can be used for different purposes
...
Today smart phones are available in the market with different applications
and hardware which can be implemented without any further development or enhancement
...

There are different types of built smart home systems in the market, and they do not
have flexibility over choosing the types and number of sensors used and the cost of the
system
...

Therefore the idea of a smart home system was proposed, to overcome the limitations
of the systems already available in the market
...
The cost of the system can be determined by the user as the cost depends on the hardware used in the system chosen by
the developer
...
The SIM900-GPRS module and
the Arduino Uno Board are used to communicate between the mobile phone and the
devices and sensors installed at home
...
The project consists of a
led light which is controlled by the mobile phone to show the demo of controlling
mechanism of the household devices such as light, fan or television
...
The system is limited to the area with the
GSM network available and the whole system does not work without the network
...
Arduino Uno Board is used
as the microcontroller board
...
The SIM900 GSM/GPRS module is responsible for
communication between the microcontroller unit and the mobile station
...


2
...
The arduino is a simple yet sophisticated device which is based on Atmel’s ATmega microcontrollers
...
The software language is based on AVR C programming language and can be expanded through C++ libraries
...
[1]

2
...
1

Arduino Uno Board

Arduino Uno is one of the microcontroller boards manufactured by the Arduino and it is
a microcontroller board based on the Atmel’s ATmega328 microcontroller
...
The Arduino Uno board has a 16 MHz ceramic resonator, a USB connection, a power jack, an
ICSP header, a reset button, 6 analog inputs and 14 digital input/output pins (of which
6 can be used as PWM outputs)
...
The board has 32 KB flash memory of which 0
...
[2]

4

Figure 1: The Arduino Uno Board
Reprinted from the Arduino Board Uno [2]
Figure 1 shows the Arduino Uno Board manufactured by the Arduino in Italy
...
As can be seen in
figure 1, pins A0 to A5 are the analog input pins, pins 0 to 13 are 14 digital input/output
pins and the pins with a “~” sign can be used as the PWM output pins
...
Pins 0(RX) and 1(TX) are used for serial communication while pins 10(SS),
11(MOSI), 12(MISO) and 13(SCK) are used for SPI (Serial Peripheral Interface) communication
...
[2]

2
...
2

ATmega328 Microcontroller

The microcontroller is a low-power CMOS (Complementary Metal Oxide Semiconductor) 8-bit microcontroller based on the AVR enhanced RISC (Reduced Instruction Set
Computer) architecture
...
[3]

5

Figure 2: ATmega328 Microcontroller Architecture
Reprinted from Datasheet of ATMega328 [3]
The internal architecture of the microcontroller is shown in figure 2
...
The MCU (Microcontroller unit) consists of 4K/8K bytes of in-system programmable flash with read-while-write capabilities, 256/412/1K bytes EEPROM along
with the 512/1K/2K bytes of SRAM
...
[3]

The five, software selectable, power saving modes are Idle mode, Power-down mode,
Power-save mode, ADC Noise Reduction mode and the Standby mode
...
1
...
Therefore the CPU is able to access the memories, perform calculations, control peripherals and handle interrupts
...
The principle of execution of instructions in the
program memory is the single-level pipelining
...
[3]

Figure 3: Block diagram of the AVR CPU Core architecture
Reprinted from from Datasheet of ATMega328 [3]

7

The block diagram of AVR CPU Core architecture is shown in figure 3
...
The arithmetic and logical
operations between the registers or between the constant and a register are supported
by the ALU
...
[3]
The boot program section and the application program section are the two main sections of the program flash memory
...
The size of the stack is limited by the total size and usage of the SRAM
...
The
memory spaces in the AVR architecture are all linear and regular memory maps
...
2

GPRS/GSM Network

Literally, the GSM stands for Global System for Mobile Communication
...
The smart card handling and storing a subscriber’s
data is the SIM (Subscriber Identity Module) card whereas the radio equipment is
called mobile equipment
...
SMS (Short Messaging Service) is one
of the services integrated in the GSM, which provides a means of sending messages of
a limited size to and from the mobile stations
...

[4,212-216]
The GPRS (General Packet Radio Service) is a packet-switched transmission service
supplementing the Circuit Switched data and Short Message Service over the mobile
telephone network [4,229]
...
The GPRS is a less costly mobile
data service compared to SMS and Circuit Switched Data and the information is transmitted more quickly, immediately and efficiently across the mobile network
...
6 kbps) and the length of the SMS (160 characters)
...
[5]
SIM900 GSM/GPRS Module
SIM900 is an ultra-compact and reliable wireless SMT (Surface Mount Technology)
type quad-band GSM/GPRS module designed with a powerful single-chip processor
integrating AMR926EJ-S core manufactured by SIMCom Wireless Solutions Ltd
...
It is
a low-power consumption module with current consumption as low as 1
...
It is optimized for voice and other forms of data transfer including text and images
...
It has a GPRS multi-slot class 10/8 and a B-type GPRS
mobile station class
...
AT commands are used to interface and control
the GSM/GPRS module
...
Despite the fact that every command line starts with “AT”, it
is not a part of the command name but is just the prefix informing the modem about the
start of a command line
...
Basically, there are two types of AT commands and they are basic commands and extended commands
...
For example, +CMGR
(Read SMS Messages), +CMGL (List SMS Messages) and +CMGS (Send SMS Messages) are extended commands
...
For example, H (Hook Control), A (Answer), D (Dial) and O
(Return to online data state) are basic commands
...
The commands must start with “AT” and end with a carriage return
...
The first command name should be prefixed with “AT” in a command line containing more than one AT command and the command names should be
separated with semicolons
...
The string is enclosed between double quotes
...

Example: AT + CMGL = “ALL”
4
...
[7]

2
...
There are different definitions and different views
about the sensors and they have been adopted by scientists and engineers
...
Generally, the sensing
principles are physical or chemical in nature and they can be grouped according to the
form of energy in which signals are received and generated
...
Sensors can be classified according to
the sensing principles but the classification of sensors is a vast field and they cannot be
classified under one criterion
...
For example, sensors can be classified according to the material and
technology, application, transduction principles or property
...
A passive sensor is designed to
receive and measure the signal whereas an active sensor is a device used for measuring signals transmitted by the sensors that were reflected, refracted or scattered
...
Independent of the active or passive nature of a sensor, there are

10

several properties associated with a sensor that are critical to the sensor performance
...
[9,16]

The response time of a sensor is the time taken by the sensor to reach 90% of its
steady state value after the introduction of the measurand, whereas the recovery time
is the time taken by a sensor to be within 10% of the value it had before the exposure
to the measurand
...
The ability of the sensor to produce the same characteristic upon
the repeated exposure to a particular measurand is referred to as reproducibility
...
However, there is some degradation on the sensor signature after a long use of the sensor and it is natural
...
Sensitivity
and resolution are the critical properties of a sensor for the application with the precise
measurement system or for the application sensing the potentially dangerous measurand
...
The importance of properties of a sensor depends on the application where the sensor has to be used
...
There are different types of sensors but the sensors
used in the project will be discussed in section 2
...
1, 2
...
2 and 2
...
3
...
3
...


11

Among the two connotations, the measurement of temperature and heat is widely practiced and can be achieved using many different principles
...
The principle to
be employed and the sensor to be used generally depend on the temperature range to
be detected and the resolution that is required
...
The principle of operation is that the infrared radiation falling on a thin film material is absorbed which will lead to the change in the resistance of the material
...
There are several materials suitable as the absorbing layer such as
metals, metal oxides and traditional semiconductors and these devices are uniquely
suitable for the temperature imaging applications
...

[11,47]
The two conducting materials with different thermoelectric temperature coefficient (also
known as Seebeck coefficient) form a thermocouple
...
Thermocouples are widely used
for temperature sensing on the macroscale, over temperature ranges of many hundreds of Kelvin
...
[11,47-48]
Resistivity of most of the metals increases (generally non-linear) with the increase in
temperature
...
There are many microresistive temperature sensors using a variety of metals including tungsten, nickel and
chromium based on this principle
...
The mixture of
metal oxides pressed into a bead, wafer or other shape is heated under pressure at

12

high temperature and then encapsulated with glass or epoxy
...
Unlike a resistor, the resistance
of a thermistor decreases with the increase of temperature and is called a negative
temperature coefficient thermistor
...
1 degree Centigrade or even
smaller as the resistance change is very large for a small change in temperature
...
[12]
Semiconductor devices, generally diodes, make excellent temperature sensors
...
Hence, there is a change in the forward voltage with a change in the junction temperature with a constant correlation factor given by the equation below:
∆Tj = K x ∆Vf
where the correlation factor is referred to as the K factor
...
4 to 0
...
The value of measurement current is different
for different diodes and it is selected on the basis of diode size and the current value
which corresponds to the break in the diode’s forward voltage curve
...
[13]
LM35 Temperature Sensor
The LM35 series are precision integrated-circuit temperature sensors, with an output
voltage linearly proportional to the centigrade scale
...
It operates from 4 to 30 V,
has less than 60 µA drain current and has low self-heating (0
...
The
control circuitry or the interfacing of LM35 is really easy due to the low output impedance, linear output and precise inherent calibration
...
The LM35D is also available in an 8 lead surface-mount
small outline package and a plastic TO-220 package
...
sensor
...

The LM35 can be used as a basic centigrade temperature sensor for sensing the temperature between +2 ºC and +150 ºC as well as a full-range centigrade temperature
sensor for sensing the temperature between -55 ºC and +150 ºC and the circuitry for
using them as basic or full-range is shown in figure 4
...
The
temperature can be obtained in degree Centigrade by just measuring the output voltage of the sensor as the output voltage is the function of the temperature
...
3
...
The vibration and rotation of atoms and molecules within a material
whose temperature is above absolute zero produces infrared radiation and all the objects emit infrared radiation as a function of their temperature [15,1]
...
The
International Commission on Illumination (CIE) has divided the IR region into following
three biologically significant bands [16]:


IR-A: 700 nm – 1400 nm (215 THz – 430 THz)



IR-B: 1400 nm – 3000 nm (100 THz – 215 THz)



IR-C: 3000 nm – 1 mm (300 GHz – 100 THz)

Similarly, there is another classification specified by ISO 20473 which divides the spectrum into three regions and it is supported by astronomers and scientists as well
...

Reprinted from Thermal Infrared Sensors [15,2]
Infrared Region

Wavelength
in µm

range Temperature range Remarks
of max
...
2 – 1
...
5 – 1
...
1 – 2
...
2 – 4
...
4 – 5
...
Since the infrared radiation is the function of temperature, the temperature of the source can be measured

15

with the help of emitted radiation
...
The body’s temperature can be measured by using emitted radiation using contactless temperature measurement
(pyrometry)
...
The radiation can be
used to detect the motion and presence of people (motion detectors, security
systems) or to record the entire scene with IR cameras
...


-

The thermal images showing the thermal isolation of buildings, temperature distribution of combustion processed or temperature-dependent processes are
based on the IR spectrum and can be recorded using the IR cameras
...

Each bond has a specific resonance frequency at which the radiation is almost
completely absorbed
...

The presence and concentration of certain substances can be determined by
using the IR radiation with a specific wavelength
...
[15,1]

Generally the IR sensor can be divided into two classes: Passive IR sensor and Active
IR sensor
...
Similarly,
active infrared sensors generate a multiple beam pattern of modulated infrared energy
and react to a change in the modulation of the frequency, or an interruption in the received energy
...
[17,379]

16

Panasonic Passive Infrared Motion Sensor
The motion sensor is manufactured by Panasonic and it is available in different types
and different colours with a varying detection range
...
The
robust design of the sensor prevents false detection
...
In addition, the high S/N ratio minimises sensitivity to false tripping
when operated under various conditions
...
[18]
Despite the different measures used to minimise the false detection, sensor might give
false detection in many cases, for example a small animal entering the detection area,
light source directly hitting the sensor, a sudden temperature change in the detection
area etc
...
[18]

Figure 5: Block diagram of the Panasonic Passive Infrared Sensor
Reprinted from Datasheet of Infrared Sensor[18]
Figure 5 illustrates the block diagram of the Panasonic Passive Infrared Sensor
...
The output of the sensor is a digital output (either high or low)
...
0 to 6
...
[18]

2
...
3

Magnetic Sensors

The sensors associated with the laws and effects of magnetic or electromagnetic fields
are considered the magnetic sensors
...
A unique aspect of using magnetic sensors is
that measuring magnetic fields is usually not the primary intent
...
Once the change or disturbance in the magnetic field is
detected, some signal processing will be required to change the sensor output value to
the desired parameter value, which makes magnetic sensing a little more difficult to
apply in most applications
...
[19,4]

The classification based on the physical principles and effects are as follows:
-

Magnetogalvanic sensors

-

Magnetoelastic sensors

-

Magnetic-field sensors: saturation-core magnetometers (flux-gate magnetometers) and induction-coil and search-oil magnetometers

-

Wiegand and pulse-wire sensors

-

Magnetoresistive sensors

-

SQUID sensors
...
Voltage perpendicular to both the current and the field is generated when a current carrying conductor is placed into a magnetic field and this principle is known as the Hall Effect
...
It shows a thin sheet of a hall element through which a current (I) is passed and is placed in a magnetic field (B)
...
The relation between the hall voltage (VH),
current (I) and the magnetic field (B) is shown below:
VH α I x B
The hall voltage is proportional to the vector cross product of the current (I) and the
magnetic field (B)
...
The output voltage
(Hall Voltage) is very small (µV) and requires some additional electronics to achieve
useful voltage levels in the hall sensors
...
Hence, the amplifier must be a differential amplifier so as to amplify only
the potential difference in the sensor
...
The output voltage of a
sensor is proportional to the magnetic field to which it is exposed and the magnetic field

19

can be either positive or negative
...
To
overcome this problem of requiring two power supplies, a fixed offset or bias is introduced into the amplifier
...
[21]
The hall effect sensor with an output which is one of the two states, high or low, is
known as the digital hall effect sensor
...
The output of a differential amplifier is compared with the reference
by the Schmitt trigger
...
[21]
The output of the Schmitt trigger is the output of a sensor which could be either high or
low
...
Since there is variation in the characteristics
with the variation in the sensor and temperature, they are specified in terms of maximum and minimum
...
The maximum operate point and the minimum release point of the unipolar
digital output sensor is positive and affected only by the positive magnetic field (i
...

south pole of the magnet)
...
e
...

Hence the output of the bipolar digital output sensor is affected by both the south pole
and north pole of the magnet while the output of the unipolar digital output sensor is
affected only by the south pole of the magnet
...
It provides highly sensitive unipolar switching along with a reverse
battery protection up to -24 V DC
...
It can be used for various applications such as door position sensing,
flow sensing or pedal switch
...
Three different colours
of the sensor describe three different parameters of the sensors
...
A pull-up resistor should be connected between
output and the power supply
...
[22]

21

3

3
...

The mobile station is responsible for giving the command and the control instruction to
the devices and sensors and to get the response from them
...
The second unit, the microcontroller unit, is responsible for controlling the devices, processing information gathered from the devices as
well as from the mobile station
...


Motion

Heat

Intrusion

Detector

Detector

Detector

Arduino Microcontroller Board

Sim900 GSM/GPRS Module

Mobile
Phone

Figure 8: Block Diagram of the System

Light

22

The block diagram of the system is shown in figure 8
...
The microcontroller unit consists of three sensors and a
light along with the sim900 module
...
The data from the sensors is continually processed
by the microcontroller and an alert is sent to the mobile station if something is sensed
or something reaches beyond the limit in case of a temperature sensor
...
These three units of the system
are responsible for the security of a home
...
In this project, a simple led light is used to show the demo of the remote light management system
...

The Sim900 GPRS/GSM module acts as the mediator between the microcontroller unit
and the mobile station and is responsible for the communication between them
...
The instruction sent by the user from the mobile station is executed by the microcontroller
...
It does not require any special feature or any special application for the mobile phone to be a part of the system
...
The instruction to the microcontroller is sent by using text messages and the alert from the microcontroller is received
as a text as well
...


23

3
...
AT commands are used to interface
the module as well as to configure it
...

mySerial
...
println("AT+CMGF=1");

//sets the text

mode
Listing 1: AT command syntax to set the text mode
The pin code of SIM is required to activate the SIM card
...

The code would then be simply compiled and uploaded into the Arduino/GPRS shield
unit
...
indexOf(",");
String index = msg
...
print("AT+CMGR = ");
mySerial
...
It is necessary to read the index of the SMS every time with an incoming SMS message as the index keeps on increasing
...
Since the storing capacity of the SIM card is limited, the SMS is deleted after it is read and the instruction is executed
...


24

3
...
The doors and windows need to be monitored from burglars if they try to open them as well as the movement of strangers
around the house premises should be monitored
...
In addition, the temperature of the home has to
be monitored as well to trigger the alarm upon reaching the critical point
...
The sensors could be implemented as
different types of detectors according to the necessity of the application and the human
desire
...
Since there are different
types of sensors, they are interfaced according to the output and properties of the sensor
...


3
...
1

Heat Detector

Temperature is among the areas to be monitored in a home and has to be known at
any time
...
Apart from this, a temperature sensor can be installed in a home
for various purposes, other than just as a fire alarm
...
Similarly, it can be used to check the warming
up of the house, so that the house will not warm above certain a temperature and the
electricity will not be used by the heating system after that point
...
The
temperature sensor can be installed in a home and the temperature can be crosschecked whenever desired by the owner
...
The critical point set
depends entirely on the place of installation
...


25

The LM35 temperature sensor is used as the heat detector in the system
...
The power supply of 5V is used from the port of Arduino Board and the input
and output are connected to the input/output port of Arduino
...
The analog input port A0 of the arduino board is used as the input port and the 5V output port of the arduino board is used
as the power supply for LM35
...


26

The code used to interface the sensor and to calculate the temperature is shown below:
int Temp_sensor = A0;
pinMode(Temp_sensor,INPUT);
volt_output

=

analogRead(Temp_sensor);

//reads the output
delay(1000);
temp = (5
...
Temperature is the function of output voltage, and thus temperature can be calculated by using mathematics
...
The limit of the temperature to send the SMS can be changed depending on
the environment of the place where the sensor is placed and on the application
...
In addition, it is possible to get the temperature of the place
where the sensor is located by simply sending an SMS to the GPRS module
...
3
...
Hence, the passive Infrared sensors could be used as a motion detector and the alarm could be triggered if there is some movement around the restricted
premises
...
The 5V power supply is given to the sensor through the board
and the output of the sensor is connected to the digital input of the arduino board
...


27

Figure 10: Digital output timing chart of passive infrared sensor
Reprinted from datasheet of Panasonic Passive Infrared Sensor[18]
As can be seen in figure 10, the sensor is activated by supplying a specified voltage
provided by the manufacturer to the sensor
...
Twu is the circuit stability time
during which the sensor output voltage is undefined (ON/OFF) and detection is not
guaranteed
...

int PIRSensor = 10;
pinMode(PIRSensor,INPUT);
for(i=0;i<30;i++){

//time to calibrate pir due

to Twu
delay(1000);
}
PIR_output = digitalRead(PIRSensor);
if(PIR_output == HIGH){
send_SMS();
}
Listing 4: Calibrating and interfacing PIR sensor code implementation
The C-language code implementation for calibrating and interfacing the passive infrared sensor is shown in listing 4
...
There are only two possible states for the output of the sensor; either high or low
...
As soon as there is some person’s movement around
the place where the sensor is installed, an alert will be sent to the mobile phone informing about the person’s movement
...
3
...
The intrusion detector is used to give extra security
along with other detectors
...
For the installation of the
proximity sensor, a magnet is attached to the frame of the door or window, whereas the
sensor is attached to the door or window itself
...

The south pole of the magnet should face the sensor on closure as the sensor is unipolar hall effect proximity sensor
...
Since the sensor is a unipolar sensor, it is affected only by the south pole of the
magnet
...

The output of the sensor is low when the door or window is closed as the south pole of
the magnet is close to the sensor
...
The C-code implementation for interfacing the proximity sensor
is shown below:
int door_sensor=9;
pinMode(door_sensor,INPUT);
door_output=digitalRead(door_sensor);
if(door_output == LOW){
SMS_conten_flag_door=1;
send_SMS();
}
Listing 5: C-code compilation for interfacing proximity sensor
The C-code language for the interfacing and implementation of a proximity sensor is
shown in listing 5
...
The output of the sensor goes low whenever the south pole of the magnet
comes close to the sensor and it sends the message
...

However the mechanism is the same and the implementation of the application can be
changed by changing a single C-code in the program
...
4

Implementation of remotely managed light system

There are many electronic devices in the home whose status is unknown (on or off)
and which could be left on unknowingly or accidently
...
It is not always
possible to go back home and turn the devices off
...
There are different ways to implement remotely managed
electronic devices, for example management using the Ethernet, management using
wireless devices or management using the GPRS/GSM module
...
In this application, light is managed remotely, and the light
represents the electronic devices as a whole
...
The relay can be controlled by the I/O pins of the arduino which finally
controls the light
...


Arduino Board
I/O

5V

In

gnd

gnd

vcc

gnd

Relay Shield

com

NO

NC

Power

Electronic

Supply

Devices

220V

Figure 12: Circuit diagram for the control of electronic devices
The electronic device is controlled by the I/O pin of arduino connected to the relay
...
It means that the
electronic device is on when the I/O pin is high and the device is off when the I/O is
low
...
To show the demo of the remotely managed light, a led is
used, and it is controlled remotely in this application instead of the light bulb
...

int led = 13;
pinMode(led,OUTPUT);
if(msg
...
indexOf("Turn light OFF") >= 0){
digitalWrite(led,LOW);
}
if(msg
...
The code first checks the SMS messages and does the operation according to the content of the messages
...
The fifth bit of
the B port holds the status of the light (i
...
the status of the I/O pin 13) and it is read by
the function bitRead
...
In this way, the status of light can be known
remotely and the light can be turned on or off with the help of a mobile phone remotely
...
5

System development

The smart home system was developed by implementing the sensors and the remotely
managed light system in this project
...
The
number of sensors used and the electronic devices managed remotely can be increased or decreased according to the necessity of the application
...
The smart home system triggered alarms to intrusion into the house through
doors and windows as well as to the movement of a human being around the premises
and around the restricted areas
...
The whole system was the integration of implementation of the sensors and the light system described individually in chapters 3
...
3 and 3
...
The system is implemented on Arduino
platform using the Arduino Uno Board
...
Power supply to the unit can be provided externally or from the USB port of
the computer
...
The connection of different sensors and the shield can be seen in figure 13
...
The software written on the
platform can be uploaded to the microcontroller (i
...
the arduino board) using Arduino
IDE software
...
The
platform comes with a software library along with the code editor with features such as
syntax highlighting, brace matching and automatic indentation
...
Basically, the project is the integration of the software (C language code) used to interface and implement the sensors, the GPRS module and the
remote management of light
...


34

The application is a system from the hardware and software integration of different
modules along with the mobile station
...
It is always better to have a common ground of the system for better operation of the application, which is also followed
here as the system has a common ground
...
The main function of the mobile station is to give instructions to the microcontroller along with receiving the alerts sent from the microcontroller
...
There is no need for developing any new features in the mobile phone
to use this system
...


3
...
Then, each and every unit were interfaced and
implemented individually with the microcontroller board and drove with the software
according to the necessity of the application
...
Rather each unit of the application was tested
individually
...
After all of the
units were working correctly, the units were kept together and then the whole system
was developed and tested
...
It would be impossible
to figure out the problems and the bugs in the system if the system was developed and
tested after it was completed
...


35

Figure 15: Screenshot of the terminal program testing the communication of the GPRS
module with the mobile station

36

Figure 15 illustrates the communication of the GPRS module with the mobile station
captured in a terminal program
...
Similarly, the module is able to call a specific
number as well as the module can be operated in text mode and a message can be
sent to a specific number
...

After it was made sure that the communication of the mobile station with the GPRS
module was working according to our wish, the sensors were interfaced with the microcontroller and the result were captured and analysed with the help of a terminal program
...


Figure 16: Screenshot of the terminal program testing the final system design

37

Figure 16 illustrates the screenshot of the system
...
The system will read the incoming message immediately after it is received and an SMS will be sent if any alarm is triggered in between
reading the outputs
...
As can be seen from figure 16, the system reads an incoming message
state of light and sends back the response
...


38

4

Result

The aim of the project was to implement a smart home system and the goal was met
...
The aim of the application to manage the electronic devices remotely was also
achieved
...
As can be seen from table 2, the instructions are sent only
to the light system and the temperature sensor and they behave according to the instruction sent by the mobile phone
...


39

Figure 18: Screenshot of the mobile station managing the light remotely
Figure 18 shows a screenshot of management of electronic devices (light system) by
the mobile station (i
...
the mobile phone)
...
The light
can be turned on and off by the SMS which can be visualised, and the response to the
instruction will also be different when the light is on or off which can be seen in figure
18
...
The SMS sent by the microcontroller is different for the alarms triggered by

41

different sensors
...
It can be seen from figures 18 and 19 that the result of the application meets the concept and the motives of
the system
...
They are
dependent on technology even to carry out daily activities and technology has made
the lifestyle more sophisticated and relaxing
...
Advanced technology has replaced the traditional
lifestyle of people
...
The
examples mentioned above are a few least advanced technologies replacing the traditional lifestyle
...
With the development of technology, the concept of simple home has also been
changing into smart home and the concept of home has changed drastically during the
last decade
...
It has increased the risk of burglary and intrusion using the latest
modern technologies available
...
There are different ways to have the surveillance but the easiest and most advanced technology
accessible to everybody is mobile phone surveillance
...

This project was a simple application project demonstrating a smart home system
...
The
mobile phone gets alerts on intrusion or movement around the restricted premises
along with the rise in temperature above the limit
...
The temperature of the premises
where the sensors are installed can be known at any time before reaching the critical
limit set by the user
...


43

As this project was a simple smart home system demonstration project, a few sensors
and a led light were used
...
The remote
management of electronic devices can also be extended with the use of different real
electronic devices
...
The application can be developed further using different wireless technologies such as the Bluetooth technology and infrared technology or the Internet to
communicate between the microcontroller unit and the mobile phone
...

The project was completed within the projected time with the expected result
...
There were many bugs in the software as well as connection errors in
the hardware, which came along with the development of the application and which
were solved individually
...
Accidentally, the ground connection and the power supply were interchanged which burnt
down the sensor and a new sensor had to be ordered
...

Many connection errors were faced during the project time which did not lead to the
damage of any hardware unit except the PIR sensor which was fixed up later
...
The first problem was encountered while
reading the SMS message containing the instruction by the mobile station
...

pos = msg
...
substring(pos+1);
of SMS to be read
Serial
...
print("AT+CMGR = ");
mySerial
...
The code mentioned above finds the index of the incoming message and processes it
...
Initially it was thought that there was some problem with the code but the problem was the RX buffer of the GPRS module which was
found later
...
Hence, the output of the code was something else than the index as the
code found the position of the comma of the previously processed message stored in
the buffer and the string after the comma which was the index
...
The problem was solved by clearing the RX buffer each time after processing the SMS
...
flush();
...
The opportunity is given to
the user to choose the type of sensor and to set the limit to trigger alarm as well
...
The behaviour of the system
can be changed according to the necessity of the user by adjusting the hardware and
software of the system
...
Many new experiences and knowledge were
gained during the project
...
The goal was achieved successfully
...
A hall effect proximity sensor and a passive infrared sensor
were used as detectors to detect the intrusion and movement around the restricted
premises respectively
...
Arduino Uno Board was used as a microcontroller while the SIM900 GPRS/GSM model was
used for communication between the microcontroller unit and the mobile station
...
Any mobile phone supporting the SMS could be used as a mobile station
...
Designing one’s own home security system will save hundreds of euros as it is
cheaper and the cost could be decided by the designer who is the ultimate user of the
system
...
With this concept, the designer could be able to decide the type and number
of sensors to be used and the area to be covered
...
Flexibility to the number of electronic devices controlled was also available in the application
...
However the system is limited to the GSM network available and will not
work if the GSM network is not available
...
The project could be further extended
by using other technologies for communication, for example wireless communication
using radio frequency, the Bluetooth technology or the Internet
...


46

References
1

Arduino
...
Italy: Arduino
URL: http://arduino
...
Arduino board Uno [Online]
...
cc/en/Main/ArduinoBoardUno
Accessed 17 July 2013

3

Atmel Corporation
...
USA: Atmel Corporation;
10/2009
URL: http://www
...
com/Images/doc8161
...
Telecommunications Network Engineering
...
London: Artech
House Inc; 2003
...
V
...
The Netherlands: ActiveXperts Software B
...

URL : http://www
...
com/mmserver/cellular/gprsintro/
Accessed 18 July 2013

6

SIMCom Wireless Solutions Co
...
SIM900 Specifications [Online]
...

URL: http://wm
...
com/producten
...
Introduction to AT commands and its uses [Online]
...
Ltd; 2010
...
codeproject
...
Sensors and Transducers
...
India: PHI Learning Pvt
...


9

Vetelino J
...
Introduction to Sensors
...


10

Chang Liu
...
2nd ed
...


11

Newman R
...
Smart MEMS and Sensor Systems
...


12

Watlow Missouri Inc
...
USA: Watlow Missouri Inc
...
mc
...
il/Media/Doc/TechnicalInformation/Temp_Measuring1
...
An Introduction to diode thermal measurements [Online]
...

URL:
http://www
...
net/An_Introduction_to_Diode_Thermal_Measurements6
...
LM35 Precision Centigrade Temperature Sensors
...

URL: http://www
...
com/lit/ds/symlink/lm35
...
Thermal Infrared Sensors: Theory, Optimisation and Practice
...


16

International Commision on Illumination
...
3rd ed
...
1))
...
and Dipaola S
...
2nd ed
...
Passive Infrared Motion Sensors [Online]
...

URL: http://www
...
com/datasheets/1537854
...
and Overshott J
...
USA: VCH Publishers Inc; 1989

20

Edward Ramsden
...
2nd ed
...
K: Elsevier Inc; 2006
...
Hall Effect Sensing and Application [Online]
...

URL: http://sensing
...
com/index
...


22

Comus Europe Ltd
...
U
...

URL: http://www
...
com/datasheets/1657826
...
h>
#include "pins_arduino
...
h>
SoftwareSerial mySerial(7, 8);
String msg = String("");
char data;
//int alarm_light = 5;
int led = 13;
int Temp_sensor = A0;
int door_snsr=9;
int pir_snsr=10;
int val,pos,output,door_output,pir_output;
int count_pir=0;
int ind_pir=0;
int ind_temp=0;
int count_temp = 0;
float temp;
String index;
boolean sms_content_flag_on = 0;
boolean sms_content_flag_off = 0;
boolean sms_content_flag_critical = 0;
boolean sms_content_flag_temp = 0;
boolean sms_content_flag_door = 0;
boolean sms_content_flag_pir = 0;
void setup()
{
mySerial
...
begin(19200);
of Arduino baud rate
...
println("AT+CPIN=4510");
sim
delay(5000);
mySerial
...
println("AT+CMGDA=\"DEL ALL\"");
all the messages available in the storage area
delay(1000);
}
void loop()
{
read_temperature();
the temperature
read_doorsensor();
the door sensor
read_pirsensor();
the pir sensor

//delete

//function to read
//function to read
//function to read

if (mySerial
...
available()){
data = mySerial
...
println(msg);
if(msg
...
println("goes inside cmti");
process_gprs();
}
}
}

/**********************************************************
*******
READ TEMPERATURE VALUE
***********************************************************
******/
void read_temperature(){
output = analogRead(Temp_sensor);
//reads
the output of LM35DZ
delay(1000);
temp = (5
...
println(temp);

Appendix 1
3 (7)

if(temp > 23)
//if the
temperature exceeds 45C,sends an sms to the number
{
count_temp=count_temp+1;
Serial
...
println(door_output);
if(door_output == LOW){
sms_content_flag_door = 1;
send_sms();
}
}
/**********************************************************
READ THE PIR SENSOR
***********************************************************
**/
void read_pirsensor()
{
pir_output = digitalRead(pir_snsr);
delay(1000);

Appendix 1
4 (7)

Serial
...
println(count_pir);
if(count_pir == 1 || count_pir == 5*ind_pir){
sms_content_flag_pir = 1;
send_sms();
}
}
}
/**********************************************************
************
SEARCH THE INDEX OF THE SMS AND READ THE CONTENT OF THE
SMS MESSAGE
***********************************************************
**********/
void process_gprs(){
pos = msg
...
println(pos);
String index = msg
...
println(index);
mySerial
...
println(index);
//read the incoming sms
delay(1000);
if(msg
...
println("goes inside cmgr");
process_sms();
}
}

/**********************************************************
********
PERFORMS THE ACTION ACCORDING TO THE CONTENT OF THE MESSAGE
***********************************************************
******/
void process_sms(){

Appendix 1
5 (7)

Serial
...
indexOf("Turn light on") >= 0){
Serial
...
indexOf("Turn light off") >= 0){
Serial
...
indexOf("What is the temperature?") >=0){
sms_content_flag_temp = 1;
send_sms();
}
if(msg
...
println("it is inside the case0");
sms_content_flag_off=1;
send_sms();
break;
case 1:
sms_content_flag_on =1;
send_sms();
Serial
...
println(val);
break;
}
}
mySerial
...
println(index);
//removes the message
after it is executed to keep the sim memory free
mySerial
...
println("the buffer is deleted cleared");
}
void clear_msg(){
msg="";
}

Appendix 1
6 (7)

/***********************************************
SENDS THE SMS MESSAGES TO THE MOBILE PHONE
**********************************************/
void send_sms(){
//mySerial
...
println("AT + CMGS =
\"+358443507372\"");//send sms message, be careful need to
delay(100);
//add a country code before the cellphone number
if(sms_content_flag_on == 1)
mySerial
...
println("The light is off ");
if(sms_content_flag_critical == 1){
ind_temp++;
mySerial
...
println("someone has opened the door ");
if(sms_content_flag_pir == 1){
ind_pir++;
mySerial
...
println("The temperature is ");
mySerial
...
println((char)26);//the ASCII code of the
ctrl+z is 26
delay(100);
mySerial
...


sms_content_flag_on = 0;
sms_content_flag_off = 0;
sms_content_flag_critical = 0;
sms_content_flag_temp = 0;
sms_content_flag_door = 0;
sms_content_flag_pir = 0;

Appendix 2
1 (1)


Title: Design and Implementation of a Smart Home System
Description: A smart home or building is a home or building, usually a new one, that is equipped with special structured wiring to enable occupants to remotely control or program an array of automated home electronic devices by entering a single command