chapter 1 introduction - · pdf filearm7 lpc2148 has 14 channel 10 bit adc. ... gsm is...
TRANSCRIPT
1
CHAPTER 1
INTRODUCTION
There are several ways to increase the security at your business; one of the
most effective is to install a monitored security system. Most buildings have
several areas on the outside and inside that are great hiding places for intruders.
Installing cameras inside can lower the amount of hiding places an intruder will
have to hide in, as well as deter customers and/or employees from theft or other
inappropriate work behavior. Background subtraction is a widely used concept
for detection of moving objects in videos.
In the last two decades there has been a lot of development in designing
algorithms for background subtraction, as well as wide use of these algorithms
in various important applications, such as visual surveillance, sports video
analysis, motion capture, etc. Various statistical approaches have been proposed
to model scene backgrounds. The concept of background subtraction also has
been extended to detect objects from videos captured from moving cameras. We
proposed and implemented a project called intelligent surveillance camera
which uses background subtraction technique in surveillance camera. It reduces
the memory wastage.
2
CHAPTER 2
HARDWARE DESCRIPTION
2.1. BLOCK DIAGRAM
2.1.1. BLOCK DIAGRAM OF ISC TRANSMITTER
FIG.2.1.1 ISC TRANSMITTER
2.1.2. BLOCK DIAGRAM OF ISC RECEIVER
FIG.2.1.2 ISC RECEIVER
3
2.2. ISC WORKING
FIG.2.2.1 Circuit diagram
The project works in the scenario when the shop is closed. A low-cost
intelligent wireless security and monitoring solution using Background
subtraction is presented in this project. The current captured image is subtracted
from the Background image. When the subtracted value reaches a certain
threshold, a change is detected. The Controller (ARM) will automatically alert
the user through SMS, Alarming system and Locking Surveillance place. The
block diagram shows the system architecture. Once the system gets turned on
webcam captures the background model and stores it. The background model
should be a static image.
Then captured video from webcam is given as continuous input streams
to the frame separation block. There the current frame and background frame is
compared. The subtracted image is given to the k means clustering block. Here
4
the noise gets removed and threshold value is checked. If there is any change in
pixel value above threshold system alerts the user and records the events.
Threshold value is 96. That the change in pixel value is greater than 96 means
change is detected. The below diagram shows transmitter and receiver block
diagram of Intelligent surveillance camera. In transmitter block diagram the
input from camera is given to the controller via ZigBee module. Input frames
are given to the controller through ZigBee receiver module.If any undesired
activity happens the controller alerts the user through the output devices which
is connected to controller. Authentication block is used to on or off the system.
Fig.2.2.2Working module
5
2.3. MICROCONTROLLER
2.3.1. INTRODUCTION
The LPC2148 micro-controllers are based on a 32/16 bit ARM7TDMI-S
CPU core. They have real-time emulation and embedded trace support that
combines the micro-controller with embedded high speed flash memory of 512
KB. A 128-bit wide memory interface and unique accelerator architecture
enable 32-bit code execution at the maximum clock rate. For critical code size
applications, the alternative 16-bit Thumb mode (16bit instruction set) reduces
code by more than 30% with minimal performance penalty.
The ARM is a 32-bitreduced instruction set computer (RISC) instruction
set architecture (ISA) developed by ARM Holdings. It was known as the
Advanced RISC Machine, and before that as the Acorn RISC Machine. The
ARM architecture is the most widely used 32-bit ISA in terms of numbers
produced. They were originally conceived as a processor for desktop personal
computers by Acorn Computers, a market now dominated by the x86 family
used by IBM PC compatible and Apple Macintosh computers. The relative
simplicity of ARM processors made them suitable for low power applications.
This has made them dominant in the mobile and embedded electronics market
as relatively low cost and small microprocessors and microcontrollers’.
2.3.2. ARM Architecture:
The architecture used in smart phones, personal digital assistants and
other mobile devices is anything from ARMv5 in obsolete/low-end devices to
ARM M-series in current high-end devices. XScale and ARM926 processors
are ARMv5TE, and are now more numerous in high-end devices than the
Strong ARM, ARM9TDMI and ARM7TDMI based ARMv4 processors, but
lower-end devices may use older cores with lower licensing costs. ARMv6
6
processors represented a step up in performance from standard ARMv5 cores,
and are used in some cases, but Cortex processors (ARMv7) now provide faster
and more power-efficient options than all those previous generations. Cortex-A
targets applications processors, as needed by Smartphone’s that previously used
ARM9 or ARM11.
FIG.2.3.1 LPC2148 ARCHITECTURE
7
2.3.3. PIPELINES
The ARM7 and earlier implementations have a three stage pipeline; the
stages being fetch, decode, and execute stages. Additional implementation
changes for higher performance include a faster adder, and more extensive
branch prediction logic. The difference between the ARM7DI and ARM7DMI
cores, for example, was an improved multiplier (hence the added "M").In ARM
7, a 3 stage pipeline is used. A 3 stage pipeline is the simplest form of pipeline
that does not suffer from the problems such as read before write. In a pipeline,
when one instruction is executed, second instruction is decoded and third
instruction will be fetched. This is executed in a single cycle. The ARM7TDMI
implementation uses a Three-stage pipeline design. These three stages are
• Instruction Fetch (F)
• Instruction Decode (D)
• Execute (E)
2.3.4. ADC Converter
ARM7 LPC2148 has 14 channel 10 bit ADC. It gives the digital outputs
with 10bit resolution. The ADC channels are classified into two types ADC0
and ADC1. ADC0 has six channels ( ADC0.0 – ADC0.5) and ADC1 has 8
channels (ADC1.0 to 1.7).The ADC control register (ADCR) and ADC Data
Register(ADDR) and ADGDR ( ADC Global Data Register) are used to
develop the code in ARM7 2148.in the ADGDR the digital output is stored.
8
2.3.5. LPC2148 PIN DIAGRAM
FIG.2.3.2 PIN DIAGRAM
2.3.6. FEATURES OF ARM LPC2148
16/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64 package.
8 to 40 KB of on-chip static RAM and 32 to 512 KB of on-chip flash
program memory 128 bit wide interface/accelerator enable high speed 60
MHz operation.
In-System/In-Application Programming (ISP/IAP) via on-chip boot-
loader software.
One or two (LPC2141/2 vs. LPC2144/6/8) 10-bit A/D converters provide
a total of 6/14 analog inputs, with conversion times as low as 2.44 µs per
channel.
Single 10-bit D/A converter provide variable analog output.
Two 32-bit timers/external event counters (with four capture and four
compare channels each), PWM unit (six outputs) and watchdog.
9
Low power real-time clock with independent power and dedicated 32
kHz clock input
Multiple serial interfaces including two UARTs (16C550), two Fast I2C-
bus (400 Kbit/s), SPI and SSP with buffering and variable data length
capabilities.
Vectored interrupt controller with configurable priorities and vector
addresses.
Up to nine edge or level sensitive external interrupt pins available.
60 MHz maximum CPU clock available from programmable on-chip
PLL with settling time of 100 µs.
On-chip integrated oscillator operates with an external crystal in range
from 1 MHz to 30 MHz and with an external oscillator up to 50 MHz.
Power saving modes include Idle and Power-down.
Individual enable/disable of peripheral functions as well as peripheral
clock scaling for additional power optimization.
Processor wake-up from Power-down mode via external interrupt, USB,
Brown-Out Detect (BOD) or Real-Time Clock (RTC).
Single power supply chip with Power-On Reset (POR) and BOD
circuits:– CPU operating voltage range of 3.0 V to 3.6 V (3.3 V ± 10 %)
with 5 V tolerant I/O pads.
2.3.7. WORKING OF ARM IN ISC
The purpose of using ARM in ISC is it has flash memory of about 32 to
512kb and its speed of operation is 60MHZ.It has two UART ports.
ARM processor has 64 pins. Buzzer, GSM, 3 push buttons, zigbee
receiver, Magnetic lock sensor, LCD display are connected with ARM
10
processor. GSM is connected to ARM with UART0 and Zigbee module is
connected ARM using UART1 pin. Zigbee receives input video from Zigbee
transmitter which is connected to Camera. If ARM receives any interrupt via
Zigbee Rx it supply voltage to the external devices connected to it. There are
two sensors which are connected to ARM processor. They are humidity and
temperature sensor. Which display the room moisture level and temperature.
With this value the user can enter into the room. Data pins of the LCD
display connected to the port1 pins of the ARM. The LCD display get the value
from the sensors continuously and display it.
Three push buttons are connected to the ARM processors 3 port0
pins.ARM processor checks the combination of those 3 pins and depending on
that it will ON or OFF the ISC.
2.4. ZIGBEE
ZigBee is a mesh network specification for low-power wireless local area
networks (WLANs) that cover a large area. ZigBee was designed to provide
high data throughput in applications where the duty cycle is low and low power
consumption is an important consideration. (Many devices that use ZigBee are
powered by battery.) Because ZigBee is often used in industrial automation and
physical plant operation, it is often associated with machine-to-machine (M2M)
communication and the Internet of Things (IoT).
2.4.1. APPLICATION
Industrial Control
Embedded Sensing
Medical Data Collection
Smoke And Intruder Warning
11
2.4.2. WORKING OF ZIGBEE IN ISC
ZIGBEE Tx is connected to the camera and ZIGBEE Rx is connected to the
ARM controller. The ARM receives the interrupt via ZIGBEE. Initially the
input video is processed in Microsoft VB Studio. There the input video is taken
as continuous image frames. First 5 frames are taken as background images.
And all the remaining frames are compared with the background image. If there
is any change in the images. All frames are stored. There is no change then no
frames get saved in the system. If there is change then the signal is given to the
ZigBee Transmitter. It transmit the signal to the Receiver ZigBee.
2.5. BUZZER
A buzzer or beeper is an audio alerting signalling device, which may
be mechanical, electromechanical, or piezoelectric. The most fashioned uses of
buzzers and beepers include alarm devices, timers and confirmation of user
input such as a mouse click or keystroke. Alarm unit in an operation and
maintenance (O&M) monitoring system informs the bad working state of (a
particular part of) the product under monitoring.
2.6. GSM MODEM
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. A GSM modem can be an external device or a PC Card / PCMCIA
Card. Typically, an external GSM modem is connected to a computer through a
serial cable or a USB cable. A GSM modem in the form of a PC Card /
PCMCIA Card is designed for use with a laptop computer. It should be inserted
into one of the PC Card / PCMCIA Card slots of a laptop computer. Like a
12
GSM mobile phone, a GSM modem requires a SIM card from a wireless carrier
in order to operate.
FIG.2.6.1 GSM Modem
Both GSM modems and dial-up modems support a common set of
standard AT commands. You can use a GSM modem just like a dial-up modem.
In addition to the standard AT commands, GSM modems support an
extended set of AT commands. These extended AT commands are defined in
the GSM standards. With the extended AT commands, you can do things like:
Reading, writing and deleting SMS messages.
Sending SMS messages.
The number of SMS messages that can be processed by a GSM modem
per minute is very low -- only about six to ten SMS messages per minute.
2.6.1. GSM MODEM APPLICATIONS
GSM MODEM used in many applications. Some of the applications are
shown in picture.
13
FIG.2.6.2 GSM Modem Applications
2.6.2. WORKING OF GSM IN ISC
In ISC GSM SIM900A is used. GSM MODEM is connected to the
UART1 port of the controller. If ARM receives any interrupt, GSM MODEM
will send alert message to the user. The alert message which is sent to the user
and user mobile number is defined in the VB.NET itself.
2.7. TEMPERATURE SENSOR
The LM35 series are precision integrated-circuit temperature devices with
an output voltage linearly-proportional to the Centigrade temperature. The
LM35 device has an advantage over linear temperature sensors calibrated in
Kelvin, as the user is not required to subtract a large constant voltage from the
output to obtain convenient Centigrade scaling. The LM35 device is rated to
operate over a −55°C to 150°C temperature range, while the LM35C device is
rated for a −40°C to 110°C range (−10° with improved accuracy). The LM35-
series devices are available packaged in hermetic TO transistor packages, while
the LM35C, LM35CA, and LM35D devices are available in the plastic TO-92
14
transistor package. The LM35D device is available in an 8-lead surface-mount
small-outline package and a plastic TO-220 package.
FIG.2.7.1 LM35 Temp sensor
2.7.1. FEATURES
Calibrated Directly in Celsius (Centigrade)
Linear + 10-mV/°C Scale Factor
0.5°C Ensured Accuracy (at 25°C)
Rated for Full −55°C to 150°C Range
Suitable for Remote Applications
2.8. HUMIDITY SENSOR
Humidity is the presence of water in air. The amount of water vapor in air
can affect human comfort as well as many manufacturing processes in
industries. Humidity sensing is very important, especially in the control
systems for industrial processes and human comfort. Humidity measurement
can be done using dry and wet bulb hygrometers, dew point hygrometers, and
electronic hygrometers. There has been a surge in the demand of electronic
hygrometers, often called humidity sensors.
2.8.1. Sensor based on Resistive effect:
Resistive type humidity sensors pick up changes in the resistance value of
the sensor element in response to the change in the humidity. Basic structure of
resistive type humidity sensor from TDK is shown below,
15
FIG.2.8.1 Resistive based humidity sensor
Thick film conductor of precious metals like gold, ruthenium oxide is printed
and calcinated in the shape of the comb to form an electrode. Then a polymeric
film is applied on the electrode; the film acts as a humidity sensing film due to
the existence of movable ions. Change in impedance occurs due to the change in
the number of movable ions.
2.9. LCD DISPLAY
A liquid crystal display (LCD) is an electro-optical amplitude modulator
known as a thin, flat display peripheral composed of any number of colour or
monochrome pixels sequenced in front of a light source or reflector. It is mostly
used in battery-powered electronic devices because it uses very low amounts of
electric power. Each dot of an LCD typically made of a layer of molecules
structured between transparent electrodes, and two polarizing filters, the axes of
exchange of which are (in many of the cases) perpendicular to one other. With
no liquid crystal between the polarizing filters, light passing through the first
layer would be prevented by the second (crossed) polarizer.
16
FIG.2.9.1 LCD Display
The outer layers of the electrodes that are in contact with the liquid crystal
material are treated so as to align the liquid crystal molecules in a particular
direction. This treatment typically consists of a thin polymer layer that is
unidirectional rubbed using, for example, a cloth. The direction of the liquid
crystal alignment is then defined by the direction of rubbing. Electrodes are
made of a transparent conductor called Indium Tin Oxide (ITO).
When a voltage is applied across the electrodes, a torque acts to align the
liquid crystal molecules parallel to the electric field, distorting the helical
structure (this is resisted by elastic forces since the molecules are constrained at
the surfaces). This reduces the rotation of the polarization of the incident light,
and the device appears grey. If the applied voltage is large enough, the liquid
crystal molecules in the centre of the layer are almost completely untwisted and
the polarization of the incident light is not rotated as it passes through the liquid
crystal layer. This light will then be mainly polarized perpendicular to the
second filter, and thus be blocked and the pixel will appear black. By controlling
the voltage applied across the liquid crystal layer in each pixel, light can be
allowed to pass through in varying amounts thus constituting different levels of
gray.
17
2.10. PUSH BUTTON SWITCH
A push-button (also spelled pushbutton) or simply button is a
simple switch mechanism for controlling some aspect of a machine or a process.
Buttons are typically made out of hard material, usually plastic or metal. The
surface is usually flat or shaped to accommodate the human finger or hand, so
as to be easily depressed or pushed. Buttons are most often biased switches,
though even many un-biased buttons (due to their physical nature) require
a spring to return to their un-pushed state. Different people use different terms
for the "pushing" of the button, such as press, depress, mash, and punch.
FIG.2.10.1 Push button
2.11. POWER SUPPLY
The AC voltage, typically 220V rms, is connected to a transformer, which
steps that ac voltage down to the level of the desired DC output. A diode
rectifier then provides a full-wave rectified voltage that is initially filtered by a
simple capacitor filter to produce a dc voltage.
FIG.2.11.1 Block diagram of power supply unit
TRANSFORMER RECTIFIER FILTER IC REGULATOR LOAD
18
FIG.2.11.2 Circuit diagram of power supply unit
This resulting dc voltage usually has some ripple or ac voltage variation. A
regulator circuit removes the ripples and also remains the same dc value even if
the input dc voltage varies, or the load connected to the output dc voltage
changes.
2.12. SERIAL COMMUNICATION
2.12.1. RS232
When we look at the connector pin out of the RS232 port, we see two
pins which are certainly used for flow control. These two pins are RTS, request
to send and CTS, clear to send. With DTE/DCE communication (i.e. a
computer communicating with a modem device) RTS is an output on the DTE
and input on the DCE. CTS are the answering signal coming from the DCE.
Before sending a character, the DTE asks permission by setting its RTS output.
No information will be sent until the DCE grants permission by using the CTS
line.
If the DCE cannot handle new requests, the CTS signal will go low. A
simple but useful mechanism allowing flow control in one direction. The
assumption is that the DTE can always handle incoming information faster than
19
the DCE can send it. In the past, this was true. Modem speeds of 300 baud were
common and 1200 baud was seen as a high speed connection.
For further control of the information flow, both devices have the ability
to signal their status to the other side. For this purpose, the DTR data terminal
ready and DSR data set ready signals are present. The DTE uses the DTR
signal to signal that it is ready to accept information, whereas the DCE uses the
DSR signal for the same purpose. Using these signals involves not a small
protocol of requesting and answering as with the RTS/CTS handshaking. These
signals are in one direction only.
It is not used directly for flow control, but mainly an indication of the
ability of the modem device to communicate with its counterpart. This signal
indicates the existence of a communication link between two modem devices.
Connector 1 Connector 2 Function
2 3 Rx TX
3 2 TX Rx
5 5 Signal ground
Fig.2.12.1 SIMPLE NULL MODEM WITH HANDSHAKING
20
2.12.2. MAX232
The MAX232 is an IC, first developed in 1987 by Maxim Integrated
Products, that transforms signals from an RS-232 serial port to signals related
for use in TTL compatible digital logic circuits. The MAX232 is a dual
driver/receiver and typically converts the RX, TX, CTS and RTS signals.
The drivers give RS-232 voltage level outputs (approx. ± 7.5 V) from a
single + 5 V supply via on-chip charge pumps and external capacitors. This
makes it important for implementing RS-232 in devices that otherwise do not
need any supply outside the 0 V to + 5 V range, as voltage supply design does
not need to be made more complicated just for driving the RS-232 in this case.
The receivers lowers RS-232 inputs (which may be as high as ± 25 V), to
standard 5 V TTL levels. These receivers have a typical threshold of 1.8V, and a
typical hysteresis of 0.5 V. It is support full to understand what occurs to the
voltage levels. When a MAX232 IC gets a TTL level to convert, it changes TTL
logic 0 to between +3.3 and +15.5 V, and changes TTL logic 1 to between -3.3
to -15.5 V, and vice versa for converting from RS232 to TTL. This can be
confusing when you realize that the RS232 bit transmission voltages at a certain
logic state are opposite from the RS232 control line supply at the same logic
state. To clarify the matter, see the table below. For more information, see RS-
232 voltage levels.
2.12.3. WORKING OF RS232 AND MAX232 IN ISC
RS232 cable is used to connect ARM controller to GSM modem.MAX232 is
used for logic conversion.
2.13. RELAY
A relay is an electromagnetic switch Worked by a relatively
small electric current that can made on or off a much larger electric current. The
21
heart of a switch is an electromagnet (a coil of wire that becomes a
temporary magnet when electricity flows through it).
Fig.2.13.1 RELAY
22
CHAPTER 3
SOFTWARE DESCRIPTION
3.1. EMBEDDED C
The C for microcontrollers and the standard C syntax and semantics are
slightly different. The former is aimed at the general purpose programming
paradigm whereas the latter is for a specific target microcontroller such as 8051
or PIC. The underlying fact is that everything will be ultimately mapped into
the microcontroller machine code. If a certain feature such as indirect access to
I/O registers is inhibited in the target microcontroller, the compiler will also
restrict the same at higher level. Similarly some C operators which are meant
for general purpose computing are also not available with the C for
microcontrollers. Even the operators and constructs which may lead to memory
inefficiency are not available in C programming meant for microcontrollers. Be
aware that the target code should fit in the limited on-chip memory of the
processor. Even the I/O functions available in standard C such as printf() or
scanf() are either not made available in C compilers for microcontrollers or
advised not to use them. These functions eat up lot of memory space and are
not time-efficient owing to the dragging of supporting functions like floating
point routines and lot of delimiters. Another striking difference in case of
embedded systems programs is that they do not have the umbrella or support of
the operating system. The programme has to be accustomed with the absence of
system calls which makes life easy in traditional C.
3.1.1. DIFFERENCE FROM C
C is for desktop computers, embedded C usually is for
microcontroller based applications. C use the resources of desktop computers
(memory, OS, etc) Embedded C use only limited resources available in chip
(limited RAM, ROM, ports, etc). Embedded C is an extension of C
The Extra Features are available in Embedded C are
23
1.Fixed point types
2.Multiple memory areas
3.I/O register mapping.
3.1.2. ADVANTAGES OF EMBEDDED C
Compared to assembly language, C code written is more reliable and
scalable, more portable between different platforms.
C compilers are available for almost all embedded devices in use today,
and there is a large pool of experienced C programmers.
Unlike assembly, C has advantage of processor-independence and is not
specific to any particular microprocessor/microcontroller or any system.
This makes it convenient for a user to develop programs that can run on
most of the systems.
As C combines functionality of assembly language and features of high
level languages, C is treated as a ‘middle-level computer language’ or
‘high level assembly language’.
It is fairly efficient.
It supports access to I/O and provides ease of management of large
embedded projects.
Java is also used in many embedded systems but Java programs require
the Java Virtual Machine (JVM), which consumes a lot of resources.
Hence it is not used for smaller embedded devices.
It is small and simpler to learn, understand, program and debug.
3.2. KEIL IDE
Keil Software is the leading vendor for 8/16-bit development tools
(ranked at first position in the 2004 Embedded Market Study of the Embedded
Systems and EE Times magazine). Keil Software is represented world-wide in
more than 40 countries. Since the market introduction in 1988, the Keil C51
24
Compiler is the de facto industry standard and supports more than 500 current
8051 device variants. Now, Keil Software offers development tools for ARM.
Keil Software makes C compilers, macro assemblers, real-time kernels,
debuggers, simulators, integrated environments, and evaluation boards for the
8051, 251, ARM, and XC16x/C16x/ST10 microcontroller families.
Keil Software is pleased to announce simulation support for the Atmel
AT91 ARM family of microcontrollers. The Keil µVision Debugger simulates
the complete ARM instruction-set as well as the on-chip peripherals for each
device in the AT91 ARM/Thumb microcontroller family. The integrated
simulator provides complete peripheral simulation.
3.2.1. FEATURES
An integrated Software Logic Analyzer that measures I/O signals as well
as program variables and helps developers create complex signal
processing algorithms.
An Execution Profiler that measures time spent in each function, source
line, and assembler instruction. Now developers can find exactly where
programs spend the most time.
"Using nothing more than the provided simulation support and debug scripts,
developers can create a high-fidelity simulation of their actual target hardware
and environment. No extra hardware or test equipment is required. The Logic
Analyzer and Execution Profiler will help developers when it comes time to
develop and tune signalling algorithms." said Jon Ward, President of Keil
Software USA, Inc.
3.2.2. APPLICATIONS
The µVision Device Database automatically configures the development
tools for the target microcontroller.
25
The µVision IDE integrates additional third-party tools like VCS, CASE,
and FLASH/Device Programming.
µVision incorporates project manager, editor, and debugger in a single
environment.
Identical Target Debugger and Simulator User Interface.
The Code Coverage feature of the µVision Simulator provides statistical
analysis of your program's execution.
Simulation capabilities may be expanded using the Advanced Simulation
Interface (AGSI).
3.3. FLASH PROGRAMMER
FLASH PROGRAMMER is software that is used to dump the hex file
into the PIC controller.
Straightforward and intuitive user interface
Five simple steps to erasing and programming a device and setting any
options desired
Programs Intel Hex Files
Automatic verifying after programming
Fills unused Flash to increase firmware security
Ability to automatically program checksums.
Using the supplied checksum calculation routine your firmware can
easily verify the integrity of a Flash block, ensuring no unauthorized or
corrupted code can ever be executed
Program security bits
Check which Flash blocks are blank or in use with the ability to easily
erase all blocks in use
Read the device signature
Read any section of Flash and save as an Intel Hex Fi
26
3.4. MICROSOFT ASP .NET
The Microsoft .NET Framework is an integrated and managed
environment for the development and execution of the code. It manages all
aspects of a program’s execution. It allocates memory for the storage of data
and instructions, grants or denies the appropriate permissions to your
application, initiates and manages application execution, and manages the
reallocation of memory from resources that are no longer needed.
The .NET Framework consists of two main components:
The common language runtime.
The .NET Framework class library.
The common language runtime can be thought of as the environment that
manages code execution. It provides core services, such as code compilation,
memory allocation, thread management, and garbage collection. Through the
common type system (CTS), it enforces strict type-safety and ensures that code
is executed in a safe environment by also enforcing code access security.
The .NET Framework class library provides a collection of useful and
reusable types that are designed to integrate with the common language runtime.
The types provided by the .NET Framework are object-oriented and fully
extensible, and they allow the user to seamlessly integrate applications with the
.NET Framework.
One of its key design goals was to make programming easier and quicker
by reducing the amount of code you have to create. Enter the declarative
programming model, a rich server control hierarchy with events, a large class
library, and support for large development tools from the humble notepad to the
high-end Visual Studio.NET. All in all ASP.NET was a huge leap forward.
Much time you have to do it in. There is an almost never-ending supply of
features you can add, but at some stage you have to ship the product. You
cannot doubt that ASP.NET 1.0 shipped with an impressive array of features,
but the ASP.NET team members are ambitious, and they not only had plans of
27
their own but also listened to their users. ASP.NET 2.0 code-named “Whidbey”,
addresses the areas that both the development team and users wanted to
improve. The aims of the new version are listed below.
ASP.NET provides a programming model and infrastructure that offers
the need services for programmers to develop Web-based applications. As
ASP.NET is a part of the .NET Framework, the programmers can make use of
the managed Common Language Runtime (CLR) environment, type safety, and
inheritance etc to create Web-based applications. You can develop your
ASP>NET Web-based application in any .NET complaint languages such as
Microsoft Visual Basic, Visual C#, and Jscript.NET.
ASP.NET offers a novel programming model and infrastructure that
facilitates a powerful new class of applications. Developers can effortlessly
access the advantage of these technologies, which consist of a managed
Common Language Runtime environment, type safety, inheritance, and so on.
With the aid of Microsoft Visual Studio.
3.4.1. OVERVIEW OF VB.NET
Visual Basic .NET (VB.NET) is an object-oriented computer
programming language implemented on the .NET Framework. Although it is an
evolution of classic Visual Basic language, it is not backwards-compatible with
VB6, and any code written in the old version does not compile under VB.NET.
Like all other .NET languages, VB.NET has complete support for object-
oriented concepts. Everything in VB.NET is an object, including all of the
primitive types (Short, Integer, Long, String, Boolean, etc.) and user-defined
types, events, and even assemblies. All objects inherit from the base class
Object.
VB.NET is implemented by Microsoft's .NET framework. Therefore, it
has full access to all the libraries in the .Net Framework. It's also possible to run
28
VB.NET programs on Mono, the open-source alternative to .NET, not only
under Windows, but even Linux or Mac OSX.
The following reasons make VB.Net a widely used professional language
Modern, general purpose.
Object oriented.
Component oriented.
Easy to learn.
Structured language.
It produces efficient programs.
It can be compiled on a variety of computer platforms.
Part of .Net Framework.
3.4.2. FEATURES OF VB.NET
VB.Net has numerous strong programming features that make it endearing to
multitude of programmers worldwide. Let us mention some of these features:
Boolean Conditions
Automatic Garbage Collection
Standard Library
Assembly Versioning
Properties and Events
Delegates and Events Management
Easy-to-use Generics
29
Indexers
Conditional Compilation
Simple Multithreading
3.5. K MEANS CLUSTERING
In statistics and data mining, k-means clustering is a method of cluster
analysis which aims to partition n observations into k clusters in which each
observation belongs to the cluster with the nearest mean. This results into a
partitioning of the data space into Voronoi cells.
The problem is computationally difficult (NP-hard), however there are efficient
heuristic algorithms that are commonly employed that converge fast to a local
optimum. These are usually similar to the expectation-maximization algorithm
for mixtures of Gaussian distributions via an iterative refinement approach
employed by both algorithms. Additionally, they both use cluster centers to
model the data, however k-means clustering tends to find clusters of comparable
spatial extend, while the expectation-maximization mechanism allows clusters
to have different shapes.
3.5.1. DIAGRAM EXPLANATION
1) k initial "means" (in this case k=3) are randomly selected from the data set
(shown in colour)
2) k clusters are created by associating every observation with the nearest mean.
The partitions here represent the Voronoi diagram generated by the means.
3) The centroid of each of the k clusters becomes the new means.
4) Steps 2 and 3 are repeated until convergence has been reached.
30
Fig.3.5.1 K-Means clustering
3.5.2. APPLICATION
k-means clustering in particular when using heuristics such as Lloyd's
algorithm is rather easy to implement and apply even on large data sets. As
such, it has been successfully used in various topics, ranging from market
segmentation, computer vision, geostatistics and astronomy to agriculture. It
often is used as a pre-processing step for other algorithms, for example to find a
starting configuration.
3.6 CODING
#include <LPC214X.H>
#include <stdio.h>
#include <string.h>
#include "UART_ARM.H"
#include "ADC_ARM.H"
#include "Utility.h"
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
31
#endif
#define BUZZ 6
#define RELAY1 28
#define NUL 0
unsigned char FLAG = TRUE,
ASCII_TEMP1[5],ASCII_TEMP2[5],ASCII_TEMP3[5],ASCII_TEMP4[5],y[60],SEND =
0;
unsigned long ADC_VAL0,ADC_VAL1,ADC_VAL2;
void GPIO_INIT(void);
void UART_INIT(void);
void delay(unsigned int);
void DelayMs(unsigned int n);
void GPIO_INIT(void)
{
IODIR1 |= (0xF << RELAY1);
}
void UART_INIT(void)
{
UART0_INIT (9600);
UART0_PUTC('K');
UART1_INIT (9600);
UART0_INTRPT();
UART1_INTRPT();
U0IER = 1;
U1IER = 1;
}
32
void DELAY_MS(unsigned int n)
{
int i,j;
for(i=0;i<n;i++)
{ for(j=0;j<0x100;j++){;} }
}
void delay(unsigned int n)
{
int i,j;
for(i=0;i<n;i++)
{ for(j=0;j<0x2700;j++){;} }
}
void DelayMs(unsigned int n)
{
int i,j;
for(i=0;i<n;i++)
{ for(j=0;j<0x100;j++) {;} }
}
void lcd_initialize(void);
void lcd_cmd(unsigned char);
void lcd_data(unsigned char);
const unsigned char cmd[4] = {0x38,0x0c,0x06,0x01}; //lcd commands
unsigned char soil1[10],mems1[10],soil2[10],mems2[10];
void lcd_initialize(void)
{ int i;
33
for(i=0;i<4;i++)
{ IOCLR0 = 0x00FF0000;
lcd_cmd(cmd[i]);
delay(3);
} }
void lcd_cmd(unsigned char data)
{
IOCLR0 = 0x00FF0000;
IOSET0 = data << 16;
IOCLR1 |= 0x100000; //RS
IOCLR1 |= 0x200000; //RW
IOSET1 |= 0x400000; //EN
delay(3);
IOCLR1 |= 0x400000; //EN
}
void lcd_data(unsigned char data)
{
IOCLR0 = 0x00FF0000;
IOSET0 = data << 16;
IOSET1 |= 0x100000; //RS
IOCLR1 |= 0x200000; //RW
IOSET1 |= 0x400000; //EN
delay(3);
IOCLR1 |= 0x400000; //EN
}
34
void printLCD (unsigned char *p, unsigned char pos)
{ unsigned int n;
lcd_cmd (pos);
n=0;
while (*(p+n) != '\0')
{ lcd_data (*(p+n));
n++;
}
}
int main (void)
{
PINSEL0 = 0;
PINSEL1 = 0;
PINSEL2 &= 0x0000000C;
VPBDIV = 0x02;
GPIO_INIT();
UART_INIT();
INIT_ADC0(CHANNEL1 | CHANNEL2 | CHANNEL3 | CHANNEL4);
IODIR0 |= 0xff << 16;
IODIR1 |= 0xf << 20;
IODIR0 |= 1 << BUZZ;
IOCLR0 |= 1 << BUZZ;
IODIR0 |= 0 << VIB1;
IODIR0 |= 0 << VIB2;
lcd_initialize();
35
printLCD(" Monitoring ",0xC0);
delay(25);
lcd_cmd(0x01);
while (1)
{
ADC_VAL0 = READ_ADC0(CHANNEL1);
ADC_VAL1 = READ_ADC0(CHANNEL2);
printLCD("TEMP:",0x80);
printLCD("HUM:",0xC0);
sprintf (soil1, "%2.1f", (ADC_VAL0/3.1));
printLCD(soil1,0x85);
sprintf (mems1, "%2.1f",(ADC_VAL1/2.2));
printLCD(mems1,0xC5);
if(ADC_VAL0 > 150)
{
IOSET0 = 1 << BUZZ;
}
else if(ADC_VAL1 > 150)
{ IOSET0 = 1 << BUZZ; }
else
{ IOCLR0 = 1 << BUZZ; }
if(SEND == 1)
{ delay(25);
UART0_PUTS("AT+CMGS=\"+919629022157\"\r");
delay(25);
36
UART0_PUTS("Magnetic lock is done ");
delay(25);
UART0_PUTC(0x1A); delay(250);
SEND = 0;
}
delay_Nx10cyc(5999999);
}
}
void UART0_ISR (void)__irq
{ char Msg;
if(((Msg = U0IIR) & 0x01) == 0) {
UART0_GETS(y);
if((strstr(y,"4567")))
{ printLCD("OFF",0x8A);
U1IER = 0;
IOCLR1 = 1 << RELAY1;
}
if((strstr(y,"1234")))
{ printLCD("OON",0x8A);
U1IER = 1;
IOSET1 = 1 << RELAY1;
}
}
VICVectAddr = 6;
}
37
void UART1_ISR (void)__irq
{ char ch;
ch = U1RBR;
if (ch == 'A')
{
IOSET0 = 1 << BUZZ;
IOSET1 = 1 << RELAY1;
SEND= 1;
}
VICVectAddr = 7;
}
38
CHAPTER 4
RESULT
4.1. ISC RESULT
The background image is a static image. The webcam continuously capture
the frames. Frames get stored only if there is a change in pixel. If there is a
change in pixel value above threshold, the system will capture it and save the
frames. Buzzer will alert the user.SMS will be sent to the user.
Static image:
Fig.4.1.1. Background image
Case: I No change in frames
The above picture shows the background image. Remaining frames are
compared with the background image. There is no change in pixel above
threshold it is considered as a no change. So, nothing gets stored.
Case: II Change in pixel above threshold
While comparing, there is a change in pixel above threshold means
it is considered to be a change and all the frames get stored. Background (static)
image get stored in the name with the prefix second and changed images get
stored in the name with the prefix first.
39
Fig.4.1.2. Result 1
If the change is detected interrupt is send to the ARM via ZigBee. The ARM
will send alert message to the user.
Fig.4.1.3 Result 2
40
CHAPTER 5
CONCLUSION AND FUTURE WORK
A variety of motion detection algorithms for video surveillance
systems are developed. But most of the systems don’t use it. So, it requires
large memory to store the video. We are developing motion detection system
that will be helpful for detecting the moving object. By using Human Motion
Detection system banks safe will be more secured as it will send alerts
regarding burglary happening. Moreover it will save memory and memory
wastage would be avoided.
In future, the project can be improved by some additional features such
as it can be extended to multiple cameras, it can be used for dynamic
environment and Alert message is send to the nearest police station.
41
REFERENCE
[1].Massimo Piccardi, Background subtraction techniques: a review* ,2004
IEEE International Conference on Systems, Man and Cybernetics.
[2].Ahire Upasana, Bagul Manisha , Gawali Mohini, Khairnar Pradnya, Real
Time Security System using Human Motion Detection ,2015 International
Journal of Computer Science and Mobile Computing.
[3].R.S.Rakibe,Prof.B.D.Patil,Human Motion Detection using Background
Subtraction Algorithm,2014 International Journal of Advanced Research in
Computer Science and Software Engineering.
[4].K.Saranya, M.Kalaiselvi Geetha , J.Arunnehru Motion Detection and
Tracking of Multiple Objects for Intelligent Surveillance ,IOSR Journal of
Computer Engineering (IOSR-JCE).
[5].R.Ramani, S.Selvaraju, M.Thiruppathi, R.Thangam S.Valarmathy, Dr.
N.SuthanthiraVanitha, Vehicle Tracking and Locking System Based on GSM
and GPS, I.J. Intelligent Systems and Applications, 2013, 09, 86-93 , Published
Online August 2013 in MECS.