Professional Documents
Culture Documents
CONTENTS
CHAPTER NO
DESCRIPTION
PAGE NO
ABSTRACT
INTRODUCTION
BLOCK DIAGRAM
6
6
5.2 RS-232
24
5.3 RELAY
26
5.4 DC MOTOR
26
27
PCB DESIGN
6.1
INTRODUCTION
32
6.2
SOFTWARE
32
6.3
MANUFACTURING
32
6.4
PANELISATION
32
6.5
DRILLING
32
CHAPTER NO
DESCRIPTION
PAGE NO
6.6
PLATING
33
6.7
ETCHING
33
6.8
SOLDER MASK
33
6.9
33
SOFTWARE
7
SOFTWARE TOOLS
7.1
KEIL
33
37
AN 8051
10
ADVANTAGES
38
11
APPLICATIONS
39
12
CONCLUSION
39
13
BIBLIOGRAPHY
39
1.Abstract:
The aim of this project is to use wireless technology to intimate the owner of the
vehicle about any unauthorized entry. This is done by sending an auto-generated SMS to the
owner. An added advantage of this project is that the owner can send back the SMS which
will disable the ignition of the vehicle.
As the crime rate is going up, security system for vehicles is extremely essential.
In this proposed system if someone tries to steal the car, the microcontroller gets an interrupt
through a switch mechanism connected to the system and commands the GSM modem to
send an SMS. The owner receives the SMS that his car is stolen. He can then send back an
SMS to the GSM modem to stop the engine. The GSM modem interfaced to the
microcontroller, receives the message, the output of which activates a mechanism that
disables the ignition of the vehicle resulting in stopping the vehicle. The project uses a lamp
to indicate the engine ON/OFF condition.
Thus, owner of the vehicle from anywhere can switch off ignition of his car. This
project can be further enhanced by integrating a GPS system, which will give exact position
of the vehicle in terms of its latitude and longitude. Further this data can be sent to the owner
via SMS who can enter this value on Google maps to get the exact location of the vehicle.
2.Introduction:
With the rapid development of national economy, automobiles have increased greatly as
the human's important vehicles. However, it is the development of modern technology
that makes the commit means of crimes become smarter and the automobiles stolen
events more frequent. Electronics anti-theft is the most widely used among all the
appliances at the moment. But the chip one and the network one are the developing
directions of the auto-guard technology. GSM(Global System for Mobile
Communication) is a case which is the most mature and widely used in mobile
communication system. It ensures the information transmission so real-time, security
and reliable that realizes the long distance control[1].This paper is about a design of a
new fashion auto-guard which is a smart measurement generalized in the automobile
security area.
3.Block Diagram:
4.Block Explanation:
4.1 Microcontroller:
Microcontroller act as a control system of the circuit.
MEMORY TYPES:
RAM:
ROM:
ARCHITECTURE OF AT89C51
8051 Architecture:
8051 Architecture contains the following:
CPU
ALU
I/O ports
RAM
ROM
2 Timers/Counters
General Purpose registers
8
Interrupts
An interrupt is a special feature which allows the 8051 to provide the illusion of "multitasking," although in reality the 8051 is only doing one thing at a time. The word "interrupt"
can often be subsituted with the word "event."
An interrupt is triggered whenever a corresponding event occurs. When the event occurs, the
8051 temporarily puts "on hold" the normal execution of the program and executes a special
section of code referred to as an interrupt handler. The interrupt handler performs whatever
special functions are required to handle the event and then returns control to the 8051 at
which point program execution continues as if it had never been interrupted.
The topic of interrupts is somewhat tricky and very important. For that reason, an entire
chapter will be dedicated to the topic. For now, suffice it to say that Interrupts can cause
program flow to change.
8051 Tutorial: Instruction Set, Timing, and Low-Level Info
In order to understand--and better make use of--the 8051, it is necessary to understand some
underlying information concerning timing.
The 8051 operates based on an external crystal. This is an electrical device which, when
energy is applied, emits pulses at a fixed frequency.
One can find crystals of virtually any frequency depending on the application requirements.
When using an 8051, the most common crystal frequencies are 12 megahertz and 11.059
megahertz--with 11.059 being much more common. Why would anyone pick such an oddball frequency? Theres a real reason for it--it has to do with generating baud rates and well
talk more about it in the Serial Communication chapter. For the remainder of this discussion
well assume that were using an 11.059Mhz crystal.
Microcontrollers (and many other electrical systems) use crystals to syncrhronize operations.
The 8051 uses the crystal for precisely that: to synchronize its operation. Effectively, the
8051 operates using what are called "machine cycles." A single machine cycle is the
minimum amount of time in which a single 8051 instruction can be executed. although many
instructions take multiple cycles.
A cycle is, in reality, 12 pulses of the crystal. That is to say, if an instruction takes one
machine cycle to execute, it will take 12 pulses of the crystal to execute. Since we know the
crystal is pulsing 11,059,000 times per second and that one machine cycle is 12 pulses, we
can calculate how many instruction cycles the 8051 can execute per second:
11,059,000 / 12 = 921,583
This means that the 8051 can execute 921,583 single-cycle instructions per second. Since a
large number of 8051 instructions are single-cycle instructions it is often considered that the
8051 can execute roughly 1 million instructions per second, although in reality it is less--and,
depending on the instructions being used, an estimate of about 600,000 instructions per
second is more realistic.
For example, if you are using exclusively 2-cycle instructions you would find that the 8051
would execute 460,791 instructions per second. The 8051 also has two really slow
instructions that require a full 4 cycles to execute--if you were to execute nothing but those
instructions youd find performance to be about 230,395 instructions per second.
It is again important to emphasize that not all instructions execute in the same amount of
time. The fastest instructions require one machine cycle (12 crystal pulses), many others
require two machine cycles (24 crystal pulses), and the two very slow math operations
require four machine cycles (48 crystal pulses).
NOTE: Many 8051 derivative chips change instruction timing. For example, many optimized
versions of the 8051 execute instructions in 4 oscillator cycles instead of 12; such a chip
would be effectively 3 times faster than the 8051 when used with the same 11.059 Mhz
crystal.
Since all the instructions require different amounts of time to execute a very obvious question
comes to mind: How can one keep track of time in a time-critical application if we have no
reference to time in the outside world?
Luckily, the 8051 includes timers which allow us to time events with high precision--which is
the topic of the next chapter.
8051 Timers
The 8051 comes equipped with two timers, both of which may be controlled, set, read, and
configured individually. The 8051 timers have three general functions: 1) Keeping time
and/or calculating the amount of time between events, 2) Counting the events themselves, or
3) Generating baud rates for the serial port.
10
The three timer uses are distinct so we will talk about each of them separately. The first two
uses will be discussed in this chapter while the use of timers for baud rate generation will be
discussed in the chapter relating to serial ports.
How does a timer count?
How does a timer count? The answer to this question is very simple: A timer always counts
up. It doesnt matter whether the timer is being used as a timer, a counter, or a baud rate
generator: A timer is always incremented by the microcontroller.
Programming Tip: Some derivative chips actually allow the program to configure
whether the timers count up or down. However, since this option only exists on some
derivatives it is beyond the scope of this tutorial which is aimed at the standard 8051.
It is only mentioned here in the event that you absolutely need a timer to count
backwards, you will know that you may be able to find an 8051-compatible
microcontroller that does it.
USING TIMERS TO MEASURE TIME
Obviously, one of the primary uses of timers is to measure time. We will discuss this use of
timers first and will subsequently discuss the use of timers to count events. When a timer is
used to measure time it is also called an "interval timer" since it is measuring the time of the
interval between two events.
How long does a timer take to count?
First, its worth mentioning that when a timer is in interval timer mode (as opposed to event
counter mode) and correctly configured, it will increment by 1 every machine cycle. As you
will recall from the previous chapter, a single machine cycle consists of 12 crystal pulses.
Thus a running timer will be incremented:
11,059,000 / 12 = 921,583
921,583 times per second. Unlike instructions--some of which require 1 machine cycle,
others 2, and others 4--the timers are consistent: They will always be incremented once per
machine cycle. Thus if a timer has counted from 0 to 50,000 you may calculate:
50,000 / 921,583 = .0542
.0542 seconds have passed. In plain English, about half of a tenth of a second, or onetwentieth of a second.
Obviously its not very useful to know .0542 seconds have passed. If you want to execute an
event once per second youd have to wait for the timer to count from 0 to 50,000 18.45 times.
How can you wait "half of a time?" You cant. So we come to another important calculation.
11
Lets say we want to know how many times the timer will be incremented in .05 seconds. We
can do simple multiplication:
.05 * 921,583 = 46,079.15.
This tells us that it will take .05 seconds (1/20th of a second) to count from 0 to 46,079.
Actually, it will take it .049999837 seconds--so were off by .000000163 seconds--however,
thats close enough for government work. Consider that if you were building a watch based
on the 8051 and made the above assumption your watch would only gain about one second
every 2 months. Again, I think thats accurate enough for most applications--I wish my watch
only gained one second every two months!
Obviously, this is a little more useful. If you know it takes 1/20th of a second to count from 0
to 46,079 and you want to execute some event every second you simply wait for the timer to
count from 0 to 46,079 twenty times; then you execute your event, reset the timers, and wait
for the timer to count up another 20 times.
In this manner you will effectively execute your event once per second, accurate to within
thousandths of a second. Thus, we now have a system with which to measure time. All we
need to review is how to control the timers and initialize them to provide us with the
information we need.
Timer SFRs
As mentioned before, the 8051 has two timers which each function essentially the same way.
One timer is TIMER0 and the other is TIMER1. The two timers share two SFRs (TMOD and
TCON) which control the timers, and each timer also has two SFRs dedicated solely to itself
(TH0/TL0 and TH1/TL1).
Weve given SFRs names to make it easier to refer to them, but in reality an SFR has a
numeric address. It is often useful to know the numeric address that corresponds to an SFR
name.
Description
SFR Address
TH0
8Ch
TL0
8Ah
12
TH1
8Dh
TL1
8Bh
TCON
Timer Control
88h
TMOD
Timer Mode
89h
When you enter the name of an SFR into an assembler, it internally converts it to a number.
For example, the command:
MOV TH0,#25h
It moves the value 25h into the TH0 SFR. However, since TH0 is the same as SFR address
8Ch this command is equivalent to:
MOV 8Ch,#25h
Now, back to the timers. First, lets talk about Timer 0.
Timer 0 has two SFRs dedicated exclusively to itself: TH0 and TL0. Without making things
too complicated to start off with, you may just think of this as the high and low byte of the
timer. That is to say, when Timer 0 has a value of 0, both TH0 and TL0 will contain 0. When
Timer 0 has the value 1000, TH0 will hold the high byte of the value (3 decimal) and TL0
will contain the low byte of the value (232 decimal). Reviewing low/high byte notation, recall
that you must multiply the high byte by 256 and add the low byte to calculate the final value.
That is to say:
TH0
*
3 * 256 + 232 = 1000
256
TL0
1000
Timer 1 works the exact same way, but its SFRs are TH1 and TL1.
Since there are only two bytes devoted to the value of each timer it is apparent that the
maximum value a timer may have is 65,535. If a timer contains the value 65,535 and is
subsequently incremented, it will reset--or overflow--back to 0.
The TMOD SFR
Lets first talk about our first control SFR: TMOD (Timer Mode). The TMOD SFR is used to
control the mode of operation of both timers. Each bit of the SFR gives the microcontroller
specific information concerning how to run a timer. The high four bits (bits 4 through 7)
relate to Timer 1 whereas the low four bits (bits 0 through 3) perform the exact same
functions, but for timer 0.
13
Explanation of Function
Timer
When this bit is set the timer will only run when INT1 (P3.3) is high.
GATE1 When this bit is clear the timer will run regardless of the state of 1
INT1.
C/T1
When this bit is set the timer will count events on T1 (P3.5). When
1
this bit is clear the timer will be incremented every machine cycle.
T1M1
T1M0
When this bit is set the timer will only run when INT0 (P3.2) is high.
GATE0 When this bit is clear the timer will run regardless of the state of 0
INT0.
C/T0
When this bit is set the timer will count events on T0 (P3.4). When
0
this bit is clear the timer will be incremented every machine cycle.
T0M1
T0M0
As you can see in the above chart, four bits (two for each timer) are used to specify a mode of
operation.
TxM0
Timer Mode
Description of Mode
13-bit Timer.
16-bit Timer
8-bit auto-reload
14
FDh
15
FEh
FDh
FFh
FDh
FDh
FDh
FEh
FDh
FFh
FDh
FDh
FDh
FEh
As you can see, the value of TH0 never changed. In fact, when you use mode 2 you almost
always set THx to a known value and TLx is the SFR that is constantly incremented.
Whats the benefit of auto-reload mode? Perhaps you want the timer to always have a value
from 200 to 255. If you use mode 0 or 1, youd have to check in code to see if the timer had
overflowed and, if so, reset the timer to 200. This takes precious instructions of execution
time to check the value and/or to reload it. When you use mode 2 the microcontroller takes
care of this for you. Once youve configured a timer in mode 2 you dont have to worry about
checking to see if the timer has overflowed nor do you have to worry about resetting the
value--the microcontroller hardware will do it all for you.
The auto-reload mode is very commonly used for establishing a baud rate which we will talk
more about in the Serial Communications chapter.
Split Timer Mode (mode 3)
Timer mode "3" is a split-timer mode. When Timer 0 is placed in mode 3, it essentially
becomes two separate 8-bit timers. That is to say, Timer 0 is TL0 and Timer 1 is TH0.
Both timers count from 0 to 255 and overflow back to 0. All the bits that are related to Timer
1 will now be tied to TH0.
While Timer 0 is in split mode, the real Timer 1 (i.e. TH1 and TL1) can be put into modes 0,
1 or 2 normally--however, you may not start or stop the real timer 1 since the bits that do that
are now linked to TH0. The real timer 1, in this case, will be incremented every machine
cycle no matter what.
The only real use I can see of using split timer mode is if you need to have two separate
timers and, additionally, a baud rate generator. In such case you can use the real Timer 1 as a
baud rate generator and use TH0/TL0 as two separate timers.
The TCON SFR
16
Finally, theres one more SFR that controls the two timers and provides valuable information
about them. The TCON SFR has the following structure:
TCON (88h) SFR
Bit Name
Bit
Explanation of Function
Address
TF1
8Fh
TR1
8Eh
Timer 1 Run. When this bit is set Timer 1 is turned on. When this
1
bit is clear Timer 1 is off.
TF0
8Dh
TR0
8Ch
Timer 0 Run. When this bit is set Timer 0 is turned on. When this
0
bit is clear Timer 0 is off.
Timer
As you may notice, weve only defined 4 of the 8 bits. Thats because the other 4 bits of the
SFR dont have anything to do with timers--they have to do with Interrupts and they will be
discussed in the chapter that addresses interrupts.
A new piece of information in this chart is the column "bit address." This is because this SFR
is "bit-addressable." What does this mean? It means if you want to set the bit TF1--which is
the highest bit of TCON--you could execute the command:
MOV TCON, #80h
... or, since the SFR is bit-addressable, you could just execute the command:
SETB TF1
This can set the high bit of TCON without changing the value of any other bits of the
SFR. Usually when you start or stop a timer you dont want to modify the other values in
TCON, so you take advantage of the fact that the SFR is bit-addressable.
Initializing a Timer
Now that weve discussed the timer-related SFRs we are ready to write code that will
initialize the timer and start it running. As youll recall, we first must decide what mode we
want the timer to be in. In this case we want a 16-bit timer that runs continuously; that is to
say,
it
is
not
dependent
on
any
external
pins.
We must first initialize the TMOD SFR. Since we are working with timer 0 we will be using
the lowest 4 bits of TMOD. The first two bits, GATE0 and C/T0 are both 0 since we want the
timer to be independent of the external pins. 16-bit mode is timer mode 1 so we must clear
17
T0M1 and set T0M0. Effectively, the only bit we want to turn on is bit 0 of TMOD. Thus to
initialize the timer we execute the instruction:
MOV TMOD,#01h
Timer 0 is now in 16-bit timer mode. However, the timer is not running. To start the timer
running we must set the TR0 bit We can do that by executing the instruction:
SETB TR0
Upon executing these two instructions timer 0 will immediately begin counting, being
incremented once every machine cycle (every 12 crystal pulses).
Reading the Timer
There are two common ways of reading the value of a 16-bit timer; which you use depends
on your specific application. You may either read the actual value of the timer as a 16-bit
number, or you may simply detect when the timer has overflowed.
Reading the value of a Timer
If your timer is in an 8-bit mode--that is, either 8-bit AutoReload mode or in split timer
mode--then reading the value of the timer is simple. You simply read the 1-byte value of the
timer and youre done.
However, if youre dealing with a 13-bit or 16-bit timer the chore is a little more complicated.
Consider what would happen if you read the low byte of the timer as 255, then read the high
byte of the timer as 15. In this case, what actually happened was that the timer value was
14/255 (high byte 14, low byte 255) but you read 15/255. Why? Because you read the low
byte as 255. But when you executed the next instruction a small amount of time passed--but
enough for the timer to increment again at which time the value rolled over from 14/255 to
15/0. But in the process youve read the timer as being 15/255. Obviously theres a problem
there.
The solution? Its not too tricky, really. You read the high byte of the timer, then read the low
byte, then read the high byte again. If the high byte read the second time is not the same as
the high byte read the first time you repeat the cycle. In code, this would appear as:
REPEAT: MOV A,TH0
MOV R0,TL0
CJNE A,TH0,REPEAT
...
18
In this case, we load the accumulator with the high byte of Timer 0. We then load R0 with the
low byte of Timer 0. Finally, we check to see if the high byte we read out of Timer 0--which
is now stored in the Accumulator--is the same as the current Timer 0 high byte. If it isnt it
means weve just "rolled over" and must reread the timers value by going back to REPEAT.
When the loop exits we will have the low byte of the timer in R0 and the high byte in the
Accumulator.
Another much simpler alternative is to simply turn off the timer run bit (i.e. CLR TR0), read
the timer value, and then turn on the timer run bit (i.e. SETB TR0). In that case, the timer
isnt running so no special tricks are necessary. Of course, this implies that your timer will be
stopped for a few machine cycles. Whether or not this is tolerable depends on your specific
application.
Detecting Timer Overflow
Often it is necessary to just know that the timer has reset to 0. That is to say, you are not
particularly interest in the value of the timer but rather you are interested in knowing when
the timer has overflowed back to 0.
Whenever a timer overflows from its highest value back to 0, the microcontroller
automatically sets the TFx bit in the TCON register. This is useful since rather than checking
the exact value of the timer you can just check if the TFx bit is set. If TF0 is set it means that
timer 0 has overflowed; if TF1 is set it means that timer 1 has overflowed.
We can use this approach to cause the program to execute a fixed delay. As youll recall, we
calculated earlier that it takes the 8051 1/20th of a second to count from 0 to 46,079.
However, the TFx flag is set when the timer overflows back to 0. Thus, if we want to use the
TFx flag to indicate when 1/20th of a second has passed we must set the timer initially to
65536 less 46079, or 19,457. If we set the timer to 19,457, 1/20th of a second later the timer
will overflow. Thus we come up with the following code to execute a pause of 1/20th of a
second:
MOV
TH0,#76;High
byte
of
19,457
(76
*
256
=
MOV TL0,#01;Low byte
of 19,457 (19,456 + 1 =
MOV
TMOD,#01;Put
Timer
0
in
16-bit
SETB
TR0;Make
Timer
0
start
JNB TF0,$;If TF0 is not set, jump back to this same instruction
19,456)
19,457)
mode
counting
In the above code the first two lines initialize the Timer 0 starting value to 19,457. The next
two instructions configure timer 0 and turn it on. Finally, the last instruction JNB TF0,$,
reads "Jump, if TF0 is not set, back to this same instruction." The "$" operand means, in most
assemblers, the address of the current instruction. Thus as long as the timer has not
overflowed and the TF0 bit has not been set the program will keep executing this same
19
instruction. After 1/20th of a second timer 0 will overflow, set the TF0 bit, and program
execution will then break out of the loop.
JB P1.0,$
;The line is high which means the car is on the sensor right now
DESCRIPTION OF AT89S52:
The AT89S52 is a low-power, high-performance CMOS 8-bit microcomputer with 4K
bytes of Flash programmable and erasable read only memory (PEROM). The device is
21
22
PIN DESCRIPTION
VCC:
Supply voltage.
GND:
Ground.
Port 0:
Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pin can
sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high
impedance inputs. Port 0 may also be configured to be the multiplexed low order address/data
bus during accesses to external program and data memory. In this mode P0 has internal pullups. Port 0 also receives the code bytes during Flash programming, and outputs the code
bytes during program verification. External pull-ups are required during program verification.
Port 1:
23
Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output
buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled
high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are
externally being pulled low will source current (IIL) because of the internal pull-ups. Port 1
also receives the low-order address bytes during Flash programming and verification.
Port 2:
Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled
high by the internal pull-ups and can be used as inputs.
Port 2 pins that are externally being pulled low will source current (IIL) because of the
internal pull-ups.
RST:
Reset input a high on this pin for two machine cycles while the oscillator is running
resets the device.
ALE/PROG:
Address Latch Enable output pulse for latching the low byte of the address during
accesses to external memory. This pin is also the program pulse input (PROG) during Flash
programming. In normal operation ALE is emitted at a constant rate of 1/6 the oscillator
frequency, and may be used for external timing or clocking purposes. Note, however, that one
ALE pulse is skipped during each access to external Data Memory.
PSEN:
Program Store Enable is the read strobe to external program memory. When the AT89C51 is
executing code from external program memory, PSEN is activated twice each machine cycle,
except that two PSEN activations are skipped during each access to external data memory.
EA/VPP:
External Access Enable. EA must be strapped to GND in order to enable the device to fetch
code from external program memory locations starting at 0000H up to FFFFH. Note,
however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should
be strapped to VCC for internal program executions. This pin also receives the 12volt
programming enable voltage (VPP) during Flash programming, for parts that require 12-volt
VPP.
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
24
XTAL2:
Output from the inverting oscillator amplifier.
Port Pin
Alternate Functions
P3.0
P3.1
P3.2
P3.3
P3.4
P3.5
P3.6
P3.7
This it is an output from the modem (DCE) and input to the PC (DTE). This is an
active low signal. If for any reason the modem cannot make a connection to the telephone,
this signal remains inactive, indicating to the PC (or terminal) that it cannot accept (or) send
data.
RTS (Request To Send)
When the DTE device (such us PC) has a byte to transmit, it asserts RTS to signal the
modem that it has a byte of data to transmit.
RTS is an active low output from the DTE and an input to the modem.
DCD (Data Carrier Detect)
The modem asserts signal DCD to inform the DTE (PC) that a valid carrier has been
detected and that contact between it and other modem is established. DCD is an output from
the modem and an input to the PC (DTE).
RI (Ring Indicator)
Telephone ringing.
MAX 232:
Since Rs-232 is not compatible with microcontroller, we need a line driver (voltage
converter) to convert the RS-232s signal to TTL voltage level that will be acceptable to the
8051s TXD and RXD pins.
One example of such a convertor is MAX 232 from maxin corp.
The MAX 232 converts from RS 232 voltage levels to TTL voltage levels and vice
versa. One advantage of the MAX232 chip is that it uses a +15V power source which is same
as the source voltage for the 8051.
In other words with a single +15v power supply we can power both the 8051 and
MAX 232 with no need for the dual power supplies that we common in older system.
The MAX 232 has two sets of line drivers for transferring & receiving data. The line
drivers used for TxD are called T1 & T2.
8051
TXD
MAX 232
11
11
14
10
12
13
(P3.1)
TXD
(P3.0)
26
The line drivers for RxD are designated as R1 & R2. In Many application only one of each is
used. For example, T1 & R1 are used together for TxD and RxD of the 8051 and the second
set is left unused. Max 232 requires four capacitors ranging from 1 to 22F.
5.3 Relay:
Relays are components which allow a low-power circuit to switch a relatively high current on
and off, or to control signals that must be electrically isolated from the controlling circuit
itself. To make a relay operate, you have to pass a suitable pull-in and holding current (DC)
through its energising coil. And generally relay coils are designed to operate from a particular
supply voltage often 12V or 5V, in the case of many of the small relays used for electronics
work. In each case the coil has a resistance which will draw the right pull-in and holding
currents when its connected to that supply voltage. So the basic idea is to choose a relay with
a coil designed to operate from the supply voltage you.re using for your control circuit (and
with contacts capable of switching the currents you want to control), and then provide a
suitable .relay driver. circuit so that your low-power circuitry can control the current through
the relays coil.
5.4 DC motor:
A DC motor is a mechanically commutated electric motor powered from direct current (DC).
The stator is stationary in space by definition and therefore so is its current. The current in the
rotor is switched by the commutator to also be stationary in space. This is how the relative
angle between the stator and rotor magnetic flux is maintained near 90 degrees, which
generates the maximum torque.
DC motors have a rotating armature winding but non-rotating armature magnetic field and a
static field winding or permanent magnet. Different connections of the field and armature
winding provide different inherent speed/torque regulation characteristics. The speed of a DC
motor can be controlled by changing the voltage applied to the armature or by changing the
field current. The introduction of variable resistance in the armature circuit or field circuit
allowed speed control. Modern DC motors are often controlled by power electronics systems
called DC drives.
The introduction of DC motors to run machinery eliminated the need for local steam or
internal combustion engines, and line shaft drive systems. DC motors can operate directly
from rechargeable batteries, providing the motive power for the first electric vehicles. Today
DC motors are still found in applications as small as toys and disk drives, or in large sizes to
operate steel rolling mills and paper machines.
5.5 GSM Modem:
27
A GSM modem is a specialized type of modem which accepts a SIM card, and operates over
a subscription to a mobile operator, just like a mobile phone. From the mobile operator
perspective, a GSM modem looks just like a mobile phone.
When a GSM modem is connected to a computer, this allows the computer to use the GSM
modem to communicate over the mobile network. While these GSM modems are most
frequently used to provide mobile internet connectivity, many of them can also be used for
sending and receiving SMS and MMS messages.
A GSM modem can be a dedicated modem device with a serial, USB or Bluetooth
connection, or it can be a mobile phone that provides GSM modem capabilities.
For the purpose of this document, the term GSM modem is used as a generic term to refer to
any modem that supports one or more of the protocols in the GSM evolutionary family,
including the 2.5G technologies GPRS and EDGE, as well as the 3G technologies WCDMA,
UMTS, HSDPA and HSUPA.
A GSM modem exposes an interface that allows applications such as NowSMS to send and
receive messages over the modem interface. The mobile operator charges for this message
sending and receiving as if it was performed directly on a mobile phone. To perform these
tasks, a GSM modem must support an extended AT command set for sending/receiving
SMS messages, as defined in the ETSI GSM 07.05 and and 3GPP TS 27.005 specifications.
GSM modems can be a quick and efficient way to get started with SMS, because a special
subscription to an SMS service provider is not required. In most parts of the world, GSM
modems are a cost effective solution for receiving SMS messages, because the sender is
paying for the message delivery.
A GSM modem can be a dedicated modem device with a serial, USB or Bluetooth
connection, such as the Falcom Samba 75. (Other manufacturers of dedicated GSM modem
devices include Wavecom, Multitech and iTegno. Weve also reviewed a number of modems
on our technical support blog.) To begin, insert a GSM SIM card into the modem and connect
it to an available USB port on your computer.
A GSM modem could also be a standard GSM mobile phone with the appropriate cable and
software driver to connect to a serial port or USB port on your computer. Any phone that
supports the extended AT command set for sending/receiving SMS messages, as defined in
ETSI GSM 07.05 and/or 3GPP TS 27.005, can be supported by the Now SMS & MMS
Gateway. Note that not all mobile phones support this modem interface.
Due to some compatibility issues that can exist with mobile phones, using a dedicated GSM
modem is usually preferable to a GSM mobile phone. This is more of an issue with MMS
messaging, where if you wish to be able to receive inbound MMS messages with the
gateway, the modem interface on most GSM phones will only allow you to send MMS
28
messages. This is because the mobile phone automatically processes received MMS message
notifications without forwarding them via the modem interface.
It should also be noted that not all phones support the modem interface for sending and
receiving SMS messages. In particular, most smart phones, including Blackberries, iPhone,
and Windows Mobile devices, do not support this GSM modem interface for sending and
receiving SMS messages at all at all. Additionally, Nokia phones that use the S60 (Series 60)
interface, which is Symbian based, only support sending SMS messages via the modem
interface, and do not support receiving SMS via the modem interface.
Send SMS using AT commands
Some advanced GSM modems like WaveCom and Multitech, support the SMS text mode.
This mode allows you to send SMS messages using AT commands, without the need to
encode the binairy PDU field of the SMS first. This is done by the GSM modem
Check if your GSM phone or modem supports SMS text mode
To check if your modem supports this text mode, you can try the following command:
AT+CMGF=1 <ENTER>
If the modem reponds with "OK" this mode is supported. Please note that using this mode it
is onluy possible to send simple text messages. It is not possible to send multipart, Unicode,
data and other types of messages.
Setting up the modem
If the modem contains a SIM card with is secured with a PIN code, we have to enter this pin
code first:
AT+CPIN="0000" <ENTER> (replace 0000 with your PIN code).
Please not that in most cases you have only 3 attemps to set the correct PIN code. After
setting the PIN code, wait some seconds before issueing the next command to give the
modem some time to register with the GSM network.
In order to send a SMS, the modem has to be put in SMS text mode first using the following
command:
AT+CMGF=1 <ENTER>
In text mode there are some additional parameters that can be set. Using the following
command we can read the current values:
29
AT+CSMP? <ENTER>
The modem will reponse with a string like this:
+CSMP: 1,169,0,0OK
The first value is a combination of some option bits:
bit 7
bit 6
bit 5
bit 3,4
RP
UDHI
SRR
VPF
bit 2
RD
bit 0,1
MTI
Bit 0 of the message is always set when sending messages (SMS-SUBMIT). So the first value
should be 1 or higher. The second parameter sets the Validity Period of the message. This
value is encoded as follows:
0 - 143
144 - 167
168 - 196
197 - 255
(VP + 1) x 5 minutes
12 Hours + ((VP-143) x 30 minutes)
(VP-166) x 1 day
(VP-192) x 1 week
The third parameter contains the PID (Protocol Identifier). This parameter is only used for
advanced messaging. The fourth parameter contains the DCS (Data Coding Scheme). This
parameter is used to select the characterset/messagetype. When setting the DCS parameter to
'0' standard 7 bit text is send. When setting this parameter to '16' the message is sent as a flash
message.
To send a message with a validity period of 1 day, the parameters have to be set like this:
Bit 0 and 4 of the first field has to be set, so the first value will become 1 + 16 = 17.
Send the following command to the modem to set this parameters:
AT+CSMP=17,167,0,16 <ENTER>
If the modem responds with "OK" ,the modem is ready to send (flash) text messages with a
validity period of 1 day.
Sending the message
To send the SMS message, type the following command:
30
AT+CMGS="+31638740161
begin_of_the_skype_highlighting
end_of_the_skype_highlighting" <ENTER>
+31638740161
Replace the above phone number with your own cell phone number. The modem will respond
with:
>
You can now type the message text and send the message using the <CTRL>-<Z> key
combination:
Hello World ! <CTRL-Z>
After some seconds the modem will respond with the message ID of the message, indicating
that the message was sent correctly:
+CMGS: 62
The message will arrive on the mobile phone shortly.
Sending an Unicode SMS message
Some modems also have the capability to send Unicode or UCS2 messages without encoding
a PDU. You can send Unicode messages by only converting the Unicode data to a HEX string
and send this string to the modem.
To check whether your modem supports this mode, just type the following command:
AT+CSCS=?
This commands displays the codepages supported by the modem. The modem will respond
like this:
+CSCS: ("GSM","PCCP437","CUSTOM","HEX")
If this string contains "HEX" or "UCS2", Unicode seems to be supported. To specify that you
will use an HEX string to send the message, set the codepage to "HEX" or "UCS2"
depending on the modem response. In our example we will set the modem to "HEX" :
AT+CSCS="HEX" <ENTER>
Next, we have to specify the correct DCS (Data Coding Scheme) for Unicode messages,
which is 0x08. We can set this value by changing the fourth parameter of the AT+CSMP
command to '8':
AT+CSMP=1,167,0,8 <ENTER>
31
The modem is now ready to send messages as Unicode. Now is the time to send the actual
message:
AT+CMGS="+31638740161
begin_of_the_skype_highlighting
end_of_the_skype_highlighting" <ENTER>
+31638740161
Replace the above phone number with your own cell phone number. The modem will respond
with:
>
The only thing you have to program by yourself, is a simple routine which converts the
Unicode string to an hexadecimal string like this:
6. PCB DESIGN
Design and Fabrication of Printed circuit boards
6.1 INTRODUCTION:
Printed circuit boards, or PCBs, form the core of electronic equipment domestic and
industrial. Some of the areas where PCBs are intensively used are computers, process control,
telecommunications and instrumentation.
6.2 MANUFATCURING:
32
The manufacturing process consists of two methods; print and etch, and print, plate and etch.
The single sided PCBs are usually made using the print and etch method. The double sided
plate through hole (PTH) boards are made by the print plate and etch method.
The production of multi layer boards uses both the methods. The inner layers are printed and
etch while the outer layers are produced by print, plate and etch after pressing the inner
layers.
6.3 SOFTWARE:
The software used in our project to obtain the schematic layout is MICROSIM.
6.4 PANELISATION:
Here the schematic transformed in to the working positive/negative films. The circuit is
repeated conveniently to accommodate economically as many circuits as possible in a panel,
which can be operated in every sequence of subsequent steps in the PCB process. This is
called penalization. For the PTH boards, the next operation is drilling.
6.5 DRILLING:
PCB drilling is a state of the art operation. Very small holes are drilled with high speed CNC
drilling machines, giving a wall finish with less or no smear or epoxy, required for void free
through whole plating.
6.6 PLATING:
The heart of the PCB manufacturing process. The holes drilled in the board are treated both
mechanically and chemically before depositing the copper by the electro less copper platting
process.
6.7 ETCHING:
Once a multiplayer board is drilled and electro less copper deposited, the image available in
the form of a film is transferred on to the out side by photo printing using a dry film printing
process. The boards are then electrolytic plated on to the circuit pattern with copper and tin.
The tin-plated deposit serves an etch resist when copper in the unwanted area is removed by
the conveyors spray etching machines with chemical etch ants. The etching machines are
33
attached to an automatic dosing equipment, which analyses and controls etch ants
concentrations
6.8 SOLDERMASK:
Since a PCB design may call for very close spacing between conductors, a solder mask has to
be applied on the both sides of the circuitry to avoid the bridging of conductors. The solder
mask ink is applied by screening. The ink is dried, exposed to UV, developed in a mild
alkaline solution and finally cured by both UV and thermal energy.
7 SOFTWARE TOOLS
7.1 KEIL Assembler:
Keil development tools for the 8051 Microcontroller Architecture support every level of
software developer from the professional applications engineer to the student just learning
about
embedded
software
development.
34
Numerous example programs are included to help you get started with the most popular
embedded 8051 devices.
The Keil Vision Debugger accurately simulates on-chip peripherals (IC, CAN, UART, SPI,
Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM Modules) of your 8051
device.
Simulation helps you understand hardware configurations and avoids time wasted on setup
problems. Additionally, with simulation, you can write and test applications before target
hardware is available.
When you are ready to begin testing your software application with target hardware, use the
MON51, MON390, MONADI, or FlashMON51 Target Monitors, the ISD51 In-System
Debugger, or the ULINK USB-JTAG Adapter to download and test program code on your
target system.
It's been suggested that there are now as many embedded systems in everyday use as there are
people on planet Earth. Domestic appliances from washing machines to TVs, video recorders
and mobile phones, now include at least one embedded processor. They are also vital
components in a huge variety of automotive, medical, aerospace and military systems. As a
result, there is strong demand for programmers with 'embedded' skills, and many desktop
developers are moving into this area.
We look at the inside of 8051. We demonstrate some of the widely used registers of the 8051
with simple instruction such as MOV and ADD.
We discuss about assembly language & machine language programming and define terms
such as mnemonics, op-code, and operand etc.
The process of assembling and creating a ready to run program for the 8051.
Step by step execution of an 8051 program and role of program counter.
Then we look about some widely used assembly language directives, pseudo code and data
types related to the 8051.
We discuss about flag bits and how they are affected by arithmetic instructions.
Inside 8051:
Registers:
D7
D6
D5
D4
D3
35
D2
D1
D0
In the cpu, registers are used to store information temporarily that information could be a byte
of data to be processed or address pointing to the data to be processed or address pointing to
the data to be fetched.
The majority of 8051 registers are 8 bit register. The 8 bit register are classified into
MSB (Most Significant Bit)
LSB (Lost Significant Bit)
With an 8 bit data type, any data longer than 8 bits must be broken into 8 chunks before it is
processed.
The most widely used registers of the 8051 are AC(Accumulator),
B,R0,R1,R2,R3,R4,R5,R6,R7, DPTR(Data Pointer) and PC(program counter).
All of the above registers are 8 bits except DPTR and PC.
MOV (Instruction):
The MOV instruction copies data from one location to another. It has the following
format.
MOV destination, source, copy source to destination.
Example:
MOV A, #55H; Load value 55H into register A
MOV R0, A;
MOV R1, A;
1. Value can be loaded directly into any of the registers A, B or R0 R7. However to indicate
that it is an immediate value it must be proceeded with a pound sign (#).
MOV A, #23H
MOV R0, #12H
MOV R5, #0F9H
MOV R5, #F9H will cause error.
0 is used between # and F to indicate that F is hex number and not a letter.
36
2. If the values 0 to F are moved to 8-bit register, the rest of the bits are assumed to be zero.
For example, in MOV, #5 the result will be A=05; that is A = 0000 0101.
3. Moving a Value that is too large into a register will cause error.
MOV A, #7F2H
4. A value to be loaded into a register must be proceeded with a pound sign (#) otherwise it
must be load from a memory location.
For example MOV A, 17H
It means to MOV A the value hold in memory location 17H, which could have any value.
In order to load the value 17H into the accumulator we must write MOV A, # 17H
Notice that the absence of the # sign will not cause an error by the assembler. Since it is a
valid instruction. However the result would not be what the programmer intended.
ADD Instruction:
ADD A, source; add the source operand to the accumulator
MOV A, #25H
MOV R2, #34H
ADD A, R2
A=59H
37
o Today one can use many different programming languages such as BASIC, PASCAL,
C, C++, JAVA etc., and these languages are called as High-level languages.
o The high level languages are translated into machine code by a program called
Compiler.
o The EQU directive does not set aside storage for a data item but
associate a constant value with a data label so that when the label
appears in the program; its constant value will be substituted for the
label.
Example:
COUNT EQU 25
------------------MOV R3, COUNT
When executing the instruction MOV R3, 3 COUNT the register R3 will be loaded
with the value25.
Assume that there is a constant (fixed value) used in many different places in the
program, and the programmer wants to change its value throughout. By the use of
EQU, the programmer can change its once and the assembler will change all of its
occurrences, rather than search the entire program trying to find every occurrence.
END directive:
This indicates to the assembler to the end of the source (asm) file.
10.Advantages:
Alarm indication
11.Applications:
12.Conclusion:
The auto-guard system combines the advantages of vibration sensor and GSM together. The
initial security of the automobile is achieved by alarm the buzzer in case of theft. The longrage monitor and grading responses could be realized by the mobile phones of users, which
39
made the alarm cover a broad range. The microcontroller for vehicle was adoped,which
enhanced the reliability and the capability of anti-interference. These advantages mentioned
above meet the requirements of auto-guard system. So that a better effect was made in
practice. In addition, it is easy to extend functions. If the function of position tracking is
needed, the GPS module can be added. If the Internet of Things is to be entered, we only need
to rewrite the program coding. As a result, the radio technology at present can be replaced
completely. So the practical value and the market prospect are considerable
13. Bibliography:
[1] Huaqun Guo,Cheng H.S.,Wu Y.D.,Ang J.J.,Tao F.,et al.,An automotive security system
for anti-theft, Proceedings of the Eighth International Conference on Digital Object
Identifier,pp.421-426, Mar. 2009.
[2] Hui Song,Sencun Zhu,Guohong Cao,SVATS:a sensor-network-based vehicle anti-theft
system, Proceedings of The 27th Conference on Computer Communications,pp.21282136,May,2008.
[3] Yang Wang,Xian-Jun Gao,Zhang Gang,A study on Mn coding for guarding against theft
and remote control device of an automobile, Proceedings of International Conference on
Vehicle Electronics,pp.294- 297,1999.
[4] Khangura K.S.,Middleton N.V.,Ollivier M.M.,Vehicle anti-theft system uses radio
frequency identification,Proceedings of IEE Colloquium on Vehicle Security Systems,pp.17,Oct. 1993.
[5] Hirano M.,Takeuchi M.,Tomoda T.,Nakano K.-I.,Keyless entry system with radio card
transponder [automobiles],Proceedings of IEEE Transactions on Industrial
Electronics,vol.35,no.2,pp.208-216, May 1988.
[6] Wan Lili,Chen Tiejun,Automobile anti-theft system design based on GSM,Proceedings
of International Conference on Advanced Computer Control,pp.551-554,Jan. 2009.
[7] Jayendra G.,Kumarawadu S.,Meegahapola L.,RFID-based anti-theft auto security system
with an immobilizer, Proceedings of International Conference on Industrial and Information
Systems,pp.441-446, Aug. 2007.
[8] Guo Hongzhi,Chen Hong,Ji Guohuang,Zhou Xin,The vehicle passive keyless entry
system based on RFID,Proceedings of the 7th World Congress on Intelligent Control and
Automation,pp.8612-8617,Jun. 2008.
40
[9] Zhixiong Liu,Guiming He,A vehicle anti-theft and alarm system based on computer
vision,Proceedings of IEEE International Conference on Vehicular Electronics and
Safety,pp.326-330,Oct. 2005.
[10] Karimi H.A.,Krishnamurthy P.,Real-time routing in mobile networks using GPS and
GIS techniques, Proceedings of the 34th Annual Hawaii International Conference
on,pp.11,Jan. 2001
41