Professional Documents
Culture Documents
Smart Car Final
Smart Car Final
Smart Car Final
With the development and applications of many embedded techniques, car security
system design and analysis are constantly improving. Many new techniques, such as biometric recognition
technique, image processing technique, communication technique and so on, have been integrated into a
car security systems. At the same time, the amount of accident of cars still remains high, specially, lost.
So, one practicable car security system should be efficient, robust and reliable.
Traditional car security system rely on many sensors and costs a lot. When one car is
really lost, no more feedback could be valid to help people to find it back.We put forward the face
detection technique to be applied in car security system because this kind of technique is effective and
fast, and one alarm signal could be given to make an alarm or call the police and the host soundlessly with
the help of other modules in the system prototype.
Face detection techniques have been heavily studied in recent years, and it is an
important computer vision problem with application to surveillance, multimedia processing and consumer
products. Many new face detection techniques have been developed to achieve higher detection rate and
faster. One of the techniques used here is Principle Component Analysis (PCA)
GPS module obtains the precise locality by parsing received GPS signal
a) software requirements:
b) Hardware Requirements:
Hardware devices : DS89C430 Micro Controller, MAX232, GSM module, GPS module
1.3 WORKING
SMART CAR SECURITY SYSTEM 4
In this paper, we propose a low-cost extendable framework for embedded smart car security
system, which consists of a face detection subsystem, a GPS module, a GSM module and a
control platform. Comparing with traditional car security system, this system does not need any
sensor, and cost much less. Digital camera obtains pictures and then compresses them into jpg
format. The data could be handled by face detection classifiers to find out faces, which are
trained by PCA algorithm. Several methods have been applied to speedup the detection process,
such as the use of ESRAM by distribute the key code into it, and the high hit rate of cache
because the characteristics of image files and the data of cascade detector.
SCHEMATIC DIAGRAM
LS1
Actuator 1 VC C _BAR
LS1 U 1
VC C _B AR E y e b lin k s e n s o r R 1 1K 2
1
1 39 2 1 2 Q 1 Alarm
38 P 0 .0 /A D 0 P 2 .0 /A 8 2 2
R 2 P 0 .1 /A D 1 P 2 .1 /A 9
2 37 2 3 BC 547
1
P 0 .2 /A D 2 P 2 .2 /A 1 0
3
Q 1 2 36 2 4
35 P 0 .3 /A D 3 P 2 .3 /A 1 1 2 5
BC 547 P 0 .4 /A D 4 P 2 .4 /A 1 2
34 2 6 VC C
R E S IS TO R P 0 .5 /A D 5 P 2 .5 /A 1 3 10uF P1
3
33 2 7
32 P 0 .6 /A D 6 P 2 .6 /A 1 4 2 8 5
C 1
P 0 .7 /A D 7 P 2 .7 /A 1 5 9
16
1 1 0 4
2
U 1
S E R IA L P O R T
2 P 1 .0 P 3 .0 /R X D 0 1 1 11 14 8
P 1 .1 P 3 .1 /TXD 0 T 1 IN T1O U T
V+
TXD
VC C
3 1 2 10 7 3
4 P 1 .2 /R XD 1 P 3 .2 /IN T 0 1 3 T 2 IN T2O U T 7
5 P 1 .3 /T X D 1 P 3 .3 /IN T 1 1 4 12 8 2
6 P 1 .4 P 3 .4 /T 0 1 5 R XD 9 R 1O U T R 2 IN 13 6
7 P 1 .5 P 3 .5 /T 1 1 6 R 2O U T R 1 IN 1
8 P 1 .6 P 3 .6 /W R 1 7 1
P 1 .7 P 3 .7 /R D C 3 C +
19 30 M A X232
18 X1 ALE 29 10uF 3
X2 PSEN C 1-
31 4 6
9 EA C 4 C 2+ V-
C 5
R ST
10uF
G N D
40 20 5 10uF
VC C VC C G N D C 2-
10uF P1
15
C 1 5 D S89C 450
9
16
4
2
U 1
S E R IA L P O R T
11 14 8
T 1 IN T1O U T
V+
TXD
VC C
10 7 3
T 2 IN T2O U T 7
12 8 2
R XD 9 R 1O U T R 2 IN 13 6
R 2O U T R 1 IN 1
1
C 3 C +
M A X232
10uF 3
C 1-
1
D 1
4 6
C 4 C 2+ V-
C 5
1 4 - + 2 IN 7805 OUT
10uF 1 D B106
G N D
5 10uF 2 GND
C 2- 2 R 3
1 0 0 u F /1 6 V
C 5
330E
15
9V AC C 6
3
4 7 0 u F /2 5 V
D 3
S S F -L X H 1 0 1
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. This voltage regulation is
usually obtained using one of the popular voltage regulator IC units.
Transformer
The potential transformer will step down the power supply voltage (0-230V) to (0-6V) level.
Then the secondary of the potential transformer will be connected to the precision rectifier,
which is constructed with the help of op–amp. The advantages of using precision rectifier are it
will give peak voltage output as DC, rest of the circuits will give only RMS output.
Bridge rectifier
The path for current flow is from point B through D1, up through RL, through D3, through the
secondary of the transformer back to point B. this path is indicated by the solid arrows.
Waveforms (1) and (2) can be observed across D1 and D3.
One-half cycle later the polarity across the secondary of the transformer reverse, forward biasing
D2 and D4 and reverse biasing D1 and D3. Current flow will now be from point A through D4,
up through RL, through D2, through the secondary of T1, and back to point A. This path is
indicated by the broken arrows. Waveforms (3) and (4) can be observed across D2 and D4. The
current flow through RL is always in the same direction. In flowing through RL this current
develops a voltage corresponding to that shown waveform (5). Since current flows through the
load (RL) during both half cycles of the applied voltage, this bridge rectifier is a full-wave
rectifier.
One advantage of a bridge rectifier over a conventional full-wave rectifier is that with a given
transformer the bridge rectifier produces a voltage output that is nearly twice that of the
conventional full-wave circuit.
This may be shown by assigning values to some of the components shown in views A and B.
assume that the same transformer is used in both circuits. The peak voltage developed between
points X and y is 1000 volts in both circuits. In the conventional full-wave circuit shown—in
The maximum voltage that appears across the load resistor is nearly-but never exceeds-500 v0lts,
as result of the small voltage drop across the diode. In the bridge rectifier shown in view B, the
maximum voltage that can be rectified is the full secondary voltage, which is 1000 volts.
Therefore, the peak output voltage across the load resistor is nearly 1000 volts. With both
circuits using the same transformer, the bridge rectifier circuit produces a higher output voltage
than the conventional full-wave rectifier circuit.
IC voltage regulators
Voltage regulators comprise a class of widely used ICs. Regulator IC units contain the circuitry
for reference source, comparator amplifier, control device, and overload protection all in a single
IC. IC units provide regulation of either a fixed positive voltage, a fixed negative voltage, or an
adjustably set voltage. The regulators can be selected for operation with load currents from
hundreds of milli amperes to tens of amperes, corresponding to power ratings from milli watts to
tens of watts.
A fixed three-terminal voltage regulator has an unregulated dc input voltage, Vi, applied to one
input terminal, a regulated dc output voltage, Vo, from a second terminal, with the third terminal
connected to ground.
The series 78 regulators provide fixed positive regulated voltages from 5 to 24 volts. Similarly,
the series 79 regulators provide fixed negative regulated voltages from 5 to 24 volts.
For ICs, microcontroller, LCD --------- 5 volts
For alarm circuit, op-amp, relay circuits ---------- 12 volts
CHAPTER 2
DS89C430 MICROCONTROLLER
SMART CAR SECURITY SYSTEM 9
2.1 About Micro Controller
The DS89C430 and DS89C450 offer the highest performance available in 8051-compatible
microcontrollers. They feature newly designed processor cores that execute instructions up to 12 times
faster than the original 8051 at the same crystal speed. Typical applications will experience a speed
improvement up to 10x. At 1 million instructions per second (MIPS) per megahertz, the microcontrollers
achieve 33 MIPS performance from a maximum 33MHz clock rate.
2.1.1 Features
The DS89C430 and DS89C450 are pin compatible with all three packages of the
standard 8051 and include standard resources such as three timer/counters, serial port, and four 8-
bit I/O ports. The three part numbers vary only by the amount of internal flash memory
(DS89C430 = 16kB, DS89C450 = 64kB), which can be in-system/in application programmed
from a serial port using ROM-resident or user-defined loader software. For volume deployments,
the flash can also be loaded externally using standard commercially available parallel
programmers.
Besides greater speed, the DS89C430/DS89C450 include 1kB of data
RAM, a second full hardware serial port, seven additional interrupts, two extra levels of interrupt
priority, programmable watchdog timer, brownout monitor and power-fail reset. Dual data
pointers (DPTRs) are included to speed up block data-memory moves with further enhancements
coming from selectable automatic increment/decrement and toggle select operation. The speed of
MOVX data memory access can be adjusted by adding stretch values up to 10 machine cycles for
flexibility in selecting external memory and peripherals.
A power management mode consumes significantly lower power by slowing the CPU execution
rate from one clock period per cycle to 1024 clock periods per cycle. A selectable switchback
feature can automatically cancel this mode to enable normal speed responses to interrupts.
For EMI-sensitive applications, the microcontroller can disable the
ALE signal when the processor is not accessing external memory.
Terminology
The term DS89C430 is used in the remainder of the document to refer to the
DS89C430 and DS89C450, unless otherwise specified.
Compatibility
The DS89C430 is a fully static CMOS 8051-compatible microcontroller
similar in functional features to the DS87C520, but it offers much higher performance. In most
cases, the DS89C430 can drop into an existing socket for the 8xC51 family, immediately
Performance Overview
Featuring a completely redesigned high-speed 8051-compatible core, the
DS89C430 allows operation at a higher clock frequency. This updated core does not have the
wasted memory cycles that are present in a standard 8051. A conventional 8051 generates
machine cycles using the clock frequency divided by 12. The same machine cycle takes one
clock in the DS89C430. Thus, the fastest instructions execute 12 times faster for the same crystal
frequency (and actually 24 times faster for the INC data pointer instruction). It should be noted
that this speed improvement is reduced when using external memory access modes that require
more than one clock per cycle.
Individual program improvement depends on the instructions used. Speed-
sensitive applications would make the most use of instructions that are 12 times faster. However,
the sheer number of 12-to-1 improved op codes makes dramatic speed improvements likely for
any code. These architectural improvements produce instruction cycle times as low as 30ns. The
dual data pointer feature also allows the user to eliminate wasted instructions when moving
blocks of memory. The new page modes allow for increased efficiency in external memory
accesses.
3.1 MODEM
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 GSM
mobile phone, a GSM modem requires a SIM card from a wireless carrier in order to operate.
As mentioned in earlier sections of this SMS tutorial, computers use AT commands to control
modems. 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.
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.
The GSM/GPRS Modem comes with a serial interface through which the modem can be controlled using
AT command interface. An antenna and a power adapter are provided.
The basic segregation of working of the modem is as under
• Voice calls
• SMS
• GSM Data calls
• GPRS
Voice calls: Voice calls are not an application area to be targeted. In future if interfaces like a microphone
and speaker are provided for some applications then this can be considered.
SMS: SMS is an area where the modem can be used to provide features like:
• Pre-stored SMS transmission
• These SMS can be transmitted on certain trigger events in an automation system
• SMS can also be used in areas where small text information has to be sent. The transmitter can be an
automation system or machines like vending machines, collection machines or applications like
positioning systems where the navigator keeps on sending SMS at particular time intervals
• SMS can be a solution where GSM data call or GPRS services are not available
GSM Data Calls: Data calls can be made using this modem. Data calls can be made to a normal PSTN
modem/phone line also (even received). Data calls are basically made to send/receive data streams
between two units either PC’s or embedded devices. The advantage of Data calls over SMS is that both
parties are capable of sending/receiving data through their terminals.
• Devices that have communication on serial port either on PC or in the embedded environment
• Devices that want to communicate with a remote server for data transfer
• This capability of data transfer can help in reducing processing requirements of the device
• The basic aim is to provide a wireless solution keeping the existing firmware intact
• The clients firmware continues to work without any modifications (no changes in the existing software
required)
• GSM data calls can be a good solution where data has to be transmitted from a hand-held device to a
central server
• The interface on two sides can be between PC’s as well as embedded devices
• Calls can be established by the terminals at either side to start data calls
• The Modem remains transparent during data transfer after the call is established.
• Call establishment utility to be provided in case PC terminals
• Call establishment to be automated in case of embedded terminals. GSM converter can be an option
GSM was designed with a moderate level of security. The system was designed to authenticate the
subscriber using shared-secret cryptography. Communications between the subscriber and the base station
can be encrypted. The development of UMTS (UNIVERSAL MOBILE COMMUNICATING SYSTEM)
introduces an optional, that uses a longer authentication key to give greater security, as well as mutually
authenticating the network and the user - whereas GSM only authenticated the user to the network (and
not vice versa).
GSM uses several cryptographic algorithms for security. A large security advantage of GSM is
that the key, the crypto variable stored on the SIM card that is the key to any GSM ciphering
algorithm, is never sent over the air interface. Serious weaknesses have been found in both
algorithms, and it is possible to break A5/2 in real-time in a ciphertext-only attack. The system
supports multiple algorithms so of GSM converter is discussed later in this document operators
may replace that cipher with a stronger one.
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 GSM mobile phone, a GSM
modem requires a SIM card from a wireless carrier in order to operate.
Computers use AT commands to control modems. Both GSM modems and dial-up modems
support a common set of standard AT commands.
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.
Internal SIM card reader and option for external SIM card reader
Full RS232 on CMOS level with flow control (RX, TX, CTS, RTS, CTS, DTR,
DSR,DCD, RI)
The GSM Commercial Modem is an approved modem for embedded applications. It provides a 5V TTL
compatible serial interface to host Data terminal equipment.
Accessories:
1.PowerAdapter
2. Standard rubber antenna , regular GSM Coverage Areas.
3.6 APPLICATIONS
SMART CAR SECURITY SYSTEM 25
Access control devices: Now access control devices can communicate with servers and security staff
through SMS messaging. Complete log of transaction is available at the head-office Server instantly
without any wiring involved and device can instantly alert security personnel on their mobile phone in
case of any problem. RaviRaj Technologies is introducing this technology in all Fingerprint Access
control and time attendance products. You can achieve high security any reliability.
Transaction terminals: EDC machines, POS terminals can use SMS messaging to confirm transactions
from central servers. The main benefit is that central server can be anywhere in the world. Today you
need local servers in every city with multiple telephone lines. You save huge infrastructure costs as well
as per transaction cost.
Supply Chain Management: Today SCM require huge IT infrastructure with leased lines, networking
devices, data centre, workstations and still you have large downtimes and high costs. You can do all this
at a fraction of the cost with GSM M2M technology.
If your application needs one or more of the following features, GSM will be more cost-effective then
other communication systems.
Short Data Size: You data size per transaction should be small like 1-3 lines. e.g. banking transaction
data, sales/purchase data, consignment tracking data, updates. These small but important transaction data
can be sent through SMS messaging which cost even less then a local telephone call or sometimes free of
cost worldwide. Hence with negligible cost you are able to send critical information to your head office
located anywhere in the world from multiple points. You can also transfer faxes, large data through GSM
but this will be as or more costly compared to landline networks.
Multiple remote data collection points: If you have multiple data collections points situated all over
your city, state, country or worldwide you will benefit the most. The data can be sent from multiple points
like your branch offices, business associates, warehouses, agents with devices like GSM modems
connected to PCs, GSM electronic terminals and Mobile phones. Many a times some places like
High uptime: If your business require high uptime and availability GSM is best suitable for you as GSM
mobile networks have high uptime compared to landline, internet and other communication mediums.
Also in situations where you expect that someone may sabotage your communication systems by cutting
wires or taping landlines, you can depend on GSM wireless communication.
Mobility, Quick installation: GSM technology allow mobility, GSM terminals, modems can be just
picked and installed at other location unlike telephone lines. Also you can be mobile with GSM terminals
and can also communicate with server using your mobile phone. You can just purchase the GSM
hardware like modems, terminals and mobile handsets, insert SIM cards, configure software and your are
ready for GSM communication. GSM solutions can be implemented within few weeks whereas it may
take many months to implement the infrastructure for other technologies.
3.7 AT COMMANDS
a. Asynchronous: A serial data transmission method that uses Start and Stop bits to synchronize reception.
b. AT Commands: A group of commands that can be sent by a terminal or host computer to control the
ISU in Command mode.
c. Command Entry: An AT command is a string of characters sent by the DTE to the ISU while the ISU is
in command mode. A command string has a prefix, a body, and a terminator. The prefix consists of the
ASCII characters AT or at. The body is a string of commands restricted to printable ASCII characters.
The default terminator is the <CR> character.There are two format types for AT commands: basic and
extended. The basic commands consist of single ASCII characters, or single characters preceded by a
prefix character, followed by a decimal parameter.
c. The maximum number of characters in a command string is 128. Multiple commands can be
concatenated onto a single command line or by a semicolon.
e. If a parameter is missed from a basic command, a zero is implied (e.g. ATH implies ATH0). If an
optional parameter is skipped from an extended command, the current value is implied. Optional
parameters are enclosed by square brackets ([...]) in this document.
f. Spaces can be entered into a command string to increase clarity. These are ignored.
Commands:
+CMTI: <mem>,<index>
SMS-DELIVERs (except class 2 messages and messages in the message waiting indication group (store
message)) are routed directly to the TE using unsolicited result code:
defined in <mt>=1.
Read command returns the current settings for the SMS message indication. Response is in the
form:
+CNMI: <mode>,<mt>,<bm>,<ds>,<bfr>
Test command returns the supported settings of the phone. Response is in the form:
Execution command deletes message from preferred message storage <mem1> (<mem1> is the
selected message storage from the +CPMS command) location <index>. If deleting fails, final result code
+CMS
Execution command returns the SMS message with location value <index> from message storage
<mem1> (<mem1> is the selected message storage from the +CPMS command).
If status of the message is ’received unread’, status in the storage changes to ’received read’. If
reading fails, final result code +CMS ERROR: <cms_err> is returned.
AT+CMGS="+31638740161"<ENTER>
Replace the above phone number with your own cell phone number. The modem will respond with:
>
we can now type the message text and send the message using the <CTRL>-<Z> key combination
HelloWorld! <CTRL-Z>
SERIAL COMMUNICATION
The MAX232 device is a dual driver/receiver that includes a capacitive voltage generator to supply EIA-
232 voltage levels from a single 5-V supply. Each receiver converts EIA-232 inputs to 5-V TTL/CMOS
Serial RS-232 (v.24) communication works with voltages (between -15v … -3v are used to transmit a
binary ‘1’ and =3V ...-15v to transmit a binary ‘0’) which are not compatible with today’s computer logic
voltages. On the other hand , classic TTL computer logic operates between 0V…+5V (roughly 0V …
+0.8V referred to as low for Binary ‘0’,_2V ….+5V for high Binary ‘1’).Modern low-power logic
operates in the range of 0V ... +3.3V or even lower. So, the maximum RS-232 signal levels are far too
high for today's computer logic electronics, and the negative RS-232 voltage can't be grokked at all by the
computer logic. Therefore, to receive serial data from an RS-232 interface the voltage has to be reduced,
and the 0 and 1 voltage levels inverted. In the other direction (sending data from some logic over RS-232)
the low logic voltage has to be "bumped up", and a negative voltage has to be generated, too.
All this can be done with conventional analog electronics, e.g. a particular power supply and a couple of
transistors or the once popular 1488 (transmitter) and 1489 (receiver) IC s. However, since more than a
decade it has become standard in amateur electronics to do the necessary signal level conversion with an
IC from the MAX232 family (typically a MAX232 or some clone). IN fact , it is hard to find some RS-
232 circuitry in amateur electronics without a MAX232 or some clone.
Voltage levels
The MAX232 from Maxim was the first IC which in one package contains the necessary drivers
(two) and receivers (also two), to adapt the RS-232 signal voltage levels to TTL logic. It became
popular, because it just needs one voltage (+5V) and generates the necessary RS-232 voltage
levels (approx. -10V and +10V) internally. This greatly simplified the design of circuitry.
Circuitry designers no longer need to design and build a power supply with three voltages (e.g.
-12V, +5V, and +12V), but could just provide one +5V power supply, e.g. with the help of a
simple 78x05 voltage converter.
The MAX232 (A) has two receivers (converts from RS-232 to TTL voltage levels) and two
drivers (converts from TTL logic to RS-232 voltage levels). This means only two of the RS-232
signals can be converted in each direction. The old MC1488/1498 combo provided four drivers
and receivers.
When we look at the connector pinout 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 is the answering signal comming 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 incomming information faster than 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.
The last flow control signal present in DTE/DCE communication is the CD carrier detect. It is not used
directly for flow control, but mainly an indication of the ability of the modem device to communicate
with its counter part. This signal indicates the existence of a communication link between two modem
devices.
Connector
Connector 2 Function
1
2 3 Rx Tx
3 2 Tx Rx
5 5 Signal ground
4.2.2 INTRODUCTION
In telecommunications, RS-232 is a standard for serial binary data interconnection between a DTE (Data
terminal equipment) and a DCE (Data Circuit-terminating Equipment). It is commonly used in computer
serial ports.
The Electronic Industries Alliance (EIA) standard RS-232-C [3] as of 1969 defines:
Electrical signal characteristics such as voltage levels, signaling rate, timing and slew-rate of signals,
voltage withstand level, short-circuit behavior, maximum stray capacitance and cable length
Interface mechanical characteristics, pluggable connectors and pin identification
Functions of each circuit in the interface connector
Standard subsets of interface circuits for selected telecom applications
The standard does not define bit rates for transmission, although the standard says it is intended for bit
rates lower than 20,000 bits per second. Many modern devices can exceed this speed (38,400 and 57,600
bit/s being common, and 115,200 and 230,400 bit/s making occasional appearances) while still using RS-
232 compatible signal levels.
Details of character format and transmission bit rate are controlled by the serial port hardware, often a
single integrated circuit called a UART that converts data from parallel to serial form. A typical serial
port includes specialized driver and receiver integrated circuits to convert between internal logic levels
and RS-232 compatible signal levels.
In this circuit the MAX 232 IC used as level logic converter. The MAX232 is a dual driver/receiver that
includes a capacive voltage generator to supply EIA 232 voltage levels from a single 5v supply. Each
receiver converts EIA-232 to 5v TTL/CMOS levels. Each driver converts TLL/CMOS input levels into
EIA-232 levels.
In PC the transmitting data is given to R2IN of MAX232 through transmitting pin of 9 pin D type
connector which converts the RS232 level to 5v TTL/CMOS level. The R2OUT pin is connected to
receiver pin of the microcontroller. Likewise the data is transmitted and received between the
microcontroller and PC or other device vice versa.
5.1 INTRODUCTION
You can purchase an inexpensive GPS receiver, pop some batteries in it,
and turn it on. Your location appears on the screen .No map, compass, sextant, nor is sundial
required .Just like the magic. It’s not really magic, though, but has evolved from some great
practical applications of science that have come together over the last 50 years.
Military, government and civilian users all over the world rely on GPS for
navigation and location positioning, but radio signals have been used for navigation purposes
since the 1920’s. LORAN (Long Range Aid to Navigation), a position- finding system that
measured the time difference of arriving radio signals , was developed during World War- 2.
The first step to GPS came way back in 1957 when the Russians launched
SPUTNIK, the first satellite to orbit the Earth. Sputnik used a radio transmitter to broadcast
telemetry information. Scientists at that Johns Hopkins applied physics Lab discovered that the
Doppler shift phenomenon applied to the spacecraft – and almost unwittingly sruct gold.
A down – to –earth, painless example of the Doppler shift principle is when you stand
on a sidewalk and a police car speeds by in hot pursuit of a stolen motorcycle. The pitch of the
police siren increases as the car approaches you and then drops sharply as it moves away.
American scientists figured out that they knew the satellite’s precise orbital position,
they could accurately locate their exact position on earth by listening to the pinging sounds and
measuring the satellite’s radio signal Doppler shift. Satellite offered some possibilities for
navigation and positioning system .and the U.S.Deparment of Defense (DOD) explored the
concept.
In 1973, the Air-Force was selected as the lead organization to consolidate all the
military satellite navigation efforts into a single program. This evolved into the NAVSTAR
Satellites
Ground stations
Receivers
ATOMIC CLOCK: This keeps accurate time within three nanoseconds (around three-
billionths of a second).
GPS satellites don’t just help you stay found. All GPS satellites since 1980 carry NUDET
sensors .No, this isn’t some high-tech pornography-detection system.NUDET is an acronym for
Nuclear Detonation; GPS satellites have sensors to detect nuclear attack, and help evaluate strike
damage.
The solar-powered GPS satellites have a limited life span (around 10 years).
When they start to fail, spares are activated or new satellites are sent into orbit to replace the old
ones.
GPS satellites transmit two types of radio signals: C/A-code and P-code. Briefly, here are the
uses and differences of these two types of signals.
Coarse Acquisition(C/A-code) is the type of signal that consumer GPS units receive .C/A- code
is sent on the L1 band at a frequency of 1575.42 MHz
C/A – code is less accurate than p-code (see the following section) and is easier for U.S. military
forces to jam and spoof (broadcast false signals to make a receiver think it’s somewhere else
when it’s really not).
The advantage of C/A-code is that it’s quicker to use for acquiring satellites and getting an initial
position fix. Some military P-code receivers first track on the C/a-code and then switch over to
P-code.
PRECISION (P-CODE)
P-code provides highly precise location information. P-code is difficult to jam and spoof .the P-
code signal is broadcast on the L2 band at 1227.6 MHz
Ground stations are the control segments of GPS. Five unmanned ground stations
around the Earth monitor the satellites .information from the stations is sent to a master control
station – the Consolidated Space Operations Centre ( CSOC) at Schriever Air Force Base in
Colorado – where the data is processed to determine each satellite’s ephemeris and timing errors.
The processed data is sent to the satellites once daily with ground antenna located
around the world. This is kind of like syncing a personal digital assistant (PDA) with your
Anyone who has a GPS receiver the satellite signals to determine where he or she is located.
SATELLITE DATA:
GPS units receive two types of data from the NAVSATR satellites.
Almanac:
Almanac data contains the approximate positions of the satellites. The data is constantly being
transmitted and is stored in the GPS receiver’s memory.
Ephemeris:
Ephemeris data has the precise positions of the satellites. To get an accurate location fix, the
receiver has to know how far away a satellite is. The GPS receiver calculates the distance to the
satellite by using signals from the satellite.
Using the formula Distance=Velocity x Time, a GPS receiver calculates the satellite’s distance.
A radio signal travels at the speed of light (186,000 miles per second). The GPS receiver needs
to know how long the radio signal takes to travel from the satellite to the receiver in order to
figure the distance. Both the satellite and the GPS receiver generate an identical pseudo-random
code sequence. When the GPS receiver receives this transmitted code, it determines how much
the code needs to be shifted (using the Doppler-shift principle) for the two code sequences to
match .The shift is multiplied by the speed of light to determine the distance from the satellite to
the receiver.
GPS receivers tell you how accurate your position is. Based on the quality of
the satellite signals that the unit receives, the screen displays the estimated accuracy in feet or
meters. Accuracy depends on
Receiver location
Obstructions that block satellite signals
Even you’re not a military GPS user, you can get more accuracy by using a GPS receiver that
supports corrected location data. Corrected information is broadcast over radio signals that come
from either
Non-GPS satellites
Ground – based beacons
Two common sources of more accurate location data are
FIG 5.3 shows the accuracy you can expect from a GPS receiver. These numbers are guidelines;
at times, you may get slightly more or less accuracy.
TIME: A GPS receiver receives time information from atomic clocks, so it’s much more
accurate than your wristwatch.
Latitude(x coordinate)
Longitude (y coordinate)
Elevation
SPEED: When you are moving, a GPS receiver displays your speed.
DIRECTION OF TRAVEL: A GPS receiver can display your direction of t ravel if you’re
moving.
If you’re stationary, the unit can’t use satellite signals to determine which direction you’re
facing. Some GPS units have compasses that show the direction the receiver is pointed whether
you’re moving or standing still.
STORED LOCATIONS: You can locations where you’ve been or want to go with a GPS
receiver. These location positions are waypoints are important because a GPS unit can supply
you with directions and information on how to get to a waypoint. A collection of waypoints that
plots a course of travel is a route, which can also be stored .GPS receivers also store tracks
(which are like an electronic collection of breadcrumb trails that show where you’re been).
MORE ACCURATE:
The United States has started planning the next generation of GPS, dubbed GPS III. Driving
factors are better accuracy and reliability, improved resistance to signal jamming, and the
looming European Galileo system. Increasing the number of WAAS satellites in orbit is also
planned.
SMALLER:
GPS receivers will continue to shrink .GPS units already are integrated into wristwatches,
and PC Card GPS receives can plug into a laptop or PDA.
The three limiting factors that prevent a consumer receiver from shrinking are antenna size,
screen size, and power source size.
CHEAPER:
Prices will continue to decline as manufacturing costs decrease and production quantities
increase.
EASIER TO USE:
Simplified and less technical user interfaces will become more of a priority as GPS receivers
become more appliances like to meet the needs of specialized markets.
MORE INTEGRATED:
LESS WIRED
Most GPS receivers transfer data from personal computers through a cable Wireless technologies
such as Bluetooth ( www.bluetooth.com) and wireless USB are well suited for fast and easy data
transfer.
FACE RECOGNITION
6.1 INTRODUCTION
6.2.1. INTRODUCTION
space (observed variables) to the smaller intrinsic dimensionality of feature space (independent
variables), which are needed to describe the data economically. This is the case when there is a
The jobs which PCA can do are prediction, redundancy removal, feature
extraction, data compression, etc. Because PCA is a classical technique which can do something
in the linear domain,applications having linear mo dels are suitable, such as signal pro cessing,
image processing, systemand control theory, communications, etc.
Face recognition has many applicable areas. Moreover, it can be categorized into face
identification, face classification, or sex determination. The most useful applications contain
crowd surveillance, video content indexing, personal identi cation (ex. driver’s licence), mug
xi = [p1 . . . pN ]T , i = 1, . . . , M ....(1)
The images are mean centered by subtracting the mean image from each image vector. Let m
wi = xi – m .... (3)
Our goal is to find a set of ei’s which have the largest possible projection onto each of the wi’s.
It has been shown that the ei ’s and i’s are given by the eigenvectors and eigenvalues of the
covariance matrix
where W is a matrix composed of the column vectors wi placed side by side. The size of C is
N × N which could be enormous. For example, images of size 64 × 64 create the covariance
matrix of size 4096 ×4096. It is not practical to solve for the eigenvectors of C directly. A
common theorem in linear algebra states that the vectors ei and scalars i can be obtained by
solving for the eigenvectors and eigenvalues of the M × M matrix W T W. Let di and µi be the
which means that the rst M - 1 eigenvectors ei and eigenvalues i of WW T are given by W di
and µi, respectively. W di needs to be normalized in order to be equal to ei . Since we only sum
up a nite number of image vectors, M, the rank of the covariance matrix cannot exceed M - 1
where vi = eTi wi . vi is the ith coordinate of the facial image in the new space, which came to
be the principal component. The vectors ei are also images, so called, eigenimages, or eigenfaces
in our case, which was rst named by [1]. They can be viewed as images and indeed lo ok like
faces. So, describes the contribution of each eigenface in representing the facial image by
treating the eigenfaces as a basis set for facial images. The simplest method for determining
which face class provides the best description of an input facial image is to nd the face class k
that minimizes the Euclidean distance
where k is a vector describing the kth face class. If k is less than some prede ned threshold ,
• recognition of a person, where it must be decided if the individual has already been seen,
PCA computes the basis of a space which is represented by its training vectors.
These basis vectors, actually eigenvectors, computed by PCA are in the direction of the largest
variance of the training vectors. As it has been said earlier, we call them eigenfaces. Each
eigenface can be viewed a feature. When a particular face is pro jected onto the face space, its
vector into the face space describe the importance of each of those features in the face. The face
is expressed in the face space by its eigenface co e cients (or weights). We can handle a large
input vector, facial image, only by taking its small weight vector in the face space. This means
that we can reconstruct the original face with some error, since the dimensionality of the image
space is much larger than that of face space.
In this report, let’s consider face identi cation only. Each face in the training
set is transformed into the face space and its components are stored in memory. The face space
has to be populated with these known faces. An input face is given to the system, and then it is
pro jected onto the face space. The system computes its distance from all the stored faces.
2. What if the face presented to the system has not already learned, i.e., not stored as a
knownface?
The first defect is easily avoided since the first eigenface is a good face filter which
can test whether each image is highly correlated with itself. The images with a low correlation
2. Near face space but not near a known face = unknown faces
4. Distant from face space and not near a known class = non-faces
Since a face is well represented by the face space, its reconstruction should be similar
to the original, hence the reconstruction error will be small. Non-face images will have a large
reconstruction error which is larger than some threshold r . The distance k determines whether the
input face is near a known face.
It contains ten different imagesof each of 40 distinct subjects. For some subjects, the images
were taken at di erent times,varying the lighting, facial expressions (open/closed eyes,
smiling/not smiling) and facial details (glasses/no glasses). All the images were taken against a
dark homogeneous background with the subjects in an upright, frontal position (with tolerance
for some side movement). An experiment with a subset of the database, which only contains 12
subject’s images, has been performed to ensure how well the eigenface system can identify each
individual’s face. There are 5 additional test images, each of which is the known face. I also
appended 2 non-face images to test whether it can detect them correctly.
Figure 3 shows the eigenface images which are originally the eigenvectors ei of the
covariance matrix at Eq.6. The first eigenface account for the maximal variation of the training
vectors. The 10 original training images and their reconstructed versions are depicted in Figure 1
and 2. The result was very successful given the test images in Figure 4. Every test image was
correctly classified.
Fig 2:Reconstructed Images of training Images- They are almost same as the original images
Fig.3: Eigen face: the first eigen face account for the maximal variation of the
training vectors and the second one accounts for the second maximal variation, etc.
Test images: the number corresponds the order of the set of original training images in figure 1r*
1-th 2-th 3-th 4-th 5-th 6-th 7-th 8-th 9-th 10-th
When two unknown faces in Figure 5 are input to the system, the ’s at Eq. 10 are larger
than the prede ned threshold. In the case of two non-face images in Figure 5, the reconstruction
t1 r1 t3 r3 t6 r6 t8 r8 t9 r9
errors were larger than the reconstruction threshold, then they are not considered as face images.
The MATLAB source codes are attached to the appendix in the end of this summary .
The suggested methods to deal with unknown faces and non-faces are not good enough to
SOFTWARES USED
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
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. Other new features in the
µVision Debugger include:
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 signaling algorithms." said Jon Ward,
President of Keil Software USA, Inc.
The Keil C51 C Compiler for the 8051 microcontroller is the most popular 8051 C
compiler in the world. It provides more features than any other 8051 C compiler available today.
SMART CAR SECURITY SYSTEM 64
The C51 Compiler allows you to write 8051 microcontroller applications in C that, once
compiled, have the efficiency and speed of assembly language. Language extensions in the C51
Compiler give you full access to all resources of the 8051.
The C51 Compiler translates C source files into relocatable object modules which contain full
symbolic information for debugging with the µVision Debugger or an in-circuit emulator. In
addition to the object file, the compiler generates a listing file which may optionally include
symbol table and cross reference
The capability to provide fast and universal design entry makes orcad capture
design entry the most widely used schematic entry system in electronic design today. Whether
used to design a new analog circuit, revise a schematic diagram for an existing printed circuit
SMART CAR SECURITY SYSTEM 66
board (PCB), or design a digital block diagram with an HDL module, orcad capture provides the
tools needed to enter, modify, and verify the PCB design. Orcad Capture CIS integrates the
Orcad Capture schematic design application with the features of a component information
system (CIS).
ORCAD capture CIS is designed to reduce production delays and cost overruns
through efficient management of components. It reduces the time spent searching existing parts
for reuse, manually entering part information content, and maintaining component data. Users
search parts based on their electrical characteristics and orcad capture CIS automatically
retrieves the associated part. Flexible and scalable, the solution is quickly implemented.
Orcad capture CIS is ideal for individual design teams or multi-site teams who need to
collaborate across multiple locations, orcad capture CIS gives designers access to correct part
data early in the design process and enables complete component specifications to be passed to
board designers and other members of the design team, reducing the potential for downstream
errors. It provides access to cost information so designers can use preferred, lower cost, and in
stock parts. The embedded part selector accesses information stored in MRP/ERP systems and
engineering databases and synchronizes externally sourced data with the schematic design
database, so bills of materials can be automatically generated.
7.2.4 EATURES
SCHEMATIC EDITOR
The full-featured schematic editor allows users to view and edit multiple schematic
designs in a single session. Design data is easily reused by copying and pasting within or
between schematics. Parts are quickly selected from a comprehensive set of functional part
libraries. Configurable design and electrical rule checkers ensure design integrity. In-line editing
of parts allows pin name and number movement. A user interface has been provided to add
critical constraints for users of the orcad capture to orcad PCB editor flow.
The Project Manager simplifies organizing and tracking the various types of data
generated in the design process. An expanding tree diagram makes it easy to structure and
navigate design files, including those generated by pspice simulators, orcad capture CIS, and
other plugins. A Creation Wizard guides users through all the resources available for a specific
design flow. Users can navigate the entire schematic structure and instantly open specific
elements a schematic page, part, or net with the hierarchy browser.
The library editor is accessed directly from the orcad capture user interface. Users
can create and edit parts in the library or directly from the schematic page without interrupting
workflow. Intuitive graphical controls speed schematic part creation and editing. New parts are
created quickly by modifying existing ones. New parts can also be created from spread sheets. A
library part generator automates the integration of field programmable gate arrays (FPGAs) and
programmable logic devices (PLDs) into the system schematic. The Generate Part feature
simplifies the creation of core FPGA library parts for high-pin-count devices. These parts can be
split into multiple parts.
Designers can access all part, net, pin, and title block properties, or any subset, and
make changes quickly through the orcad capture spreadsheet property editor. It simply requires
BENEFITS
• Imports and exports virtually every commonly used design file format
• Five simple steps to erasing and programming a device and setting any options desired
• Check which Flash blocks are blank or in use with the ability to easily erase all blocks in
use
• Reprogram the Boot Vector and Status Byte with the help of confirmation features that
prevent accidentally programming incorrect values
• Single-click access to the manual, Flash Magic home page and NXP Microcontrollers
home page
• Ability to use high-speed serial communications on devices that support it. Flash Magic
calculates the highest baudrate that both the device and your PC can use and switches to that
baudrate transparently
7.4 EMBEDDED C
SMART CAR SECURITY SYSTEM 73
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
nothave the umbrella or support of the operating system. The programmer has to be
accustomed with the absence of system calls which makes life easy in traditional C.
MATLAB is an interactive system whose basic data element is an array that does not require
dimensioning. This allows you to solve many technical computing problems, especially those
with matrix and vector formulations, in a fraction of the time it would take to write a program in
a scalar non interactive language such as C or FORTRAN.
The name MATLAB stands for matrix laboratory. MATLAB was originally written to provide
easy access to matrix software developed by the LINPACK and EISPACK projects. Today,
MATLAB engines incorporate the LAPACK and BLAS libraries, embedding the state of the art
in software for matrix computation.
MATLAB has evolved over a period of years with input from many users. In university
environments, it is the standard instructional tool for introductory and advanced courses in
mathematics, engineering, and science. In industry, MATLAB is the tool of choice for high-
productivity research, development, and analysis.
This is the set of tools and facilities that help you use MATLAB functions and files.
Many of these tools are graphical user interfaces. It includes the MATLAB desktop and
command window, a command history, an editor and debugger, and browsers for viewing help,
the workspace, files, and the search path.
This is a high-level matrix/array language with control flow statements, functions, data
structures, input/output, and object-oriented programming features. It allows both “programming
in the small” to rapidly create quick and dirty throw-away programs, and “programming in the
large” to create large and complex application programs.
Graphics:
This is a library that allows you to write C and FORTRAN programs that interact with
MATLAB. It includes facilities for calling routines from MATLAB (dynamic linking), calling
MATLAB as a computational engine, and for reading and writing MAT-files.
Various toolboxes are there in MATLAB for computing recognition techniques, but we are
using IMAGE PROCESSING toolbox.
A file with extension .fig, called a FIG-file that contains a complete graphical description of
all the function’s GUI objects or elements and their spatial arrangement. A FIG-file contains
A file with extension .m, called a GUI M-file, which contains the code that controls the GUI
operation. This file includes functions that are called when the GUI is launched and exited,
and callback functions that are executed when a user interacts with GUI objects for example,
when a button is pushed.
guide filename
Where filename is the name of an existing FIG-file on the current path. If filename is omitted,
Axes
Axes enable your GUI to display graphics (e.g., graphs and images). Like all graphics objects, axes have
properties that you can set to control many aspects of its behavior and appearance. See Axes Properties
Axes Callbacks
Axes are not uicontrol objects, but can be programmed to execute a callback when users click a
mouse button in the axes. Use the axes ButtonDownFcn property to define the callback.
If a GUI has multiple axes, you should explicitly specify which axes you want to target when
you issue plotting commands. You can do this using the axes command and the handles
structure. For example,
axes(handles.axes1)
makes the axes whose Tag property is axes1 the current axes, and therefore the
target for plotting commands. You can switch the current axes whenever you want to target a
different axes. See GUI with Multiple Axes for and example that uses two axes.
Figure
Figures are the windows that contain the GUI you design with the Layout Editor. See the
description of figure properties for information on what figure characteristics you can control.
7.6 ADVANTAGES
• Alert system
• Optimized System
7.7 APPLICATIONS
• Security applications
• Banking applications
RESULT
The embedded control central works all the time or discontinuously for power saving, achieve
images and GPS data. During alarm periods, if faces have been detected , or longitude and
latitude of the car change, alarms would be made, and GSM module works to inform somebody.
When the car is lost, new GPS data could be received to help to find them.Experiment results
show that it takes about 6 seconds to detect one 320*240 colored jpeg image by software. It
seems to be too long to be used in “Real- Time” detection, the driver could not leave the seat
very soon as we discussed earlier, so it is also “fast” enough and valuable for a low cost, low
power and smart car security system with out additional hardware modules. During the
expirement, we find out that the face detection module can not detect those faces not in front of
camera, for example, where there is a big angle between face and camera. It proves to us that the
detection algorithm can not detect all kinds of faces and the camera need to be fixed toward the
face of the driver if possible. Because of the flexibility of embedded system, the embedded smart
car security system is extendable for special purposes. The IIC bus interface offer a widely
communication bandwidth with the car control system to change data and information, and new
functional modules can be easily added to the system to upgrade and enhance it. Experiment
BIBILOGRAPHY
www.microcontroller.com
ieeexplore.ieee.org
EMBEDDED CODING
#include<REG420.h>
#include<stdio.h>
#include<string.h>
#include <stdlib.h>
//***************Variable declaration**************//
//***************Function declaration**************//
void init_comms(void);
void Send_SMS(void);
void main()
Delay_ms12M(100);
init_comms();
P0 = 0x00;
DEV=1;
Transmit_0('L');
while(1){
while(Flag1==0); Send_SMS();
if(RI_1)
temp = SBUF1;
//Receive the first character
if (temp == 'C')
ES1 = 1;
Gets(y,0);
while(!(strchr(y,'C'))) Gets(y,0);
ptr = strchr(y,'C')+ 2;
Flag = 1;
Flag1 = 1;
RI_1 = 0;
RecDat = SBUF0;
if(RecDat == 'V')
// SBUF0=RecDat;
Flag1=1;
DEV=0;
RI_0 = 0;
void init_comms(void)
EA = 1;
ES0 = 1; ES1 = 0;
SCON1 = 0x50; //SERIAL CONN MODE 1 - SERIAL 1 (START, 8-DATA, 1 STOP BIT)
TCON = 0x50;
int j;
while(del>0)
del--;
for(j=0;j<110;j++);
while(*string)
do
if(n==1)
*(string+i)= Get_USART_char_0();
else
*(string+i)= Get_USART_char_1();
J = *(string+i); //Transmit_0(J);
i++;
i++;
*(string+i) = NULL;
while(!RI_1);
c = SBUF1; RI_1 = 0;
return c;
unsigned char c;
while(!RI_0);
c = SBUF0; RI_0 = 0;
return c;
SBUF0 = dat;
while(TI_0==0);
TI_0 = 0;
Delay_ms12M(2);
void Send_SMS(void)
while(Flag==0); Flag = 0;
//Transmit_0(0XAB);
//
Transmit_0(0XB1);
SBUF0_puts(ptr);
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Outputs from this function are returned to the command line.
function varargout = gui_pca_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=ones(256,256);
axes(handles.axs_1);
imshow(a);
axes(handles.axs_q);
% axes(handles.axs_5);
% imshow(a);
%
% axes(handles.axs_7);
% imshow(a);
data;
helpdlg('database successfully added to database');
inputimage = handles.inputimage ;
r_image=inputimage;
queryEnergies_r = obtainEnergies1(r_image); % Obtain top 6 energies of the IRdemo.
fid = fopen('database.txt');
X = imread(imagename);
r1_image=X;
imageEnergies_r = obtainEnergies1(r1_image);
fresultValues_r(i) = E_r;
fresultNames_r(j) = {imagename};
i = i + 1;
j = j + 1;
end
fclose(fid);
if sortedValues_r(1) == 0
imagename = char(fresultNames_r(index_r(1)));
axes(handles.axs_1);
imshow(imagename);
warndlg('AUTHENTICATED');
else
k=1;
while k
s1 = serial('COM1');
set(s1,'BaudRate',9600,'StopBits',1,'FlowControl','none','Parity','none','DataBits'...
,8,'outputBufferSize',5000);
s1.InputBufferSize=5000;
s1.TimeOut=5;
fopen(s1);
out = fread(s1);
fclose(s1);
delete(s1);
if out==76;
k =0;
imaqhwinfo
vid = videoinput('winvideo', 1, 'RGB24_320x240');
preview(vid);
pause;
data = getsnapshot(vid);
figure;
imshow(data);
imwrite(data,'input1.jpg');
axes(handles.axs_q);
end