Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

D 418

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

CHAPTER 1

INTRODUCTION
1. INTRODUCTION:
Today we are living in 21st century where automation is playing an important role in
human life. Home automation allows us to control household appliances like light,
door, fan, AC etc. It also provides home security and emergency system to be
activated. Home automation not only refers to reducing human efforts but also
energy efficiency and timesaving. The main objective of home automation and
security system is to control home appliances by using different techniques like
android application, web pages, GSM when a person is away from home. The
system alerts the person in case a burglar enters the house by sending SMS on
person’s mobile phone which will enable them to protect their home from burglars.
The system also helps old people by controlling home appliances with the help of
their mobile phones as they do not need to go to different locations for turning the
appliance ON orOFF.
Main purpose of home automation is “SAVE ELECTRICITY”. With this
technology everyone can control the home equipment or office equipment
automatically. The system is secured, user- friendly, reliable, flexible and affordable

Different techniques have been employed in order to implement home


automation and security system efficiently. This research paper discusses Arduino,
GSM, and Android based Home Automation and Security System with their
implementation.
Home Automation and Security System based on Arduino implies that
whenever a person will enter the house then the count of number of the persons will
get incremented, bulb will start glowing and alarm will startring. The count of the
number of persons present in the room will be displayed on the LCD screen.
Whenever the room gets empty i.e. the count of the person reduces to zero then the
bulb will automatically stopg lowing making the system power efficient.
Home Automation and Security System based on GSM and Android application

1
implies that whenever a person tries to enter into the house then a SMS will be sent
to house owner’s mobile phone indicating the presence of some person inside the
house and the house owner can take some preventive measure in order to protect
this house from the burglar. More over the person can control the home appliances
using an android application present in the mobile phone which will reduce the
human hard work. The list of various home appliances along with TURN ON and
TURNOFF buttons will be provided in an android application. By clicking on that
particular button the person will be able to TURN ON and TURN OFF the home
appliances using an androidapplication.
1.1 Block diagram:

Fig1.1:Block diagram of the system

2
1.2 Circuit diagram:

Fig 1.2:Circuit diagram

3
1.3 Flow chart:

Fig 1.3: Flow chart of arduino based home automation

4
CHAPTER 2
HISTORY OF EMBEDDED SYSTEMS
2.1. Embedded systems:
In the earliest years of computers in the 1930-40’s, computers were sometimes
dedicated to a single task, but were far too large and expensive for most kinds of tasks
performed by embedded computers of today. Over time however, the concept of
programmable controllers evolved from traditional electromechanical sequencers, via
solid state devices, to the use of computer technology. One of the first recognizably
modern embedded systems was the Apollo Guidance Computer, developed by
Charles Stark Draper at the MIT Instrumentation Laboratory. At the project’s
inception, the Apollo guidance computer was considered the riskiest item in the
Apollo project the newly developed monolithic integrated circuits to reduce the size
and weight. An early mass-produced embedded system was the Autonetics D-17
guidance computer for the Minutemaid missile, released in 1961. It was built from
transistor logic and had a hard disk for main memory. When the Minutemaid II went
into production in 1966, the D-17 was replaced with a new computer that was the first
high-volume use of integrated circuits. This program alone reduced prices on quad
Nand gate ICs from $1000/each to $3/each, permitting their use in commercial
products.
Since these early applications in the 1960s, embedded systems have come
down in price and there has been a dramatic rise in processing power and
functionality. The first microprocessor for example, the Intel 4004, was designed for
calculators and other small systems but still required many external memory and
support chips. In 1978 National Engineering Manufacturers Association released a
“standard” for program able microcontrollers, including almost any computer-based
controllers, such as single board computers, numerical, and event-based controllers.
By the mid-1980s, most of the common previously external system components had
been integrated into the same chip as the processor and this modem form of the
microcontroller allowed an even more widespread use, which by the end of the decade
were the norm rather than the exception for almost all electronic devices.
The integration of microcontrollers has further increased the applications for

5
which embedded systems are used into areas where traditionally a computer would
not have been considered. A general purpose and comparatively low-cost
microcontroller may often be programmed to fulfill the same role as a large number of
separate components. Although in this context an embedded system is usually more
complex than a traditional solution, most of the complexity is contained within the
microcontroller itself. Very few additional components may be needed and most of
the design effort is in the software. The intangible nature of the software makes it
much easier to prototype and test new visions compared with the design and
construction of a new circuit not using an embedded processor.
In this world of knowledge everything around us is run by Computing
Systems. The technical Brilliance and Developments in different fields has led to a
drastic change in our lives especially in the communications field. Due to various
changes in technologies many systems have come up with breathtaking developments.
One amongst them is the EMBEDDED SYSTEMS. It is the evolution or further
development of computing system. Its applications provide tremendous opportunities
for creative use of computer technology. Almost every new system introduced in the
market is an example of Embedded System.
An embedded system is basically a close interaction of hardware and software.
The design part involves different instruction sets in terms of functionality,
compactness of code, power consumption, performance, and reliability so on. The
Embedded software interacts with the hardware circuitry to generate the desired
functionality. An embedded system typically comprises the hardware, embedded
RTOS, device drivers, communication stacks and embedded application software.
Apart from the common computer applications there are many applications, which do
not need high performances.
2.2 Main components of embedded system:
1. Embeds hardware to give computer like functionalities
2. Embeds main application software generally into flash or ROM and the application
software performs concurrently the number of tasks.
3. Embeds a real time operating system (RTOS), which supervises the application
software asks running on the hardware and organizes the accesses to system resources
according to priorities and timing constraints of tasks in the system.

6
Fig. 2.1: Typical Embedded System Hardware Unit.
2.3. Processor in embedded system
Program Flow and data path Control Unit (CU) —includes a fetch unit for fetching
Execution Unit (EU) —includes circuits for arithmetic and logical unit
(ALU), and for instructions for a program control task, say, data transfer instructions,
halt, Interrupt or jump to another set of instructions call to another routine or sleep or
reset

`
Fig 2.2: Processor in Embedded Systems
1a. General purpose microprocessor
For example, Intel 80x86, Sparc, or Motorola 68HCxxx
1b. Embedded general purpose processor
Fast context switching features, use of on-chip Compilers, for example, Intel® X
Scale™

7
Applications: Personal Internet Client Architecture-based PDAs, cell phones and
other wireless devices.

2. Application Specific Instruction-Set Processor (ASIP)


(a)Microcontroller — Intel, Motorola, Hitachi, TI, Philips and ARM, for example, an
Intel®MCS51, Philips®51XA, 51MX, or Motorola — 68HC11, 68HC12, 68HC16
(b) DSP or Typically a Texas Instruments- C28xSeries, C54xx or C64xx or Analog
Devices SHARPC or Tiger SHARC, Motorola 5600xx
(c) Media processor TI DSP TMS320DM310 or Trimedia Phillips Media Processor
1x00series for Processing Streaming and Data Networks and Image, Video and
Speech: PNX 1300, PNX 1500(2002)
(d) IO processor or
(e) Network processor or
(f) A domain specific processor
3. GPP or ASIP core (s)
GPP or ASIP integrated into either an Application Specific Integrated Circuit
(ASIC), or a Very Large Scale Integrated Circuit (VLSI) circuit or a FPGA core
integrated with Processor unit(s) in a VLSI (ASIC) chip
4. Application Specific System Processor (ASSP)
Typically a set top box processor or mpeg video-processor or network application
Processor or mobile application processor
5. Single purpose processor or Application Specific Instruction processor
• Floating point Coprocessor
• CCD Pixel coprocessor and image codec in digital camera
• Graphic processor
• Speech processor
• Adaptive filtering processor Encryption engine
• Decryption engine
• Communication protocol stack processor
• Java accelerator Examples Java Accelerator Nazonin Communications Java codes
run 15 To 60 Times fast, Video Accelerator for fast Video Processing
6. Multi core processors or multiprocessor system using GPPs

8
Examples
• Multiprocessor system for Real time performance in a video-conference system,
• Embedded firewall cum router, High-end cell phone.
2.4. Classification of embedded systems:
1. Small scale embedded system:
• Single 8 bit or 16bit Microcontroller.
• Little hardware and software complexity.
• They May even be battery operated.
• Usually “C” is used for developing these system.
• The need to limit power dissipation when system is running continuously.
Programming tools: Editor, Assembler and Cross Assembler15.
2. Medium scale embedded system
• Single or few 16 or 32 bit microcontrollers or Digital Signal Processors (DSP) or
Reduced Instructions Set Computers (RISC).
• Both hardware and software complexity.
Programming tools: RTOS, Source code Engineering Tool, Simulator, Debugger and
Integrated Development Environment (IDE).16
3. Sophisticated embedded system
• Enormous hardware and software complexity.
• Which may need scalable processor or configurable processor and programming
logic arrays.
• Constrained by the processing speed available in their hardware units.
Programming Tools: For these systems may not be readily available at a reasonable
cost or may not be available at all. A compiler or re-targetable compiler might have to
be developed for this.

9
CHAPTER 3

MICRO CONTROLLER
3.1 ArduinoMega2560:

Fig 3.1 Arduino Mega 2560

The Arduino Mega 2560 is a microcontroller board based on the ATmega2560


(datasheet). It has 54 digital input/output pins (of which 14 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; simply connect it to a
computer with a USB cable or power it with a AC-to-DC adapter or battery to get
started. The Mega is compatible with most shields designed for the
ArduinoDuemilanove or Diecimila.
3.2 Power :
The Arduino Mega can be powered via the USB connection or with an external power
supply. The power source is selected automatically.

10
 External (non-USB) power can come either from an AC-to-DC adapter (wall-
wart) or battery. The adapter can be connected by plugging a 2.1mm center-
positive plug into the board's power jack. Leads from a battery can be inserted in
the Gnd and Vin pin headers of the POWER connector.
 The board can operate on an external supply of 6 to 20 volts. If supplied with less
than 7V, however, the 5V pin may supply less than five volts and the board may
be unstable. If using more than 12V, the voltage regulator may overheat and
damage the board. The recommended range is 7 to 12 volts.
 The Mega2560 differs from all preceding boards in that it does not use the FTDI
USB-to-serial driver chip. Instead, it features the Atmega8U2 programmed as a
USB-to-serial converter.
 The power pins are as follows:
 VIN. The input voltage to the Arduino board when it's using an external power
source (as opposed to 5 volts from the USB connection or other regulated
power source). You can supply voltage through this pin, or, if supplying
voltage via the power jack, access it through this pin.
 5V. The regulated power supply used to power the microcontroller and other
components on the board. This can come either from VIN via an on-board
regulator, or be supplied by USB or another regulated 5V supply.
 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current
draw is 50 mA.
GND. Ground pins.

3.3 Memory:
The ATmega2560 has 256 KB of flash memory for storing code (of which 8
KB is used for the bootloader), 8 KB of SRAM and 4 KB of EEPROM (which can be
read and written with the EEPROM library).
3.4 Input and Output:
Each of the 54 digital pins on the Mega can be used as an input or output,
using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts.
Each pin can provide or receive a maximum of 40 mA and has an internal pull-up

11
resistor (disconnected by default) of 20-50 kOhms. In addition,
some pins have specialized functions:
 Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX)
and 16 (TX); Serial 3: 15 (RX) and 14 (TX). Used to receive (RX) and
transmit (TX) TTL serial data. Pins 0 and 1 are also connected to the
corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.
 Used with analog Reference ().
 PWM: 0 to 13. Provide 8-bit PWM output with the analogWrite() function.
 SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI
communication using the SPI library. The SPI pins are also broken out on the
ICSP header, which is physically compatible with the Uno, Duemilanove and
Diecimila.
 LED: 13. There is a built-in LED connected to digital pin 13. When the pin is
HIGH value, the LED is on, when the pin is LOW, it's off.
 I2C: 20 (SDA) and 21 (SCL). Support I2C (TWI) communication using the
Wire library (documentation on the Wiring website). Note that these pins are
not in the same location as the I2C pins on the Duemilanove or Diecimila.
The Mega2560 has 16 analog inputs, each of which provide 10 bits of resolution
(i.e. 1024 different values). By default they measure from ground to 5 volts, though is
it possible to change the upper end of their range using the AREF pin and analog
Reference() function.
There are a couple of other pins on the board
AREF: Reference voltage for the analog inputs
3.5 Communication:
The Arduino Mega2560 has a number of facilities for communicating with a
computer, another Arduino, or other microcontrollers. The ATmega2560 provides
four hardware UARTs for TTL (5V) serial communication. An ATmega8U2 on the
board channels one of these over USB and provides a virtual com port to software on
the computer (Windows machines will need a .inf file, but OSX and Linux machines
will recognize the
A Software Serial library allows for serial communication on any of the

12
Mega2560's digital pins. The ATmega2560 also supports I2C (TWI) and SPI
communication. The Arduino software includes a Wire library to simplify use of the
I2C bus; see the documentation on the Wiring website for details. For SPI
communication, use the SPI library.
3.6 Programming:
 The Arduino Mega can be programmed with the Arduino software (download).
For details, see the reference and tutorials.
 The ATmega2560 on the Arduino Mega comes preburned with a bootloader that
allows you to upload new code to it without the use of an external hardware
programmer. It communicates using the original STK500 protocol (reference, C
header files).
 You can also bypass the bootloader and program the microcontroller through the
ICSP (In-Circuit Serial Programming) header; see these instructions for board as a
COM port automatically. The Arduino software includes a serial monitor which
allows simple textual data to be sent to and from the board. The RX and TX LEDs
on the board will flash when data is being transmitted via the ATmega8U2 chip
and USB connection to the computer (but not for serial communication on pins 0
and 1).details.
 The ATmega8U2 firmware source code is available in the Arduino repository.
The ATmega8U2 is loaded with a DFU bootloader, which can be activated by
connecting the solder jumper on the back of the board (near the map of Italy) and
then resetting the 8U2. You can then use Atmel's FLIP software (Windows) or the
DFU programmer (Mac OS X and Linux) to load a new firmware. Or you can use
the ISP header with an external programmer (overwriting the DFU bootloader).
See this user-contributed tutorial for more information.

3.7 Automatic ( Software) Reset:


Rather then requiring a physical press of the reset button before an upload, the
Arduino Mega2560 is designed in a way that allows it to be reset by software running
on a connected computer. One of the hardware flow control lines (DTR) of the
ATmega8U2 is connected to the reset line of the ATmega2560 via a 100 nanofarad

13
capacitor. When this line is asserted (taken low), the reset line drops long enough to
reset the chip. The Arduino software uses this capability to allow you to upload code
by simply pressing the upload button in the Arduino environment.
This setup has other implications. When the Mega2560 is connected to either a
computer running Mac OS X or Linux, it resets each time a connection is made to it
from software (via USB). For the following half-second or so, the bootloader is
running on the Mega2560. While it is programmed to ignore malformed data (i.e.
anything besides an upload of new code), it will intercept the first few bytes of data
sent to the board after a connection is opened. If a sketch running on the board
receives one-time configuration or other data when it first starts, make sure that the
software with which it communicates waits a second after opening the connection and
before sending this data.
The Mega2560 contains a trace that can be cut to disable the auto-reset. The pads on
either side of the trace can be soldered together to re-enable it. It's labeled "RESET-
EN". You may also be able to disable the auto-reset by connecting a 110 ohm resistor
from 5V to the reset line; see this forum thread for details.
3.8USB Overcurrent Protection:
The Arduino Mega2560 has a resettable polyfuse that protects your computer's
USB ports from shorts and overcurrent. Although most computers provide their own
internal protection, the fuse provides an extra layer of protection. If more than 500
mA is applied to the USB port, the fuse will automatically break the connection until
the short or overload is removed.
3.9 Physical Characteristics and Shield Compatibility:
The maximum length and width of the Mega2560 PCB are 4 and 2.1 inches
respectively, with the USB connector and power jack extending beyond the former
dimension. Three screw holes allow the board to be attached to a surface or case. Note
that the distance between digital pins 7 and 8 is 160 mil (0.16"), not an even multiple
of the 100 mil spacing of the other pins.
The Mega2560 is designed to be compatible with most shields designed for
the Uno, Diecimila or Duemilanove. Digital pins 0 to 13 (and the adjacent AREF and
GND pins), analog inputs 0 to 5, the power header, and ICSP header are all in

14
equivalent locations. Further the main UART (serial port) is located on the same pins
(0 and 1), as are external interrupts 0 and 1 (pins 2 and 3 respectively). SPI is
available through the ICSP header on both the Mega2560 and Duemilanove /
Diecimila.

15
CHAPTER 4
HARDWARE COMPONENTS

4.1 Global system for mobile communications:


Global system for mobile communication (GSM) is a globally accepted standard for
digital cellular communication. GSM is the name of a standardization group
established in 1982 to create a common European mobile telephone standard that
would formulate specifications for a pan-European mobile cellular radio system
operating at 900 MHz. A GSM modem is a wireless modem that works with a GSM
wireless network. A wireless modem behaves like a dial-up modem. The main
difference between them is that a dial-up modem sends and receives data through a
fixed telephone line while a wireless modem sends and receives data through radio
waves.
4.1.1 History:
In 1982, the European Conference of Postal and Telecommunications
Administrations (CEPT) created the Group Special Mobile (GSM) to develop a
standard for a mobile telephone system that could be used across Europe. In 1987, a
memorandum of understanding was signed by 13 countries to develop a common
cellular telephone system across Europe.
In 1989, GSM responsibility was transferred to the European
Telecommunications Standards Institute (ETSI) and phase I of the GSM
specifications were published in 1990. The first GSM network was launched in 1991
by Radiolinja in Finland with joint technical infrastructure maintenance from
Ericsson. By the end of 1993, over a million subscribers were using GSM phone
networks being operated by 70 carriers across 48 countries.
A summary of GSM milestones are:

16
4.1.2 Definition:
GSM (Global System for Mobile communications) is an open, digital cellular
technology used for transmitting mobile voice and data services. GSM differs from
first generation wireless systems in that it uses digital technology and time division
multiple access transmission methods. GSM is a circuit-switched system that divides
each 200kHz channel into eight 25kHz time-slots. GSM operates in the 900MHz and
1.8GHz bands in Europe and the 1.9GHz and 850MHz bands in the US. The 850MHz
band is also used for
GSM and 3GSM in Australia, Canada and many South American countries. GSM
supports data transfer speeds 9.6 kbit/s, allowing the transmission of basic data
services such as SMS (Short Message Service). GSM satellite roaming has also
extended service access to areas where terrestrial coverage is not available. The
transmission power in the handset is limited to a maximum of 2 watts in GSM850/900
and 1 watt in GSM1800/1900.
GSM has used a variety of voice codec’s to squeeze 3.1 kHz audio into
between 5.6 and 13 Kbit/s. Originally, two codes named after the types of data
channel they were allocated, were used, called Half Rate (5.6 Kbit/s) and Full Rate
(13 Kbit/s). These used a system based upon linear predictive coding (LPC). In
addition to being efficient with bitrates, these codes also made it easier to identify
more important parts of the audio, allowing the air interface layer to prioritize and
better protect these parts of the signal.
GSM was further enhanced in 1997 with the Enhanced Full Rate (EFR) codec,

17
a 12.2 Kbit/s codec that uses a full rate channel. Finally, with the development of
UMTS, EFR was made refectory into a variable-rate codec called AMR-Narrowband,
which is high quality and robust against interference when used on full rate channels,
and less robust but still relatively high quality when used in good radio conditions on
half-rate channels.
There are four different cell sizes in a GSM network—macro, micro, pico and
umbrella cells. The coverage area of each cell varies according to the implementation
environment. Macro cells can be regarded as cells where the base station antenna is
installed on a mast or a building above average roof top level. Micro cells are cells
whose antenna height is under average roof top level; they are typically used in urban
areas. Pico cells are small cells whose coverage diameter is a few dozen meters; they
are mainly used indoors. Umbrella cells are used to cover shadowed regions of
smaller cells and fill in gaps in coverage between those cells.
Cell horizontal radius varies depending on antenna height, antenna gain and
propagation conditions from a couple of hundred meters to several tens of kilometers.
The longest distance the GSM specification supports in practical use is 35 kilo
meters (22 mi). There are also several implementations of the concept of an extended
cell, where the cell radius could be double or even more, depending on the antenna
system, the type of terrain and the timing advance.
Indoor coverage is also supported by GSM and may be achieved by using an
indoor picocell base station, or an indoor repeater with distributed indoor antennas fed
through power splitters, to deliver the radio signals from an antenna outdoors to the
separate indoor distributed antenna system. These are typically deployed when a lot of
call capacity is needed indoors, for example in shopping centers or airports. However,
this is not a prerequisite, since indoor coverage is also provided by in-building
penetration of the radio signals from nearby cells.
The modulation used in GSM is Gaussian minimum-shift keying (GMSK), a
kind of continuous-phase frequency shift keying. In GMSK, the signal to be
modulated onto the carrier is first smoothed with a Gaussian low-pass filter prior to
being fed to a frequency modulator, which greatly reduces the interference to
neighboring channels (adjacent channel interference).

18
4.1.3 Architecture:
A GSM network is composed of several functional entities, whose functions
and interfaces are defined. Figure 1 shows the layout of a generic GSM network.

Fig 4.1: GSM Architecture


The GSM network can be divided into three broad parts. The Mobile Station is
carried by the subscriber. The Base Station subsystem controls the radio link with the
Mobile Station. The Network Subsystem, the main part of which is the Mobile
services Switching Center (MSC), performs the switching of calls between the mobile
and fixed network users. The Mobile Station and the Base Station subsystem
communicate across the interface, also known as the air interface or radio link. The
Base Station Subsystem communicates with the Mobile service Switching Center
across the Air interface.
1. Mobile Station (MS)
• The mobile station (MS) consists of
• Mobile Equipment (ME).
• Subscriber Identity Module (SIM).
2. Mobile Equipment (ME)
• Portable, vehicle mounted, hand held device.
• Uniquely identified by the International Mobile Equipment Identity (IMEI).
• Voice and data transmission.
• Monitoring power and quality of surrounding cells for optimum handover.
• 160 character long SMS.
3. Subscriber Identity Module (SIM)

19
• Contains the International Mobile Subscriber Identity (IMSI).
• Allows users to send and receive calls and receive other subscriber services.
• Encoded network identification details- key kick and A3, A5 and A8
algorithms.
• Protected by a password or pin.
• Can be moved from phone to phone-contains key information to activate the
phone.
• By inserting the SIM card into another GSM cellular phone, the user will be
able to receive calls at that phone, make calls from that phone.

4. Base Station Subsystem (BSS)


• The Base Station Subsystem is composed of two parts
• Base Transceiver Station (BTS).
• Base Station Controller (BSC).

5. Base Transceiver Station (BTS)


• Encodes, encrypts, multiplexes, modulates and feeds the RF signals to the
antenna.
• Frequency hopping.
• Communicates with mobile station and BSC.
• Consists of Transceivers (TRX) unit.

6. Base Station Controller (BSC)


• Manages the radio resources for BTS.
• Assigns frequency and time slots for all MS’s in its area.
• Handles call set up.
• Transcending and rate adaptation functionality.
• Handover for each MS.
• Radio power control.
• Communicates with MSC and BTS.
• Network Switching Subsystem (NSS)

7. Mobile Switching Center (MSC)

20
• Central component of the Network Subsystem.
• Manages communication between GSM and other networks.
• Acts like a normal switching node of the PSTN or ISDN.
• Provides functionality such as registration, authentication, and handovers.
• Call routing to a roaming subscriber.

8. Home Location Register (HLR)


• Permanent database about mobile subscribers in a large service area (generally
one per GSM network operator).
• Database contains IMSI, MS ISDN, pre paid/post paid, roaming restrictions
and supplementary services

9. Visitor Location Register (VLR)


• Temporary database which updates whenever new MS enter its area, by HLR
database.
• Controls those mobiles roaming in its area.
• Reduces number of quires to HLR.
• Database contains IMSI, MS ISDN, MSRN, location area, authentication key.

10. Authentication Center (AC)


• Protected database that stores a copy of secret key stored in each subscriber's
SIM card.
• Maintains authentication keys and algorithms and provides security aspects.
• Associated with HLR.

11. Equipment Identity Register (EIR)


• Database used to track the handsets using the IMEI.
• Database contains a list of all valid mobile equipment on the network.
• Only one EIR per public land mobile network.

4.1.4 GSM CHARACTERISTICS


• TDMA over radio carriers (200 KHz carrier spacing).
• 8 full rate or 16 half rate TDMA channels per carrier.
• User or terminal authentication for fraud control.

21
• Encryption of speech and data transmission over the radio path.
• Low speed data services (up to 9.6 Kb/s).
• Support of short message service (SMS).

4.1.5 Advantages of GSM


• Capacity increases.
• Reduced RF transmission power and longer battery life.
• International roaming capability.
• Better security against fraud.
• Encryption capability for information security and privacy.
• Compatibility with ISDN, leading to wider range of services.

4.1.6 GSM modem which is used in practical:

Fig 4.2 : GSM modem


Hardware Explanation:
Here, we use a micro controller which is of 8051 series. It has antenna which
is in the form of wire. It has external slot for SIM allocation. We can keep any
network SIM which is a GSM model. It needs an external power supply, which is
given by using adaptor which supports 9v and 2A. It has two LED’s for indication of
power and network signaling respectively. Power LED emits light continuously.
Network signaling LED, at starting blinks faster and after sometime it starts blinking
slowly like single blink per minute. This indicates the SIM got signal according to its
network. Then it can send message to any network.
4.1.7 GSM Applications:
• Mobile telephony.
• Telemetry system.

22
• Fleet management.
• Automatic meter reading.
• Toll collection.

TABLE 4.1:Basic specifications of GSM


S.NO PARAMETER SPECIFICATIONS

1 Reverse channel frequency 890-915MHz

2 Forward channel frequency 935-960MHz

3 Tx/Rx frequency spacing 45MHz

4 Tx/Rx Time slot spacing 3 time slots

5 Modulation data rate 270.833333Kbps

6 Frame period 4.615ms

7 Users per frame 8

8 Time slot period 576.9microsecond

9 Bit period 3.692microsecond

10 Modulation 0.3GMSK

11 ARFCN Number 0 to 124 &975 to 1023

12 ARFCN Channel spacing 200KHz

13 Interleaving 40ms

14 Voice coder bit rate 13.4Kbps

4.2 NodeMCUmodule:
NodeMCU is an open source IoT platform. It includes firmware which runs on the
ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based on the
ESP-12 module The term "NodeMCU" by default refers to the firmware rather than
the dev kits. The firmware uses the Lua scripting language. It is based on the eLua
project, and built on the Espressif Non-OS SDK for ESP8266. It uses many open
source projects, such as lua-cjson, and spiffs.

23
Fig 4.3 :NodeMcu Module

4.2.1 HISTORY:
NodeMCU was created shortly after the ESP8266 came out. On December 30,
2013, Espress if Systems began production of the ESP8266. The ESP8266 is a Wi-Fi
SoC integrated with a Tensilica Xtensa LX106 core, widely used in IoT applications.
NodeMCU started on 13 Oct 2014, when Hong committed the first file of nodemcu-
firmware to GitHub. Two months later, the project expanded to include an open-
hardware platform when developer Huang R committed the gerber file of an ESP8266
board, named devkit v0.9. Later that month, Tuan PM ported MQTT client library
from Contiki to the ESP8266 SoC platform, and committed to NodeMCU project,
then NodeMCU was able to support the MQTT IoT protocol, using Lua to access the
MQTT broker. Another important update was made on 30 Jan 2015, when Devsaurus
ported the u8glib to NodeMCU project, enabling NodeMCU to easily drive LCD,
Screen, OLED, even VGA displays.
In summer 2015 the creators abandoned the firmware project and a group of
independent but dedicated contributors took over. By summer 2016 the NodeMCU
included more than 40 different modules. Due to resource constraints users need to
select the modules relevant for their project and build a firmware tailored to their
needs.
4.2.2 ESP8266 Arduino Core :
As Arduino.cc began developing new MCU boards based on non-AVR
processors like the ARM/SAM MCU and used in the Arduino Due, they needed to
modify the Arduino IDE so that it would be relatively easy to change the IDE to
support alternate tool chains to allow Arduino C/C++ to be compiled down to these

24
new processors. They did this with the introduction of the Board Manager and the
SAM Core. A "core" is the collection of software components required by the Board
Manager and the Arduino IDE to compile an Arduino C/C++ source file down to the
target MCU's machine language. Some creative ESP8266 enthusiasts have developed
an Arduino core for the ESP8266 WiFiSoC that is available at the GitHub ESP8266
Core webpage. This is what is popularly called the "ESP8266 Core for the Arduino
IDE" and it has become one of the leading software development platforms for the
various ESP8266 based modules and development boards, including NodeMCUs.
4.2.3NodeUSB :
NodeUSB is an open IoT platform about the size of a standard USB stick. It
was designed to leverage NodeMCU (Lua) for easy programming and has the extra
feature of USB capability. It is ideal for Plug-n-Play solutions, allowing easy
prototyping for developers.
4.3 MOTION SENSOR:
PIR sensors allow you to sense motion, almost always used to detect whether a
human has moved in or out of the sensors range. They are small, inexpensive, low-
power, easy to use and don't wear out. For that reason they are commonly found in
appliances and gadgets used in homes or businesses. They are often referred to as
PIR, "Passive Infrared", "Pyroelectric", or "IR motion" sensors

Fig 4.4 : Motion Sensor


PIRs are basically made of a pyroelectric sensor (which you can see below as the
round metal can with a rectangular crystal in the center), which can detect levels of
infrared radiation. Everything emits some low level radiation, and the hotter
something is, the more radiation is emitted. The sensor in a motion detector is actually
split in two halves. The reason for that is that we are looking to detect motion

25
(change) not average IR levels. The two halves are wired up so that they cancel each
other out. If one half sees more or less IR radiation than the other, the output will
swing high or low.

Fig 4.5: Motion Sensor circuit diagram


Some Basic Stats These stats are for the PIR sensor in the Adafruit shop which is
very much like the Parallax one . Nearly all PIRs will have slightly different
specifications, although they all pretty much work the same. If there's a datasheet,
you'll want to refer to it
 Size: Rectangular
 Output: Digital pulse high (3V) when triggered (motion detected) digital low
when idle (no motion detected). Pulse lengths are determined by resistors and
capacitors on the PCB and differ from sensor to sensor.
 Sensitivity range: up to 20 feet (6 meters) 110° x 70° detection range.
 Power supply: 5V-12V input voltage for most modules (they have a 3.3V
regulator), but 5V is ideal in case the regulator has different specs.
4.4 Temperature and Humidity Sensor:
DHT11 detects water vapor by measuring the electrical resistance between
two electrodes. The humidity sensing component is a moisture holding substrate with
electrodes applied to the surface. When water vapor is absorbed by the substrate, ions
are released by the substrate which increases the conductivity between the electrodes.
The change in resistance between the two electrodes is proportional to the relative

26
humidity. Higher relative humidity decreases the resistance between the electrodes,
while lower relative humidity increases the resistance between the electrodes.

Fig 4.6:Temperature and Humidity Sensor


• The Matrix-Temperature_and_Humidity_Sensor module is used to detect
temperature and humidity.
• It utilizes the DHT11 temperature and humidity sensor. Its humidity range is 20% -
80% and the accuracy is 5%. Its temperature range is 0 – 50% and the accuracy is
±2%.
4.4.1 Features:
• Humidity range: 20 - 80%RH, Temperature range 0 ~ 50℃
• Accuracy of humidity: +-5%RH, accuracy of temperature: +-2℃
• One wire communication
• 2.54 mm spacing pin
• PCB dimension (mm): 16 x 32

27
Fig 4.7:Temperature and Humidity Sensor layout
Table 4.2: Pin Description

Pin Description

S GPIO

V Supply Voltage 5V

G Ground

4.4.2 Basic Device Operation :


The DHT11 module uses a simplified single-bus serial communication. DATA
controls communication and synchronization between the microprocessor and
DHT11. A data transfer takes 4ms. The data format contains an integer part and a
decimal part.
The basic operation is as follows:
• a transmission of 40 data, the high first-out
• data format: 8bit humidity integer data + 8bit the Humidity decimal data
• 8bit temperature integer data + 8bit fractional temperature data

28
• 8 bit parity bit
• If a transmission is successful the “8bit humidity integer data + 8bit humidity
decimal data +8 bit temperature integer data + 8bit temperature fractional data”
8bit checksum is equal to the results of the last eight.
• After the user host (MCU) sends a signal DHT11 is converted from low-power
mode to high-speed mode, until the host begins to signal the end. Then DHT11
sends a response signal to send 40bit data, and trigger a letter collection. If
DHT11 doesn't receive a signal from the host it will not begin a letter collection.
After the letter collection is done DHT11 will turn to low power mode.

4.5 IR SENOR:
Infrared Obstacle Sensor Module has builtin IR transmitter and IR receiver
that sends out IR energy and looks for reflected IR energy to detect presence of any
obstacle in front of the sensor module. The module has on board potentiometer that
lets user adjust detection range. The sensor has very good and stable response even in
ambient light or in complete darkness.

Fig 4.8: IR Sensor


4.5.1 Working Principle of IR Obstacle Sensor :
An IR sensor consists of an IR LED and an IR Photodiode; together they are
called as Photo–Coupler or Opto–Coupler. As said before,the Infrared Obstacle
Sensor has builtin IR transmitter and IR receiver.Infrared Transmitter is a light
emitting diode (LED) which emits infrared radiations. Hence, they are called IR
LED’s. Even though an IR LED looks like a normal LED, the radiation emitted by it
is invisible to the human eye. Infrared receivers are also called as infrared sensors as
they detect the radiation from an IR transmitter. IR receivers come in the form of
photodiodes and phototransistors. Infrared Photodiodes are different from normal

29
photo diodes as they detect only infrared radiation. When the IR transmitter emits
radiation, it reaches the object and some of the radiation reflects back to the IR
receiver. Based on the intensity of the reception by the IR receiver, the output of the
sensor is defined

Fig 4.9: IR Sensor Circuit Diagram


When we turn ON the circuit there is no IR radiation towards photodiode and
the Output of the comparator is LOW. When we take some object (not black) in front
of IR pair, then IR emitted by IR LED is reflected by the object and absorbed by the
photodiode. Now when reflected IR Falls on Photodiode, the voltage across
photodiode drops, and the voltage across series resistor R2 increases. When the
voltage at Resistor R2 (which is connected to the non-inverting end of comparator)
gets higher than the voltage at inverting end, then the output becomes HIGH and LED
turns ON.
Voltage at inverting end, which is also called Threshold Voltage, can be set by
rotating the variable resistor’s knob. Higher the voltage at inverting end (-), less
sensitive the sensor and Lower the voltage at inverting end (-), more sensitive the
sensor.
4.6 Liquid Crystal Display:
To understand the operation of an LCD, it is easiest to trace the path of a light
ray from the backlight to the user. The light source is usually located directly behind
the LCD, and can use either LED or conventional fluorescent technology. From this
source, the light ray will pass through a light polarizer to uniformly polarize the light.
So it can be acted upon by the liquid crystal (LC) matrix. The light beam will then
pass through the LC matrix, which will determine whether this pixel should be “on”

30
or “off”. If the pixel is “on”, the liquid crystal cell is electrically activated, and the
molecules in the liquid will align in a single direction. This will allow the light to pass
through unchanged. If the pixel is “off”, the electric field is removed from the liquid,
and the molecules with in scatter. This dramatically reduces the light that will pass
through the display at that pixel.

Fig 4.10: A general purpose alphanumeric lcd, with two lines of display
In a color display, after the light passes through the liquid crystal matrix, it
passes through a color filter (usually glass). This filter blocks all wavelengths of light
except those within the range of that pixel. In a typical RGB display, the color filter is
integrated into the upper glass colored microscopically to render each individual pixel
red, green or blue. The areas in between the colored pixel filter areas are printed black
to increase contrast. After a beam of light passes through the color filter, it passes
through yet another polarizer to sharpen the image and eliminate glare.

Fig 4.11: LCD Pin Diagram


4.6.1 Features:
• Interface with either 4-bit or 8-bit microprocessor.
• Display data RAM.
• Character generator ROM, RAM.
• Numerous instructions.
• Clear Display, Cursor Home, Display ON/OFF, Cursor.

31
• ON/OFF, Blink Character, Cursor Shift, Display Shift.

4.6.2 Pin diagram and explanation:


VCC and VSS are supply pins and VEE (Pin no.3) is used for controlling LCD
contrast. Pin No.4 is RS pin for selecting the register, there are two very important
registers are there inside the LCD. The RS pin is used for their selection as follows. If
RS=0, the instruction command code register is selected, allowing the user to send
data to be displayed on the LCD. R/W is a read or writes Pin, which allows the user to
write information to the LCD or read information from it. R/W=1 when reading
R/W=0 when writing. The LCD to latcGh information presented to its data pins uses
the enable (E) pin. The 8-bit data pins, D0-D7, are used to send information to the
LCD or read the contents of the LCD’s internal registers. To display letters and
numbers, we must send ASCII codes for the letters A-Z, and number 0 -9 to these pins
while making RS=1.
4.6.3 Interfacing LCD to the microcontroller:
This does not use the Bi-directional feature found on newer ports, thus it
should work with most, if not all Parallel Ports. It however does not show the use of
the status port as an input. A 16 Character X 2 Line LCD module is interfaced to the
parallel port. These LCD modules are very common these days, and are quite simple
to work with, as all the logic required for running them is on board.

Fig. 4.12: Interfacing of LCD to a Microcontroller

32
4.7 Relay Module:
This relay module allows you to combine the processing power of the Arduino to
devices that use higher current and voltage. It does so by providing four relays that
are rated for 7A at either 28VDC or 10A at 125VAC. Each relay has a Normally
Open (NO) and a Normally Closed (NC) contact.
With these relays you can control:
 Appliances
 Motors
 Lights
 Other Relay
4.7.1: Relay Module Inputs:
The module is supplied with power via the pin labeled VCC and ground via
the pin labeled GND.The relays are energized with low inputs to the IN1, IN2, IN3
and IN4 inputs.

Fig 4.13: Relay Board


There are four relays that each provide dry contact outputs. That is to say that
each relay provides a common (COM) , normally open (NO) and a normally closed
(NC) terminal.

33
Fig 4.12: Relay Board Common Connetions
4.7.3 Advantages:
• Sophisticated security.
• Monitors all hazards and threats.
• Alert message to mobile phone for remote information.
• Mobile number can be changed at any time.

4.8 TRANSISTOR BC547:


BC547 is a NPN transistor hence the collector and emitter will be left open
(Reverse biased) when the base pin is held at ground and will be closed (Forward
biased) when a signal is provided to base pin. BC547 has a gain value of 110 to 800,
this value determines the amplification capacity of the transistor. The maximum
amount of current that could flow through the Collector pin is 100mA, hence we
cannot connect loads that consume more than 100mA using this transistor. To bias a
transistor we have to supply current to base pin, this current (IB) should be limited
to 5mA.

34
Fig 4.13: Transistor BC547
Table 4.3: Pin Configuration

Pin
Pin Name Description
Number

1 Collector Current flows in through collector

2 Base Controls the biasing of transistor

3 Emitter Current Drains out through emitter

When this transistor is fully biased then it can allow a maximum of 100mA to
flow across the collector and emitter. This stage is called Saturation Region and the
typical voltage allowed across the Collector-Emitter (V¬CE) or Base-Emitter (VBE)
could be 200 and 900 mV respectively. When base current is removed the transistor
becomes fully off, this stage is called as the Cut-off Region and the Base Emitter
voltage could be around 660 mV.

35
CHAPTER 5
SOFTWARE DESCRIPTION
5.1. PROGRAMMING LANGUAGE:
The programming language used is EMBEDDED C.
EMBEDDED C PROGRAMMING:
Embedded C is a set of language extensions for the C programming language by the C
Standards Committee to address commonality issues that exist between C extensions
for different embedded systems. Historically, embedded C programming requires
nonstandard extensions to the C language in order to support exotic features such
as fixed-point arithmetic, multiple distinct memory banks, and basic I/O operations.
In 2008, the C Standards Committee extended the C language to address these issues
by providing a common standard for all implementations to adhere to. It includes a
number of features not available in normal C, such as, fixed-point arithmetic, named
address spaces, and basic I/O hardware addressing.
Embedded C uses most of the syntax and semantics of standard C, e.g., main()
function, variable definition, datatype declaration, conditional statements (if, switch
case), loops (while, for), functions, arrays and strings, structures and union, bit
operations, macros, etc

5.2. Software:

Computer software, or just software, is a collection of computer programs and


related data that provide the instructions for telling a computer what to do and how to
do it. In other words, software is a conceptual entity which is a set of computer
programs, procedures, and associated documentation concerned with the operation of
a data processing system. We can also say software refers to one or more computer
programs and data held in the storage of the computer for some purposes. In other
words software is a set of programs, procedures, algorithms and its documentation.
Program software performs the function of the program it implements, either by
directly providing instructions to the computer hardware or by serving as input to
another piece of software. The term was coined to contrast to the old term hardware

36
(meaning physical devices). In contrast to hardware, software "cannot be touched".
Software is also sometimes used in a more narrow sense, meaning application
software only. Sometimes the term includes data that has not traditionally been
associated with computers, such as films, tapes and records.

5.3.TYPES OF SOFTWARE:

5.3.1. System Software:

System software provides the basic functions for computer usage and helps
run the computer hardware and system like Device drivers, Operating systems.
System software is responsible for managing a variety of independent hardware
components, so that they can work together harmoniously. Its purpose is to unburden
the application software, programmer from the often complex details of the particular
computer being used, including such accessories as communications devices, printers,
device readers, displays and keyboards, and also to partition the computer's resources
such as memory and processor time in a safe and stable manner.

5.3.2. Programming Software:

Programming software usually provides tools to assist a programmer in


writing computer programs, and software using different programming languages in a
more convenient way. The tools include: Compilers, Debuggers, Interpreters, Linkers,
Text editors, An Integrated development environment (IDE) is a single application
that attempts to manage all these functions.

5.3.3. Application Software:

Application software is developed to perform in any task that benefit from


computation. It is a broad category, and encompasses software of many kinds,
including the internet browser being used to display this page. This category includes:
Business software, Computer-aided design, Databases, Decision making software,
Simulation software, Video editing software, Video games etc.

37
5.4SOFTWARE USED:

The software used in the project is ARDUINO Software.

5.4.1. ARDUINO:

Arduino is an open source computer hardware and software company, project,


and user community that designs and manufactures single-board microcontrollers and
microcontroller kits for building digital devices and interactive objects that can sense
and control objects in the physical and digital world. The project's products are
distributed as open-source hardware and software, which are licensed under the GNU
Lesser General Public License (LGPL) or the GNU General Public License (GPL),
permitting the manufacture of Arduino boards and software distribution by anyone.

Arduino board designs use a variety of microprocessors and controllers. The


boards are equipped with sets of digital and analog input/output (I/O) pins that may be
interfaced to various expansion boards or Breadboards (shields) and other circuits.
The boards feature serial communications interfaces, including Universal Serial
Bus (USB) on some models, which are also used for loading programs from personal
computers. The microcontrollers are typically programmed using a dialect of features
from the programming languages C and C++. In addition to using traditional compiler
toolchains, the Arduino project provides an integrated development
environment (IDE) based on the Processing language project.

The Arduino project started in 2003 as a program for students at


the Interaction Design Institute Ivrea in Ivrea, Italy, aiming to provide a low-cost and
easy way for novices and professionals to create devices that interact with their
environment using sensors and actuators. Common examples of such devices intended
for beginner hobbyists include simple robots, thermostats, and motion detectors

5.4.2.Executing a Program inARDUINO:


These are the steps you need to follow in order to be up and running:

38
1. Get an Arduino board
2. Download the Arduino environment
3. Install the USB drivers
4. Connect the board
5. Upload a program
There are a few ways to get an Arduino board:

 buy a ready made board. See how you can buy a board or just the PCB.
o European distributor
o US distributor
 build your own board. If you want you can build your own PCB just by
downloading the CAD files from the Hardwarepage. Extract the .brd file and send it
to a PCB manufacturer. Be aware that manufacturing a single pcb will be very
expensive. It's better to get together with other people and make 20 or 30 at a time.
Since you get the full CAD files you can make your own customised version of
Arduino. if you make modifications or fix bugs please send us your changes!
o purchase parts. purchase the parts from any electronics store. The Serial version in
particular has been designed to use the most basic parts that can be found anywhere in
the world. The USB version on the other hand requires some advanced soldering
skills because of the FTDI chip that is ansmd part. Here is a list of parts for the serial
board.
o assemble the board. We put together a step by step guide on how to build an arduino
board.
o program the bootloader. In order for the development environment to be able to
program the chip, this has to be programmed with a piece of code called bootloader.
See the bootloader page on how to program it on your chip.

2 Download the Arduino environment


To program the Arduino board you need the Arduino environment.

Download Arduino: From the software page.

39
Linux note: For help getting the Arduino IDE running

Mac OS X note: After downloading the IDE, run the macosx_setup.command. It


corrects permission on a few files for use with the serial port and will prompt you for
your password. You may need to reboot after running this script.

Macro setup command

3 Install the USB drivers


If you are using a USB Arduino, you will need to install the drivers for the FTDI chip
on the board. These can be found in the drivers directory of the Arduino distribution.

On Windows, you will need to unzip FTDI USB drivers zip .Then, when you plug in
the Arduino board, point the Windows Add Hardware wizard to the FTDI USB
drivers directory.

On the Mac, mount theFTDIUSB serial Driver_v2_1_6.dmg (on PPC machines) or


theFTDIUUSB SerialDriver_v2_2_6_Intel.dmg (on Intel machines) disk image and
run the included FTDIUSBSerialDriver.pkg.

40
Installing Drivers

4 Connect the board


If you're using a serial board, power the board with an external power supply (6 to 25
volts DC, with the core of the connector positive). Connect the board to a serial port
on your computer.

On the USB boards, the power source is selected by the jumper between the USB and
power plugs. To power the board from the USB port (good for controlling low power
devices like LEDs), place the jumper on the two pins closest to the USB plug. To
power the board from an external power supply (needed for motors and other high
current devices), place the jumper on the two pins closest to the power plug. Either
way, connect the board to a USB port on your computer. On Windows, the Add New
Hardware wizard will open; tell it you want to specify the location to search for
drivers and point to the folder containing the USB drivers you unzipped in the
previous step.

5 | Upload a program
Open the LED blink example sketch: File > Sketchbook > Examples >led_blink.

41
Here's what the code for the LED blink example looks like.

Select the serial device of the Arduino board from the Tools | Serial Port menu. On
Windows, this should be COM1 or COM2 for a serial Arduino board, or
COM3,COM4,or COM5 for a USB board. On the Mac, this should be something like
/dev/cu.usbserial-1B1 for a USB board, or something like
/dev/cu.USA19QW1b1P1.1 if using a Keyspan adapter with a serial board (other
USB-to-serial adapters use different names).

42
Push the reset button on the board then click the Upload button in the IDE.
Wait a few seconds. If successful, the message "Done uploading." will appear in the
status bar

5.5. Arduino code:


// include the library code:
#include <LiquidCrystal.h>
#include "DHT.h"

// set the DHT Pin


#define DHTPIN 8

// initialize the library with the numbers of the interface pins


LiquidCrystallcd(7, 6, 5, 4, 3, 2);
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
voidmsg();
void hum();
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);

pinMode(12,OUTPUT);
pinMode(11,OUTPUT);

43
pinMode(10,OUTPUT);
pinMode(9 ,OUTPUT);
pinMode(48,INPUT);
pinMode(50,INPUT_PULLUP);
pinMode(52,INPUT_PULLUP);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,LOW);

dht.begin();
Serial1.begin(9600);
Serial.begin(9600);
lcd.setCursor(0, 0);
lcd.print("Home Automation");
lcd.setCursor(0, 1);
lcd.print("Using Wifi");
delay(6000);
lcd.clear();
// Print a message to the LCD.

void loop() {
delay(500);
intx,y,z;
x=digitalRead(52);
y=digitalRead(50);
z=digitalRead(48);
if(x==LOW)
{
lcd.clear();

44
lcd.setCursor(0, 0);
lcd.print("Door Open........");
msg();
lcd.print("Door Open........");
Serial1.print("Person Trying To Enter Room Please Open The Door .....");
delay(1000);
Serial1.write(0x1A);
delay(1000);
}
if(y==LOW)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Door Close........");
msg();
Serial1.print("No One Inside the Room Please Close The Door .....");
delay(1000);
Serial1.write(0x1A);
delay(1000);
}

if(z==HIGH)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Fan On........");
msg();
Serial1.print("Guest Enterd Room Switch on The FAN .....");
delay(1000);
Serial1.write(0x1A);
delay(1000);
}

45
hum();
}

voidmsg()
{

Serial1.println("AT");
delay(1000);
Serial1.println("AT+CMGF=1");
delay(1000);
Serial1.println("AT+CSCS=\"GSM\"");
delay(1000);
Serial1.println("AT+CMGS=\"8185061595\"");
delay(1000);
}

void hum()
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Temp: Humidity:");
lcd.setCursor(0, 1);
float h = dht.readHumidity();
h=h*1.3;
float f = dht.readTemperature(true);
f=f/2.6;
if (isnan(h) || isnan(f)) {
lcd.print("ERROR");
return;
}

46
lcd.print(f);
lcd.setCursor(7,1);
lcd.print(h);
}
voidserialEvent()
{

if(Serial.available())
{
char d=Serial.read();
if(d=='a')
{
digitalWrite(12,HIGH);

}
else if(d=='b')
{
digitalWrite(12,LOW);

}
else if(d=='c')
{

digitalWrite(11,HIGH);

}
else if(d=='d')
{

digitalWrite(11,LOW);

47
}
else if(d=='e')
{

digitalWrite(10,HIGH);
}
else if(d=='f')
{

digitalWrite(10,LOW);
}
else

{
}
}
}

5.6. Wifi code:


#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <SoftwareSerial.h>
const char* ssid = "batch3123";
const char* password = "password";
ESP8266WebServer server(80);

SoftwareSerialmySerial(4, 5); // RX, TX


voidhandleRoot()
{

48
server.send(200, "text/plain", "Acesss /fon page to turn on FAN, /Foff page to turn off
Fan,/Aon page to turn on AC,/Aoff page to turn off AC,/Dopen page to Door Open
and /Dclose page to Door Close");
}

voidfon()
{
mySerial.print('a');
server.send(200, "text/plain", "FAN IS Now ON Condtion");
handleRoot();
}

voidfoff()
{
mySerial.print('b');
server.send(200, "text/plain", "FAN IS Now OFF Condtion");
delay(2000);
handleRoot();
}
void Aon()
{
mySerial.print('c');
server.send(200, "text/plain", "AC IS Now ON Condtion");
delay(2000);
handleRoot();
}

voidAoff()
{
mySerial.print('d');
server.send(200, "text/plain", "AC IS Now OFF Condtion");

49
delay(2000);
handleRoot();
}
voidDopen()
{
mySerial.print('e');
server.send(200, "text/plain", "Door Opened Now");
delay(2000);
handleRoot();
}

voidDclose()
{
mySerial.print('f');
server.send(200, "text/plain", "Door Closed Now");
delay(2000);
handleRoot();
}

void setup(void)
{
pinMode(14,OUTPUT);
digitalWrite(14,1);
Serial.begin(115200);
mySerial.begin(9600);
Serial.println();
Serial.print("Configuring access point...");
WiFi.softAP(ssid, password);
IPAddressmyIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
server.on("/", handleRoot);

50
server.on("/fon", fon);
server.on("/foff", foff);
server.on("/aon", Aon);
server.on("/aoff", Aoff);
server.on("/don", Dopen);
server.on("/doff", Dclose);
server.begin();
Serial.println("HTTP server started");
}
void loop(void)
{
server.handleClient();
}

51
CHAPTER 6
RESULTS:

DJ HD,DJ HD

Fig6.1 :GSM sending messages

52
Fig 6.2:Mobile controlled messages

53
CONCLUSION

Home automation techniques have been implemented in order to provide ease to the
people to control their home appliances. Different home automation techniques using
Arduino, GSM and Android are given with their design, implementation and
flowcharts which gives the successful layout of their strengths and weaknesses.
Main purpose of home automation system is to provide ease to people to
control different home appliances with the help of mobile phones and to save
electricity, time and money. The goal of the project is to design a system which
should be easy to implement and short ranged. The project is implemented through
onboard Wi-Fi. Implementing the actuators for door systems for more security aspects
can increase the future scope of this project.

54
REFERENCES

Websites:

• http://www.iot-playground.com
• http://www.instructables.com
• http://en.wikipedia.org
• http://www.journals.elsevier.com/easyiot

Journals & other books:

1. Kusuma S M, Assistant Professor, Department of


telecommunication, MSRIT, Bangalore, India. “Home Automation
Using Internet of Things.”
2.NiharikaShrotriya, Anjali Kulkarni, Priti Gadhave, International
Journal of Science, Engineering and Technology Research (IJSETR),
“SMART HOME USING WI-FI”
3.Anushri Aware, Sonali Vaidya, Priyanka Ashture, Varsha Gaiwal
PES’s Modern College of Engineering, Pune-04, International Journal
of Engineering Research and General Science Volume 3, “Home
Automation using Cloud Network”

55

You might also like