Uploaded by Magdi Alqubati

Early Alarm for Road Accidents by Using GSM (Graduation Project)

advertisement
Republic of Yemen
Ministry of Higher Education
Queen Arwa University
Engineering and computer science
Department
Early Alarm for Road Accidents by Using GSM System
Done By
1- Magdi Alqubati
2- Alzubair Bazi
Supervisor
Eng: Shafea Al-yousofi
Yemen- Sana‟a
6102
Dedication
All
praise
to
Allah,
today
we
fold
the
days'
tiredness
and
the
errand
most
honored
summing up between the cover of this humble work.
To
the
utmost
knowledge
lighthouse,
to
our
greatest
and
prophet Mohamed - May peace and grace from Allah be upon him
To
the
spring
that
never
stops
giving,
to
our
mothers
who
weave
our
never
stint
what
happiness with strings from our merciful hearts... to our mothers.
To
whom
they
strive
to
bless
comfort
and
welfare
and
they own to push us in the success way who taught us to promote life
stairs wisely and patiently, to our dearest fathers
To whose love flows in our veins, and our hearts always remember them,
to our brothers and sisters .
To those who taught us letters of gold and words of jewel of the utmost
and sweetest sentences in the whole knowledge. Who reworded to us their
knowledge
through
simply
the
and
from
their
thoughts
knowledge
and
success
path,
professors.
i
made
to
our
a
lighthouse
honored
guides
us
teachers
and
Acknowledgment
It gives us a great sense of pleasure to present the report of the B. E Project undertaken
during B. E. Final Year. We owe special debt of gratitude to Engineer ( Shafea Al-yousofi)
Department of( Communication and Network Engineering ,QAU university ,Sana'a) , for
his constant support and guidance throughout the course of our work.
His sincerity, thoroughness and perseverance have been a constant source of inspiration for
us. It is only his cognizant efforts that our endeavors have seen light of the day.
We also take the opportunity to acknowledge the contribution of Dr. Bassam Abdulqader
Head Department of (Communication and Network Engineering, QAU university, Sana’a)
, for his full support and assistance during the development of the project.
We also do not like to miss the opportunity to acknowledge the contribution of all faculty
members of the department for their kind assistance and cooperation during the
development of our project.
Name:
1-Magdi Wadhah Alqubati
2-Alzubair Mahmud Bazi
ii
Table of Contents
1
Chapter One........................................................................................................................ 1
1.1
Introduction ................................................................................................................... 1
1.1.1
2
GSM(Global System for Mobile Communications) .............................................. 3
Chapter Two ....................................................................................................................... 6
2.1
ATMEL (AT89S52) microcontroller ............................................................................ 6
2.2
GSM&GPRS MODEM ................................................................................................ 7
2.3
Micro electro mechanical systems (MEMS) ................................................................ 8
2.4
MCP3208 A/D Converter ............................................................................................. 9
2.5
Liquid Crystal Display (LCD) .................................................................................... 10
2.6
Light Emitting Diode (LED) ....................................................................................... 10
2.7
MAX 232 .................................................................................................................... 11
2.8
Power Supply Description .......................................................................................... 11
2.8.1
2.9
Circuit Features ................................................................................................... 12
BC547 series Transistor .............................................................................................. 13
2.10 Motor .......................................................................................................................... 13
2.11 Buzzer ......................................................................................................................... 13
3
Chapter Three .................................................................................................................. 14
3.1
Block Diagram of the project...................................................................................... 14
3.2
Interfacing the LCD with the Port 0: .......................................................................... 15
3.2.1
Pin Description of Port 0 ..................................................................................... 15
3.2.2
Pin description of LCD ........................................................................................ 16
iii
3.2.3
3.3
Interfacing the DC Motor and Buzzer with Port 1 ...................................................... 20
3.3.1
3.4
Interfacing LCD with 8052 microcontroller ........................................................ 18
Pin Description of Port 1 ..................................................................................... 20
Interfacing MEMS to Port 2 ....................................................................................... 22
3.4.1
Pin description of Port 2 ..................................................................................... 22
3.4.2
Interfacing LED1 , LED2 and MEMS sensors to Port 2 ..................................... 22
3.5
Interfacing GSM modem to Port 3 ............................................................................. 25
3.5.1
Pin description of Port 3 ..................................................................................... 25
3.5.2
Interfacing GSM modem to the port 3 using MAX232....................................... 26
3.6
Rst ............................................................................................................................... 29
3.7
Xtal1 & Xtal2 .............................................................................................................. 30
3.8
Power Supply .............................................................................................................. 31
3.8.1
Block Diagram of Power Supply ......................................................................... 32
3.8.2
Circuit Diagram of Power Supply ....................................................................... 32
3.9
Schematic diagram ...................................................................................................... 34
3.10 KEIL U V4 Software .................................................................................................. 35
3.10.1
Introduction to KEIL SW .................................................................................... 35
3.10.2
ISP Flash Microcontroller Programmer: ............................................................. 35
3.10.3
KEIL SW Programming Procedure. .................................................................... 36
3.11 Software Code ............................................................................................................. 38
3.11.1
4
Software program: ............................................................................................... 38
Chapter Four .................................................................................................................... 40
4.1
Conclusion and Future Work ...................................................................................... 40
4.2
Obstacles . ................................................................................................................... 40
4.3
Recommendations . ..................................................................................................... 40
iv
4.4
References ................................................................................................................... 40
4.5
Appendix(A) ............................................................................................................... 41
4.6
Appendix (B) .............................................................................................................. 46
4.7
ٙ‫انًهخض انؼشت‬................................................................................................. 58
v
List of Figures
Figure (‎1-1): General architecture of a GSM network ................................................................ 4
Figure (‎2-1) :AT89S52 microcontroller. ..................................................................................... 6
Figure (‎2-2) : AT89S52 Pin Diagram. ......................................................................................... 6
Figure (‎2-3) : MMA7260............................................................................................................ 8
Figure (‎2-4) : MCP3208. ............................................................................................................. 9
Figure( ‎2-5) : LCD Display. ...................................................................................................... 10
Figure (‎2-6) : LED. .................................................................................................................... 10
Figure (‎2-7) : MAX232N .......................................................................................................... 11
Figure (‎2-8) : LM7805. ............................................................................................................. 12
Figure (‎2-9) : Regulated power supply. ..................................................................................... 12
Figure (‎3-1) : Functional block diagram of micro controller. ................................................... 15
Figure (‎3-2) : Schematic Diagram of Interfacing LCD to Port 0. ............................................. 19
Figure (‎3-3) : Connecting LCD to Port0 . ................................................................................. 19
Figure (‎3-4) : Schematic Diagram of Motor and Buzzer........................................................... 21
Figure ( ‎3-5 ) : connecting Motor and Buzzer to Port 1. ........................................................... 21
Figure (‎3-6) : block diagram of the MMA7260 Accelerometer Module. ................................. 23
Figure( ‎3-7) : Schematic Diagram of Interfacing MEMS to Port 2 using A/D Converter . ...... 24
Figure (‎3-8) : Connecting MEMS sensor & LED to Port 2. ..................................................... 25
Figure (‎3-9) : Logic Diagram of MAX232. .............................................................................. 27
Figure (‎3-10) : RS232 pin assignments. .................................................................................... 28
vi
Figure (‎3-11) : Schematic Diagram of Interfacing GSM modem to Port 3 using MAX232. .... 28
Figure (‎3-12) : Connecting GSM modem to Port 3 . ................................................................. 29
Figure (‎3-13) : Schematic Diagram of RESET Switch. ............................................................ 30
Figure (3-14) : Schematic Diagram of the Inverting Oscillator Amplifier................................ 30
Figure (‎3-15) : Inverting Oscillator Amplifier ......................................................................... 30
Figure( ‎3-16) : Oscillator and timing circuit. ............................................................................ 31
Figure (‎3-17) : Block Diagram of Power Supply Circuit. ......................................................... 32
Figure( ‎3-18) : Circuit Diagram of Power Supply. .................................................................... 32
Figure( ‎3-19) : Power Supply Circuit. ....................................................................................... 32
Figure (‎3-20 ) : Full circuit of project. ...................................................................................... 33
Figure (‎3-21) : ISP-Programmer Interface . .............................................................................. 36
vii
List of Tables
Table (‎3-1) : Pin description of LCD......................................................................................... 16
Table (‎3-2) : Pins Symbol and Description of LCD . ................................................................ 17
Table (‎3-3) : Alternate Functions of Port 1 Pins . .................................................................... 20
Table (‎3-4) : The 4 selectable g options of MMA 7260. ........................................................... 23
Table (‎3-5) : Pin Output of MMA 7260 . .................................................................................. 24
Table (‎3-6) : Alternate Functions of Port 3 Pins. ..................................................................... 26
viii
Abstract
The project titled as Early Alarm for Road Accidents by Using GSM and GPRS Technologies
is an embedded based system. By this advanced technology we can get accurate information
about the victim this system combines advanced hardware design and sophisticated electronic
control technology into a compact, reliable package . In this project a tending sensor is used as
an accident detector. When the vehicle meets with an accident, the tending sensor generate the
signal, this signal is being compared with the threshold values. If the value generated exceeds
the threshold it is recognized as accident and this information is immediately informed to their
relative persons through GSM as a message to mobile . In this system tending sensors are used
for detecting range of collision. Sensor data will be in analog form so it needs to be converted
to digital, which is fulfilled through A/D Converter, and this digital data is being sent to
microcontroller there it is compared with the threshold values, if it exceeds the threshold
values then only data will be sent to GSM (global system for mobile communication) &
location data is captured with the help of GPRS (General Packet Radio Service). Here we are
making use of the GPRS which gives location of the collide vehicle. This system designs the
scene of the accident alarm system based on ARM(Advanced RISC Machine) and GPRS.
When the accident occurred, the manual and automatic alarm can be realized. Vehicles state
and user information as well as alarm locations will be transmitted to the Pre-set of treatment
centre , after receiving related alarming information, the treatment centre will display this
information on its map. after receiving alarm information, the treatment Centre staffs who are
on duty will notice the handler who is the nearest to the scene of the accident in time, in order
to reach the scene of accident in the first time, and gain more treatment time for the accident
injured, and lower the accident mortality, as well as reduce incidents impacting time on the
traffic.
ix
PURPOSE OF PROJECT
Now a day accidents are occurring frequently and it is very difficult to help them in critical
conditions. We need an automatic system to monitor and inform whenever accidents occur
while travelling. With the problem of global population aging increasing, lack of medical
facility at the location of accident, inadequate accident sense system performance and other
related issues have become increasingly prominent.
PROJECT DESCRIPTION
With the problem of global population aging increasing, lack of medical equipment
near to accident place, inadequate accident sense system performance and other related issues
have become increasingly prominent. This paper presents the design and implementation of
scene of the accident alarm system based with wireless network communications based on
ARM, GSM and GPRS, Pre-set of treatment Centre as the information processing terminal for
the location display and warns the alarm for the treatment people near by the accident location.
This project consists of wireless communication for communication with the accident sense
system and the Pre-set of treatment Centre. The main part is the Pre-set of treatment unit,
which acts as an Information processing unit. Individual vehicle is equipped with a system
called as accident sense system, which consists of GSM and GPRS. When the accident
occurred, Vehicles state and locations will be transmitted to the Pre-set of treatment centre
though wireless communication technologies of GSM through short message format.
x
1 Chapter One
1.1 Introduction
Today, electric and electronic devices are becoming an integral part of everyday life,
and most places not free from these devices, was simple or complex. and do not be surprised if
I told that controllers have invaded these devices, So most devices around us contains
controllers. Like Clocks, telephones, cameras, microwaves, cars, toys, etc. all of it contains
simple or complex controllers.
If we think a little bit, we will find that the microcontroller is the best to use it instead
of the installation and design of electronic circuits, we will shorten a lot of effort, time and
money. The microcontroller can be used in more than one project and will not cost just only
reprogramming it with your hands making or ready programs from the Internet, but electronic
circuits, it may cost us effort, money and time.
Microcontrollers are used in automatically controlled products and devices, such as
automobile engine control systems, implantable medical devices, remote controls, office
machines, appliances, power tools, toys and other embedded systems. By reducing the size
and cost compared to a design that uses a separate microprocessor, memory, and input/output
devices, microcontrollers make it economical to digitally control even more devices and
processes. Mixed signal microcontrollers are common, integrating analog components needed
to control non-digital electronic systems.
A microcontroller is a small computer (SoC) on a single integrated circuit containing a
processor core, memory, and programmable input/output peripherals. Program memory in the
form of Ferroelectric RAM, NOR flash or OTP ROM is also often included on chip, as well as
a typically small amount of RAM. Microcontrollers are designed for embedded applications,
in contrast to the microprocessors used in personal computers or other general purpose
applications consisting of various discrete chips.
Some microcontrollers may use four-bit words and operate at clock rate frequencies as
low as 4 kHz, for low power consumption (single-digit mill watts or microwatts). They will
generally have the ability to retain functionality while waiting for an event such as a button
press or other interrupt; power consumption while sleeping (CPU clock and most peripherals
1
off) may be just Nano watts, making many of them well suited for long lasting battery
applications. Other microcontrollers may serve performance-critical roles, where they may
need to act more like a digital signal processor (DSP), with higher clock speeds and power
consumption.
Embedded design:
A microcontroller can be considered a self-contained system with a processor, memory
and peripherals and can be used as an embedded system. The majority of microcontrollers in
use today are embedded in other machinery, such as automobiles, telephones, appliances, and
peripherals for computer systems.
While some embedded systems are very sophisticated, many have minimal
requirements for memory and program length, with no operating system, and low software
complexity. Typical input and output devices include switches, relays, solenoids, LEDs, small
or custom liquid-crystal displays, radio frequency devices, and sensors for data such as
temperature, humidity, light level etc. Embedded systems usually have no keyboard, screen,
disks, printers, or other recognizable I/O devices of a personal computer, and may lack human
interaction devices of any kind.
Interrupts:
Microcontrollers must provide real-time (predictable, though not necessarily fast)
response to events in the embedded system they are controlling. When certain events occur, an
interrupt system can signal the processor to suspend processing the current instruction
sequence and to begin an interrupt service routine (ISR, or "interrupt handler") which will
perform any processing required based on the source of the interrupt, before returning to the
original instruction sequence.
This integration drastically reduces the number of chips and the amount of wiring and
circuit board space that would be needed to produce equivalent systems using separate chips.
Furthermore, on low pin count devices in particular, each pin may interface to several internal
peripherals, with the pin function selected by software. This allows a part to be used in a wider
variety of applications than if pins had dedicated functions.
Some microcontrollers use a Harvard architecture: separate memory buses for
instructions and data, allowing accesses to take place concurrently. Where a Harvard
2
architecture is used, instruction words for the processor may be a different bit size than the
length of internal memory and registers;
The decision of which peripheral to integrate is often difficult. The microcontroller
vendors often trade operating frequencies and system design flexibility against time-to-market
requirements from their customers and overall lower system cost. Manufacturers have to
balance the need to minimize the chip size against additional functionality.
Microcontrollers typically do not have a math coprocessor, so floating point arithmetic
is performed by software.
Recent microcontrollers are often integrated with on-chip debug circuitry that when
accessed by an in-circuit emulator via JTAG, allow debugging of the firmware with a
debugger. A real-time ICE may allow viewing and/or manipulating of internal states while
running. A tracing ICE can record executed program and MCU states before/after a trigger
point.
 Types of microcontrollers:

ARDIUNO

68HC11

8051

ARM architecture

STMicroelectronics

Atmel AVR
1.1.1 GSM(Global System for Mobile Communications)
GSM is defined as (Global System for Mobile Communications) Originally GSM is the most
popular standard for mobile telephony systems in the world. The GSM Association, its
promoting industry trade organization of mobile phone carriers and manufacturers, estimates
that 80% of the global mobile market uses the standard. GSM differs from its predecessor
technologies in that both signaling and speech channels are digital, and thus GSM is
considered a second generation (2G) mobile phone system. This also facilitates the widespread implementation of data communication applications into the system.
3
The GSM standard has been an advantage to both consumers, who may benefit from the
ability to roam and switch carriers without replacing phones, and also to network operators,
who can choose equipment from many GSM equipment vendors. GSM also pioneered lowcost implementation of the short message service (SMS), also called text messaging, which
has since been supported on other mobile phone standards as well. Newer versions of the
standard were backward-compatible with the original GSM system. For example, Release 97
of the standard added packet data capabilities by means of General Packet Radio Service
(GPRS). Release 99 introduced higher speed data transmission using Enhanced Data Rates for
GSM Evolution (EDGE).
 Architecture of GSM Network:
A GSM network is composed of several functional entities, whose functions and
interfaces are specified. Figure 1 shows the layout of a generic GSM network. The GSM
network can be divided into three broad parts. The Mobile Station is carried by the subscriber.
The Base Station Subsystem controls the radio link with the Mobile Station. The Network
Subsystem, the main part of which is the Mobile services Switching Center (MSC), performs
the switching of calls between the mobile users, and between mobile and fixed network users.
The MSC also handles the mobility management operations.
Figure (‎1-1): General architecture of a GSM network
4

Mobile Station
The mobile station (MS) consists of the mobile equipment (the terminal) and a smart card
called the Subscriber Identity Module (SIM). The SIM provides personal mobility, so that the user can
have access to subscribed services irrespective of a specific terminal.

Base Station Subsystem
The Base Station Subsystem is composed of two parts, the Base Transceiver Station
(BTS) and the Base Station Controller (BSC). These communicate across the standardized
Abis interface, allowing (as in the rest of the system) operation between components made by
different suppliers. The Base Transceiver Station houses the radio transceivers that define a
cell and handles the radio-link protocols with the Mobile Station.

Network Subsystem
The central component of the Network Subsystem is the Mobile services Switching
Center (MSC). It acts like a normal switching node of the PSTN or ISDN, and additionally
provides all the functionality needed to handle a mobile subscriber, such as registration,
authentication, location updating, handovers, and call routing to a roaming subscriber.
5
2 Chapter Two
Project Tools
2.1 ATMEL (AT89S52) microcontroller
In the concerned project 8052 microcontroller is used. Here microcontroller used is
AT89S52, which is manufactured by ATMEL laboratories. The 8051 is the name of a big
family of microcontrollers. The device which we are going to use along this tutorial is the
AT89S52 which is a typical 8051 microcontroller manufactured by Atmel™. This
microcontroller had 128 bytes of RAM, 4K bytes of chip ROM, two timers, one serial port,
and four ports all on a single chip. You can notice that the
AT89S52 has 4 different ports, each one having 8 Input/output
lines providing a total of 32 I/O lines. Those ports can be used
to output DATA and orders do other devices, or to read the
state of a sensor, or a switch. Most of the ports of the AT89S52
have 'dual function' meaning that they can be used for two
different functions: the first one is to perform input/output
operations and the second one is used to implement special
features of the microcontroller like counting external pulses,
Figure (2-1) :AT89S52 microcontroller.
interrupting the execution of the program according to
external events, performing serial data transfer or
connecting the chip to a computer to update the
software.
Features

Compatible with MCS-51 Products

8K Bytes of In-System Reprogrammable Flash
Memory

Fully Static Operation: 0 Hz to 33 MHz

Three-level Program Memory Lock
Figure (2-2) : AT89S52 Pin Diagram.
6

256 x 8-bit Internal RAM

32 Programmable I/O Lines

Three 16-bit Timer/Counters

Eight Interrupt Sources

Programmable Serial Channel

Low-power Idle and Power-down Modes

4.0V to 5.5V Operating Range

Full Duplex UART Serial Channel

Interrupt Recovery from Power-down Mode

Watchdog Timer

Dual Data Pointer
2.2 GSM&GPRS MODEM
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. 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.
Features

A GSM modem exposes an interface that allows applications such as Now SMS to
send and receive messages over the modem interface.

GSM modems can be a quick and efficient way to get started with SMS. 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.
7
2.3 Micro electro mechanical systems (MEMS)
(Micro Electro Mechanical systems) is the technology of very small devices . MEMS are
separate and distinct from the hypothetical vision of molecular nanotechnology or molecular
electronics. MEMS are made up of components between 1 to 100 micrometers in size ( i.e.
0.001 to 0.1 mm), They usually consist of a central unit that processes data ( the
microprocessor) and several components that interact with the outside such as micro sensors.
In this project we chose the MMA7260 low cost capacitive micro-machined accelerometer
which can measure acceleration in 2 dimensional space. They are called 2D accelerometers
respectively. One interesting fact about accelerometer is that they always measure acceleration
relative to the earth's gravity. That means if it is NOT at all accelerating, like being placed on
car to measure the acceleration of car , it will show an acceleration along the direction of
earth's gravitational field. And when it free falls ( that means actually accelerating due to g ) it
will show a 0 acceleration. This fact is used to sense tilt of device by using simple
trigonometry..
Features

Selectable Sensitivity (1.5g/2g/4g/6g)

Low Current Consumption: 500µA

Sleep Mode: 3µA

Low Voltage Operation: 2.2 V to 3.6 V

6mm x 6mm x 1.45 mm Quad Flat No-Lead (QFN)
package
Figure (2-3) : MMA7260.

High Sensitivity (800 mV/g @ 1.5g)

Fast Turn On Time

Integral Signal Conditioning with Low Pass Filter

Robust Design, High Shocks Survivability

Pb-Free Terminations

Environmentally Preferred Package

Low Cost
8
2.4 MCP3208 A/D Converter
To interface the Accelerometer with AVR Microcontroller in our project we use The
Microchip Technology Inc. MCP3208 device that successive approximation 12-bit Analog-toDigital (A/D) Converter with on-board sample and
hold circuitry. The MCP3208 is programmable to
provide four pseudo-differential input pairs or
eight single-ended inputs. Communication with the
devices is done using a simple serial interface
compatible with the SPI protocol. The devices are
capable of conversion rates of up to 100ksps. The
MCP3204/3208 devices operate over a broad
voltage range (2.7V - 5.5V). Low current design
permits operation with typical standby and active
Figure (2-4) : MCP3208.
currents of only 500nA and 320μA.
Features
 12-bit resolution
 ± 1 LSB max DNL
 ± 1 LSB max INL (MCP3204/3208-B)
 8 input channels
 Analog inputs programmable as single-ended or pseudo differential pairs
 On-chip sample and hold
 SPI®serial interface (modes 0,0 and 1,1)
 Single supply operation: 2.7V - 5.5V
 100ksps max. sampling rate at VDD= 5V
 50ksps max. sampling rate at VDD= 2.7V
 Low power CMOS technology
 Industrial temp range: -40°C to +85°C
 Available in PDIP, SOIC and TSSOP packages
9
2.5 Liquid Crystal Display (LCD)
Liquid crystal display a type of display used in digital watches and many portable
computers. LCD displays utilize two sheets of polarizing material with a liquid crystal solution
between them. An electric current passed through the liquid causes the crystals to align so that
light cannot pass through them. Each crystal, therefore, is like a shutter, either allowing light
to pass through or blocking the light.
. The eight bits of data are supplied from the controller port data lines and two
controller port control lines are used for RS (auto)
and E (strobe). Basically the LCD has two registers, a
data register and a command register. Data is written
into the command register when RS is low and into
the data register when RS is high. Data is latched into
the LCD register on the falling edge of Enable.
Figure( 2-5) : LCD Display.
Features
 5 x 8 dots with cursor
 Built-in controller (KS 0066 or Equivalent)
 + 5V power supply (Also available for + 3V)
 1/16 duty cycle
 B/L to be driven by pin 1, pin 2 or pin 15, pin 16 or A.K (LED)
 N.V. optional for + 3V power supply
2.6 Light Emitting Diode (LED)
A light-emitting diode (LED) is a semiconductor
diode that emits incoherent narrow spectrum light
when electrically biased in the forward direction
of the pn-junction, as in the common LED circuit.
This effect is a form of electroluminescence.
Figure (2-6) : LED.
10
2.7 MAX 232
The MAX232 is a dual driver/receiver that includes a
capacitive voltage generator to supply TIA/EIA-232-F
Voltage levels from a single 5-V supply. Each receiver
converts TIA/EIA-232-F inputs to 5-V TTL/CMOS
levels. These receivers have a typical threshold of 1.3
V, a typical hysteresis of 0.5 V, and can accept 30-V
inputs. Each driver converts TTL/CMOS input levels
into TIA/EIA-232-F levels. The driver, receiver, and
voltage-generator functions are available as cells.
Figure (2-7) : MAX232N
Features

Meets or Exceeds TIA/EIA-232-F and ITU Recommendation V.28

Operates from a Single 5-V Power Supply With 1.0-_F Charge-Pump Capacitors

Operates up To 120 Kbit/s

Two Drivers and Two Receivers

30-V Input Levels

Low Supply Current 8 mA Typical

ESD Protection Exceeds JESD 22

2000-V Human-Body Model (A114-A)

Upgrade with Improved ESD (15-kV HBM) and 0.1-_F Charge-Pump Capacitor
2.8 Power Supply Description
In my project I used 9 volts transformer for continuous power supply. Why I am using this
means to continuous power will come. Otherwise If I use a battery sometimes the total
currents will loss so that‟s way I am using A.C Transformer. A.C transformer is giving the
input to Bridge Rectifier. Bridge Rectifier converts A.C to D.C. After that we are using one
filter capacitor 1000uf/25v electrolytic capacitor .We connecting this capacitor in parallel
section.
11
The main purpose of this capacitor is if there is any alternate
peaks we need to reduce that peaks. After that we are using
LM7805 Regulator Most digital logic circuits and processors
need a 5 volt power supply.
Figure (2-8) : LM7805.
2.8.1 Circuit Features
Brief description of operation: Gives out well regulated +5V output, output current capability
of 100 mA .

Circuit protection: Built-in overheating protection shuts down output when regulator
IC gets too hot

Circuit complexity: Very simple and easy to build

Circuit performance: Very stable +5V output voltage, reliable operation

Availability of components: Easy to get, uses only very common basic components

Power supply voltage: Unregulated DC 8-18V power supply

Power supply current: Needed output current + 5 mA

Component costs: Few dollars for the electronics components + the input transformer
cost
Figure (‎2-9) : Regulated power supply.
12
2.9 BC547 series Transistor
We use pnp BC547 transistor for switching between motor and buzzer and also for amplified
the voltage .
Features

Low current

Low voltage

Three different gain selection
2.10 Motor
In any electric motor, operation is based on simple electromagnetism. A current-carrying
conductor generates a magnetic field; when this is then placed in an external magnetic field, it
will experience a force proportional to the current in the conductor, and to the strength of the
external magnetic field. The internal configuration of a DC motor is designed to harness the
magnetic interaction between a current-carrying conductor and an external magnetic field to
generate rotational motion. So in our project we represent the can engine with a motor.
Features

Cheap

Low power

Efficient
2.11 Buzzer
Loud output buzzer for printed circuit board mounting.
Features

Rated Frequency: 4KHz Continuous

Operating Voltage: 1.5 - 27Vdc

Current Consumption: 15mA @ 12Vdc

Sound Pressure Level(30cm): 85dB @ 5Vdc
13
3 Chapter Three
Practical Work
3.1
Block Diagram of the project
POWER
SUPPLY
16X2 LCD DISPLAY
GSM&GPRS
MODEM
SIM 900A
A/D
Converter
AT89S52
MICRO
CONTROLLER
(MEMS)
SENSOR
DRIVE
R IC2
ENGINE
DRIVE
R IC3
ALARM
14
MAX232
We have design the circuit according to the four ports of AT89S52 microcontroller and
interfacing the needed devices with the suitable port ,we will describe bellow each port and
interfacing the dedicated device with it.
Figure (‎3-1) : Functional block diagram of micro controller.
3.2 Interfacing the LCD with the Port 0:
We are going to discuss the port 0 and LCD pin description and how we connected them with
each other .
3.2.1 Pin Description of Port 0
Port 0 is an 8-bit open drain bidirectional 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 can 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 pull-ups. Port 0 also
15
receives the code bytes during Flash programming and outputs the code bytes during program
verification.
External pull-ups are required during program verification.
3.2.2 Pin description of LCD
LCD requires only 11 connections – eight bits for data (which can be reduced to four if
necessary) and three control lines (we have only used two here). It runs off a 5V DC supply
and only needs about 1mA of current.
Table (‎3-1) : Pin description of LCD.
Pins
Description
1
Ground
2
Vcc
3
Contrast Voltage
4
R/S _Instruction/Register Select
5
R/W _Read/write LCD Registers
6
E Clock
7-14
Data I/O Pins
From this description, the interface is a parallel bus, allowing simple and fast reading/writing
of data to and from the LCD. This waveform will write an ASCII Byte out to the LCD's
screen.
 Vcc, Vss and Vee
While Vcc and Vss provide +5V and ground respectively, Vee is used for controlling
LCD contrast.
16
Table (‎3-2) : Pins Symbol and Description of LCD .
T
PIN
SYMBOL
I/O
DESCRIPTION
1
Vss
--
Ground
2
Vcc
--
+5V power supply
3
Vee
--
Power supply to control contrast
4
RS
I
RS=0 to select command register
h
RS=1 to select data register
T
h
4
RS
I
e
A
RS=0 to select command register
RS=1 to select data register
5
R/W
I
S
R/W=0 for write
R/W=1 for read
C
I
6
EN
I/O
Enable
I
7
DB0
I/O
The 8-bit data bus
8
DB1
I/O
The 8-bit data bus
9
DB2
I/O
The 8-bit data bus
10
DB3
I/O
The 8-bit data bus
11
DB4
I/O
The 8-bit data bus
12
DB5
I/O
The 8-bit data bus
13
DB6
I/O
The 8-bit data bus
14
DB7
I/O
The 8-bit data bus
c
o
d
e
t
o
b
e
displayed is eight bits long and is sent to the LCD either four or eight bits at a time.
If four bit mode is used, two nibbles of data (Sent high four bits and then low four bits with an
"E" Clock pulse with each nibble) are sent to make up a full eight bit transfer.
17
The "E" Clock is used to initiate the data transfer within the LCD.
Deciding how to send the data to the LCD is most critical decision to be made for an LCD
interface application. Eight-bit mode is best used when speed is required in an application and
at least ten I/O pins are available.
The R/S bit is used to select whether data or an instruction is being transferred between the
microcontroller and the LCD.
If the Bit is set, then the byte at the current LCD "Cursor" Position can be reader written.
When the Bit is reset, either an instruction is being sent to the LCD or the execution status of
the last instruction is read back.
3.2.2.1 Asynchronous serial communication
Asynchronous serial communication describes an asynchronous, serial transmission protocol
in which a start signal is sent prior to each byte, character or code word and a stop signal is
sent after each code word. The start signal serves to prepare the receiving mechanism for the
reception and registration of a symbol and the stop signal serves to bring the receiving
mechanism to rest in preparation for the reception of the next symbol. A common kind of
start-stop transmission is ASCII over RS-232, for example for use in teletypewriter operation.
In the diagram, two bytes are sent, each consisting of a start bit, followed by seven data bits
(bits 0-6), a parity bit (bit 7), and one stop bit, for a 10-bit character frame. The number of data
and formatting bits, the order of data bits, and the transmission speed must be pre-agreed by
the communicating parties. The "stop bit" is actually a "stop period"; the stop period of the
transmitter may be arbitrarily long. It cannot be shorter than a specified amount, usually 1 to 2
bit times. The receiver requires a shorter stop period than the transmitter. At the end of each
character, the receiver stops briefly to wait for the next start bit. It is this difference which
keeps the transmitter and receiver synchronized.
3.2.3
Interfacing LCD with 8052 microcontroller
 We conduct the pin 1 (GND) ,pin 3 (VEE) and pin 5(RW) to the GND
18
 We conduct the pin 2 to the VCC (+5V power supply)
 We conduct the pin 4 (RS) to microcontroller (P0.1)
 We conduct the pin 6 (EN) to microcontroller (P0.3)
 We conduct the pins 11,12,13,14 to microcontroller (P0.4,P0.5,P0.6,P0.7)
Figure (3-2) : Schematic Diagram of Interfacing LCD to Port 0.
Figure (‎3-3) : Connecting LCD to Port0 .
19
3.3 Interfacing the DC Motor and Buzzer with Port 1
We are going to discuss the port 1 pin description and which pins we used with motor and busser .
3.3.1 Pin Description of Port 1
Port 1 is an 8-bit bidirectional 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. In addition, P1.0 and P1.1
can be configured to be the timer/counter 2 external count input (P1.0/T2) and the
timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the following table. Port
1 also receives the low-order address bytes during Flash programming and verification.
Table (‎3-3) : Alternate Functions of Port 1 Pins .
Port Pin
Alternate Functions
P1.0
T2 (external count input to Timer/Counter 2).
clock-out
P1.1
T2EX (Timer/Counter 2 capture/reload trigger and direction
control)
P1.5
MOSI (used for in- System Programming)
P1.6
MISO (used for in- System Programming)
P1.7
SCK (used for in- System Programming)
3.2.2 Interfacing DC Motor and Buzzer with P1.3 & P1.4
We only use two pins from port 1 and we use two BC547 transistors ,
P1.3 connected to the DC Motor (which represent the engine of car) via first BC547 transistor.
P1.4 connected to the Buzzer via second BC547 transistor .
20
Figure (‎3-4) : Schematic Diagram of Motor and Buzzer.
We connected the positive terminal of DC Motor and the negative terminal of Buzzer to the
VCC and negative terminal of DC Motor to the collector of transistor and the positive terminal
of Buzzer to the emitter of the other transistor and both transistors bases connected to P1.3 &
P1.4 of microcontroller .
Figure ( ‎3-5 ) : connecting Motor and Buzzer to Port 1.
21
3.4 Interfacing MEMS to Port 2
We are going to discuss the port 2 pin description and how we connect the MEMS sensor to it
via A/D converter and how we connect LED with port 2.
3.4.1
Pin description of Port 2
Port 2 is an 8-bit bidirectional 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. As inputs, Port 2 pins that are externally being
pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the highorder address byte during fetches from external program memory and during accesses to
external data memory that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2
uses strong internal pull-ups when emitting 1s. During accesses to external data memory that
use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function
Register. Port 2 also receives the high-order address bits and some control signals during Flash
programming and verification.
3.4.2 Interfacing LED1 , LED2 and MEMS sensors to Port 2
3.4.2.1 Interfacing LED1 & LED2
We just connect LED1 to P2.1 and LED2 to P2.2 to give information about vibration accident
3.4.2.2 Interfacing MEMS accelerometer to A/D converter
Accelerometers are recently developed solid state electronics devices that makes it very easy
to measure acceleration. They are completely modular and very tiny devices which gives
voltage proportional to acceleration. These type are called analog accelerometers as their
output is voltage, so we add A/D Converter for interfacing MEMS with microcontroller.
Interfacing the module is fairly easy, we just connect the X,Y outputs to the ADC input
channels. The inbuilt ADC will convert the analog voltage into a digital number.
After reading the above tutorial you know that A/D converter will give us a number between
0-1023 for voltage between 0-5V.
22
Figure (‎3-6) : block diagram of the MMA7260 Accelerometer Module.
The signals on left hand side are the input and on the right side are output. The MMA7260
accelerometer module supports 4 selectable g options.
Table (‎3-4) : The 4 selectable g options of MMA 7260.
g-Select2
g-Select1
Range
Sensitivity
0
0
1.5g
800mV/g
0
1
2.0g
600mV/g
1
0
4.0g
300mV/g
1
1
6.0g
200mV/g
To select any g Range, simply apply proper logic at the g-Select Pins. You can use the 3.3V
out pin to get logic high. Note: Never apply 5v as logic high as it will damage the chip. In this
example we will use the first mode, i.e. 1.5g so we leave the g-Select Pins unconnected. The
internal PULL DOWN resistors will make both pins logic 0. For Normal operation the SLEEP
pin must be at HIGH logic, so tie it up to the 3.3v Out pin.
23
Output of MMA7260 accelerometer module.
The output of any axis is an analog voltage proportional to the acceleration in that axis. As the
acceleration can be positive, negative or zero. So the output has a zero bias point. That means
the output is held at this point for zero acceleration. A negative acceleration will result in
voltage less than the zero g point. Normally this zero bias point is half of the supply voltage
for mma7260. In our case it is 3.3V so zero bias point is 1.65V.
Table (‎3-5) : Pin Output of MMA 7260 .
Ground Supply
GND
VDD
3.3 V OUT
Sel2
G Select Pin2 (See datasheet)
Sel1
G Select Pin1 (See datasheet)
X
X axis output (g bias point @ 1.65v)
Y
Y axis output (g bias point @ 1.65v)
3.4.2.3 Interfacing A/D converter to AT89S52 microcontroller

We connect the VDD of A/D converter to VCC (Supply Voltage).

We connect the CLK to P2.4 ,DOUT to P2.5 ,DIN to P2.6 and CS/SH DN to P2.7.

We connect AGND and DGND to the ground of circuit .
Figure( ‎3-7) : Schematic Diagram of Interfacing MEMS to Port 2 using A/D Converter .
24
Figure (‎3-8) : Connecting MEMS sensor & LED to Port 2.
3.5 Interfacing GSM modem to Port 3
We are going to discuss the port 3 pin description and GSM AT commands then how we
connected GSM modem to the port 3 with the use of MAX232N.
3.5.1
Pin description of Port 3
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers can
sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the
internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being
pulled low will source current (IIL) because of the pull-ups. Port 3 also serves the functions of
various special features of the AT89S52, as shown in the following table. Port 3 also receives
some control signals for Flash programming and verification.
25
Table (‎3-6) : Alternate Functions of Port 3 Pins.
Port Pin
Alternate Functions
P3.0
RXD (serial input port)
P3.1
TXD (serial output port)
P3.2
INT0 (external input port 0 )
P3.3
INT1 (external output port 1 )
P3.4
T0 (timer 0 external input)
P3.5
T1 (timer 1 external output)
P3.6
WR (external data memory write strobe)
P3.7
RD (external data memory read strobe)
3.5.2 Interfacing GSM modem to the port 3 using MAX232
A GSM modem exposes an interface that allows applications such as Now SMS 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.
3.5.2.1 GSM AT Commands
AT Commands are used to perform different operations is GSM module
3.5.2.1.1 Short message commands
Preferred Message Format +CMGF
Description:
The message formats supported are text mode and PDU mode. In PDU mode, a complete
SMS Message including all header information is given as a binary string (in hexadecimal
format).Therefore,
only
the
following
set
of
characters
is
allowed:
{„0‟,‟1‟,‟2‟,‟3‟,‟4‟,‟5‟,‟6‟,‟7‟,‟8‟,‟9‟, „A‟,„B‟,‟C‟,‟D‟,‟E‟,‟F‟}. Each pair or characters are
26
converted to a byte (e.g.: „41‟ is converted to theASCII character „A‟, whose ASCII code is
0x41 or 65). In Text mode, all commands and responses are in ASCII characters. The format
selected is stored in EEPROM by the +CSAS command.
3.5.2.1.2 Send message + CMGS
To send a message in text mode CMGS command used
Description:
The <address> field is the address of the terminal to which the message is sent. To
send the message, simply type, <ctrl-Z> character (ASCII 26). The text can contain all
existing characters except <ctrl-Z> and <ESC> (ASCII 27). This command can be aborted
using the <ESC> character when entering text. In PDU mode, only hexadecimal characters are
used („0‟…‟9‟,‟A‟…‟F‟).
3.5.2.1.3 The <CR> Character
<CR>, which represents the carriage return character, follows the address_type parameter.
When the GSM/GPRS modem or mobile phone receives the carriage return character, it will
send back a prompt formed by these four characters: the carriage return character, the linefeed
character, the ">" character and the space character.
3.5.2.1.4 The sms_message_body Parameter
The third parameter of the +CMGS AT command, sms_message_body, specifies the body of
the SMS message to be sent. Entering the <Esc> character will cancel the +CMGS AT
command.
3.5.2.1.5 The <Ctrl+z> Character
When you finish entering the SMS message body, you have to enter the <Ctrl+z> character to
mark the end of the SMS message body. The GSM/GPRS modem or mobile phone will then
attempt to send the SMS message to the SMS center
 Logic Diagram of MAX232 :
Figure (‎3-9) : Logic Diagram of MAX232.
27
3.5.2.2 Using the RS232 connector between GSM modem and MAX232N
These connectors are either male (with pins) or female (with holes), in our project we
use the female one. We use the RXD and TXD pins to transmit and receive data and the COM
must be connected to give a common voltage reference. All of the remaining pins are unused.
 RS232 pin assignments:
Figure (‎3-10) : RS232 pin assignments.
Figure (‎3-11) : Schematic Diagram of Interfacing GSM modem to Port 3 using MAX232.
28
Figure (‎3-12) : Connecting GSM modem to Port 3 .
3.6 Rst
Reset input. A high on this pin for two machine cycles while the oscillator is running resets the
device. This pin drives High for 96 oscillator periods after the Watchdog times out. The
DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default
state of bit DISRTO, the RESET HIGH out feature is enabled. ALE/PROG Address Latch
Enable (ALE) is an 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. If desired, ALE operation can be
disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a
MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALEdisable bit has no effect if the microcontroller is in external execution mode.
29
Figure (‎3-13) : Schematic Diagram of RESET Switch.
3.7 Xtal1 & Xtal2
XTAL1 is Input to the inverting oscillator amplifier and input to the
internal clock operating circuit.
XTAL2 is Output from the inverting oscillator amplifier.
Figure (‎3-14) : Schematic Diagram of the Inverting Oscillator Amplifier.
Figure (‎3-15) : Inverting Oscillator Amplifier
30
 The 8052 Oscillator and Clock
The heart of the 8051 circuitry that generates the clock pulses by which all the
internal all internal operations are synchronized. Pins XTAL1 And XTAL2 is provided for
connecting a resonant network to form an oscillator. Typically a quartz crystal and capacitors
are employed. The crystal frequency is the basic internal clock frequency of the
microcontroller. The anufacturers make 8051 designs that run at specific minimum and
maximum frequencies typically 1 to 16 MHz.
Figure( ‎3-16) : Oscillator and timing circuit.
3.8 Power Supply
A variable regulated power supply, also called a variable bench power supply, is one
where you can continuously adjust the output voltage to your requirements. Varying the output
of the power supply is the recommended way to test a project after having double checked
parts placement against circuit drawings and the parts placement guide. This type of regulation
is ideal for having a simple variable bench power supply. Actually this is quite important
because one of the first projects a hobbyist should undertake is the construction of a variable
regulated power supply. While a dedicated supply is quite handy e.g. 5V or 12V, it's much
handier to have a variable supply on hand, especially for testing. Most digital logic circuits
and processors need a 5 volt power supply. To use these parts we need to build a regulated 5
31
volt source. Usually you start with an unregulated power supply ranging from 9 volts to 24
volts DC (A 12 volt power supply is included with the Beginner Kit and the Microcontroller
Beginner Kit.). The LM7805 is simple to use. You simply connect the positive lead of your
unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin, connect the
negative lead to the Common pin and then when you turn on the power, you get a 5 volt
supply from the Output pin.
3.8.1 Block Diagram of Power Supply
Figure (‎3-17) : Block Diagram of Power Supply Circuit.
3.8.2 Circuit Diagram of Power Supply
Figure( ‎3-18) : Circuit Diagram of Power Supply.
Figure( ‎3-19) : Power Supply Circuit.
32
Figure (‎3-20 ) : Full circuit of project.
33
3.9 Schematic diagram
34
3.10 KEIL U V4 Software
3.10.1 Introduction to KEIL SW
Many companies provide the 8051 assembler, some of them provide shareware version of
their product on the Web, Kiel is one of them. We can download them from their Websites.
However, the size of code for these shareware versions is limited and we have to consider
which assembler is suitable for our application.
Kiel uVision4 is an IDE (Integrated Development Environment) that helps you write,
compile, and debug embedded programs. It encapsulates the following components:

A project manager.

A make facility.

Tool configuration.

Editor.

A powerful debugger.
To help you get started, several example programs
3.10.2 ISP Flash Microcontroller Programmer:
Features:
 Complete In-System Programming Solution for ARM Microcontrollers
 Covers All ARM Microcontrollers with In-System Programming Support
 Reprogram Both Data Flash and Parameter EEPROM Memories
 Complete Schematics for Low-cost In-System Programmer
 Simple Three-wire SPI Programming Interface
Introduction:
In-System
Programming
allows
programming
and
reprogramming
of
any ARM
microcontroller Positioned inside the end system. Using a simple three-wire SPI interface, the
In-System Programmer communicates serially with the ARM microcontroller, reprogramming
all non-volatile memories on the chip. In-System Programming eliminates the physical
removal of chips from the system. This will save time, and money, both during development
35
in the lab, and when updating the software or parameters in the field. This application note
shows how to design the system to support In-System Programming. It also shows how a lowcost In-System Programmer can be made, that will allow the target ARM microcontroller to be
programmed from any PC equipped with a regular 9-pin serial port. Alternatively, the entire
In-System Programmer can be built into the system allowing it to reprogram itself.
Figure (‎3-21) : ISP-Programmer Interface .
The Programming Interface:
For In-System Programming, the programmer is connected to the target using as few
wires as possible. To program any ARM microcontroller in any target system, a simple Sixwire interface is used to connect the programmer to the target PCB.
Below shows the
connections needed. The Serial Peripheral Interface (SPI) consists of three wires: Serial Clock
(SCK), Master In – Slave Out (MISO) and Master Out – Slave In (MOSI). When
programming the ARM, the In-System Programmer always operate as the Master, and the
target system Always operate as the Slave. The In-System Programmer (Master) provides the
clock for the communication on the SCK Line. Each pulse on the SCK Line transfers one bit
from the Programmer (Master) To the Target (Slave) on the Master out – Slave in (MOSI)
line. Simultaneously, Each pulse on the SCK Line transfers one bit from the target (Slave) to
the Programmer (Master) on the Master in – Slave out (MISO) line.
3.10.3 KEIL SW Programming Procedure.
Procedure Steps
Step-1:
36
Install Keil MicroVision-2 in your PC, Then after Click on that “Keil UVision-2” icon. After
opening the window go to toolbar and select Project Tab then close previous project.
Step-2:
Next select New Project from Project Tab.
Step-3:
Then it will open “Create New Project” window. Select the path where you want to save
project and edit project name.
37
The continued of the rest of steps in Appendix A.
3.11 Software Code
3.11.1 Software program:
#include<reg52.h>
#include<string.h>
#include<stdio.h>
#include"lcddisplay.h"
sbit buzz =P1^4;
sbit fan =P1^3;
sbit led1=P2^1;
sbit led2=P2^2;
void integer_lcd(int);
float adc_convert (void);
unsigned char byte_write_read(unsigned char);
void select_channel(void);
unsigned char channel,AA,CC;
38
int result1,result2;
unsigned int bbb,aaa,ccc;
sbit CLK = P2^4;
sbit DOUT= P2^5;
sbit DIN = P2^6;
sbit CS = P2^7;
sbit sw = P2^0;
unsigned char lt[10],lg[10],dt[11],hh[3],mm[3];
void read_gps(void);
unsigned char a;
unsigned char i;
void delay(unsigned int v)
{unsigned int ii,j;for(ii=0;ii<=v;ii++)for(j=0;j<=1275;j++);}
void tx(unsigned char *tx)
{for(;*tx != '\0';tx++){SBUF=*tx;while(TI == 0);TI=0;}}
void ch_send_to_modem (unsigned char single_char)
{SBUF=single_char;while(TI==0);TI=0;delay(10);}
The continued of the rest of the program code in appendix B
39
4 Chapter Four
4.1 Conclusion and Future Work
In this project. It can shorten the alarm time greatly and locate the accident spot accurately,
realizing the automation of accident detection and information transmission. Consequently, it
will save the rescuers form wasting their time in search. The experiments of model car‟s
collision and rollover proved that this system can automatically detect corresponding accident
and sent related information. Such functions can be achieved by buttons representing "false
alarm, help and safety, respectively.
4.2
Obstacles .
1- Changing idea of the first project (due to lack of availability of electronic parts) to
another idea taken from us part of the scheduled time to complete the project.
2- The lack of a piece of GPS that define the site is completely and we used a technique
that determines the GPRS site BTS (the current cell) instead of the GPS.
3- The lack of the sensitive collision sensor that we have replaced it with a tending
sensor.
4.3 Recommendations .
1- We recommend using the GPS to get the exact location.
2- We recommend using the private accident sensor located in a vehicle which uses for
air bag.
3- We recommend to integrate all the hardware used in this project at one designed
electronic board includes all the hardware so that it is a single device and minimal size.
4.4 References
[1]
Yao Jin. The discussion of Road Traffic Safety Countermeasures System [J]. Private
Science and Technology, 2010, (06).
[2]
Wang Wei. Embedded Microcontroller MC9S08AW60 Principles and Application [M].
Beijing: Beijing Aerospace University Press, 2008.
[3]
Zhu Yi, Yang Shubo. MMA series of acceleration sensor principles and application [J].
Medical equipment, 2008, (04).
[4]
TAYLORRK, SCHROCKMD, BLOOMFIELDJ, Dynamic testing of GPS receivers [J].
Transactions of the ASAE, 2004,47 (4).
40
[5]
SIEMENS, TC35i Hardware Interface Description [M]. April 14,2003
[6]
Ma Chao. Embedded GSM message interface hardware and software design [J].
Microcontroller and Embedded Systems, 2003, (7).
[7]
“The ARM Microcontroller and Embedded Systems” By Muhammad Ali Mazidi and Janice
Gillispie Mazidi. Pearson Education.
[8]
ArmLPC2148 Data sheets
[9]
Hand book for Digital IC‟s from Analogic Devices
[10] www.philips.com
[11] www.howstuffworks.com
[12] www.google.com
[13] www.wiznet.com
[14] www.wikipedia.com
[15] www.maxim-ic.com
[16] Jonathan Westhues's Proximity Website
[17] Ethernet
[18] Sunroom technologies
[19] IEEE Code of Ethics
4.5 Appendix(A)
Complement of KEIL SW Programming Procedure steps :
Step-4:
Next it opens “Select Device for Target” window, It shows list of companies and here
you can select the device manufacturer company.
41
Step-5:
For an example, for your project purpose you can select the chip as 89c51/52 from
Atmel Group. Next Click OK Button, it appears empty window here you can observe left side
a small window i.e, “Project Window”. Next create a new file.
Step-6:
From the Main tool bar Menu select “File” Tab and go to New, then it will open a
window, there you can edit the program.
Step-7:
Here you can edit the program as which language will you prefer either Assembly or C.
42
Step-8:
After editing the program save the file with extension as c or asm , if you write a
program in Assembly Language save as asm or if you write a program in C Language save as
c in the selected path. Take an example and save the file as test c.
Step-9:
Then after saving the file, compile the program. For compilation go to project window
select “source group” and right click on that and go to “Add files to Group”.
43
Step-10:
Here it will ask which file has to Add. For an example here you can add “test.c” as you
saved before.
Step-11:
After compilation then next go to Debug Session. In Tool Bar menu go to “Debug” tab
and select “Start/Stop Debug Session”.
44
Step-12:
Here a simple program for “Leds Blinking”. LEDS are connected to PORT-1. you can
observe the output in that port.
Step-13:
To see the Ports and other Peripheral Features go to main toolbar menu and select
peripherals.
45
Step-14:
In this slide see the selected port i.e, PORT-1.
4.6 Appendix (B)
Complement of the program code :
void main(void)
TMOD=0x20;TH1=0xfd;SCON=0x50;TR1=1;EA=1;IT0
=1;EX0=1;
{
float f1,f2;
lcd_init();lcd_init();lcd_init();lcdcmd(0x01);lcdcmd(0x01
);
buzz=0;fan=0;
lcdcmd(0x80);msgdisplay("Intelligent " );
led1=led2=0;bbb=30;aaa=0,ccc=0;
lcdcmd(0xc0);msgdisplay("Automatic ");
46
delay(500);lcdcmd(0x01);lcdcmd(0x01);
buzz=0;fan=0;led1=led2=1;bbb=30;aaa=0,ccc=0;
lcdcmd(0x80);msgdisplay("Vehicle Accident" );
lcdcmd(0x01);
lcdcmd(0xc0);msgdisplay("Detection System");
lcdcmd(0x80);
delay(500);lcdcmd(0x01);lcdcmd(0x01);
msgdisplay("x:");
lcdcmd(0x80);msgdisplay("Using GPRS" );
lcdcmd(0xc0);
delay(500);lcdcmd(0x01);
msgdisplay("y:");
led1=led2=1;
while(1)
lcdcmd(0x80);msgdisplay("wait 2 sec " );
{
tx("AT\r\n");delay(50);
channel=0;
tx("AT\r\n");delay(50);
f1=(adc_convert()*100.0);
tx("AT+CMGF=1\r\n");delay(50);
result1=f1;
tx("AT+CMGD=1\r\n");delay(50);
lcdcmd(0x83);
tx("AT+CMGD=1,4\r\n");delay(200);
integer_lcd(result1);
tx("AT\r\n");delay(50);
delay(10);
tx("AT+CMGF=1\r\n");delay(50);
///////////////////////CHANNEL 1 FOR
HUMIDITY//////////////////////////
tx("AT+CGATT=1\r\n");delay(100);
channel=1;
tx("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"\r\n");delay
(100);
f2=(adc_convert()*100.0);
tx("AT+SAPBR=3,1,\"APN\",\"FASTINTERNET\"\r\n");delay(100);
result2=f2;
lcdcmd(0xc3);
tx("AT+SAPBR=1,1\r\n");delay(800);
integer_lcd(result2);
led1=led2=0;
delay(10);
tx("AT\r\n");delay(50);
if(vib==0)
tx("AT+CMGF=1\r\n");delay(50);
{
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GPRS IS
READY" );
lcdcmd(0xC8);
delay(500); lcdcmd(0x01);
msgdisplay("NO VIB ");
led1=led2=1;
delay(100);
st:
47
}
msgdisplay ("PRESS SWITCH ");
if(vib==1)
led1=led2=1;
{
if(sw==0)
DDD=DDD+1;
{
delay(10);
lcdcmd(0x01);
if(DDD==3)
lcdcmd(0x80);
{
msgdisplay ("NORMAL VIBRATION");
lcdcmd(0xC8);
lcdcmd(0xC0);
msgdisplay("YES VIB ");
msgdisplay (" I AM OK
buzz=1;fan=0;aaa=1;ccc=0;led1=led2=0;
delay(40);
lcdcmd(0x01);
buzz=0;fan=0;led1=led2=1;bbb=12;aaa=0,ccc=0;goto st;
lcdcmd(0x80);
}
msgdisplay("VIBRATION ");
if(bbb==9)
lcdcmd(0xC0);
{led1=led2=1;
msgdisplay("DETECTD");
lcdcmd(0x01);
delay(300);
lcdcmd(0x80);
if(aaa==1)
msgdisplay ("PRESS THE SWITCH");
{
lcdcmd(0xC0);
lcdcmd(0x01);
integer_lcd(bbb);
for(bbb=12;bbb>0;bbb--)
delay(50);
{
}
led1=led2=0;
if(bbb==1)
lcdcmd(0x80);
{
msgdisplay ("R U OK
");
");
aaa=0;
lcdcmd(0xC0);
lcdcmd(0x01);
integer_lcd(bbb);
lcdcmd(0x80);
lcdcmd(0xC3);
msgdisplay("VIBRATION
48
");
lcdcmd(0xC0);
msgdisplay("DETECTED
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GPRS
TRACK" );
");
delay(100);
tx("AT\r\n");delay(50);tx("AT\r\n");delay(50);tx("AT\r\n
");delay(50);
bbb=0;ccc=1;
tx("AT+CMGF=1\r\n");delay(50);
goto st15;
tx("AT+CIPGSMLOC=1,1\r\n");delay(100);read_gps();
}}}
lcdcmd(0X80);msgdisplay("LT:");
lcdcmd(0X83);msgdisplay(lt);
if(ccc==1)
lcdcmd(0XC0);msgdisplay("LG:");
lcdcmd(0XC3);msgdisplay(lg);
{
tx("AT+CMGS=\"734881010\"\r\n");delay(100);
st15:
tx("ACCIDENT OCCURED");tx("\r\n");delay(100);
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GPRS
TRACK" );
tx("https://www.google.com/maps/place/");delay(100);
////////////////////////////////////////////////////////////////////////
tx(lt);tx(",");tx(lg);tx("\r\n");delay(100);
tx("AT\r\n");delay(50);tx("AT\r\n");delay(50);tx("AT\r\n
");delay(50);
tx(dt);tx("\r\n");delay(100);
tx("AT+CMGF=1\r\n");delay(50);
tx(hh);tx(":");tx(mm);tx("GMT");tx("\r\n");delay(100);
tx("AT+CIPGSMLOC=1,1\r\n");delay(100);read_gps();
ch_send_to_modem(0x1a);delay(200);
lcdcmd(0X80);msgdisplay("LT:");
lcdcmd(0X83);msgdisplay(lt);
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("SMS SENT"
);delay(200);
lcdcmd(0XC0);msgdisplay("LG:");
lcdcmd(0XC3);msgdisplay(lg);
/////////////////////////////////////////////////////////////////////
goto st;
tx("AT+CMGS=\"735551710\"\r\n");delay(100);
}}}
tx("ACCIDENT OCCURED");tx("\r\n");delay(100);
tx("https://www.google.com/maps/place/");delay(100);
if(((result1 >= 150) & (result1 <= 185 )) & ( (result2 >=
150) & (result2 <= 180 )) )
tx(lt);tx(",");tx(lg);tx("\r\n");delay(100);
{buzz=0;fan=1;led1=led2=1;
tx(dt);tx("\r\n");delay(100);
lcdcmd(0x88);
tx(hh);tx(":");tx(mm);tx("GMT");tx("\r\n");delay(100);
msgdisplay("NORMAL ");
ch_send_to_modem(0x1a);delay(200);
}
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("SMS SENT"
);delay(200);
///////////////////////////FRONT/////////////////////////////////
if(((result1 >= 210) & (result1 <= 250 )) & ( (result2 >=
150) & (result2 <= 170 )) )
///////////////////////////////////////////////////////////////////////
49
{
delay(40);
buzz=1;fan=0;aaa=1;ccc=0;led1=led2=0;
buzz=0;fan=0;led1=led2=1;bbb=30;aaa=0,ccc=0;goto st;
lcdcmd(0x88);
}
msgdisplay("FRONT ");
if(bbb==9)
lcdcmd(0xC8);
{led1=led2=1;
msgdisplay("ACCIDENT");
lcdcmd(0x01);
delay(300);
lcdcmd(0x80);
if(aaa==1)
msgdisplay ("PRESS THE SWITCH");
{
lcdcmd(0xC0);
lcdcmd(0x01);
integer_lcd(bbb);
for(bbb=30;bbb>0;bbb--)
delay(50);
{
}
led1=led2=0;
if(bbb==1)
lcdcmd(0x80);
{
msgdisplay ("R U OK
");
aaa=0;
lcdcmd(0xC0);
lcdcmd(0x01);
integer_lcd(bbb);
lcdcmd(0x80);
lcdcmd(0xC3);
msgdisplay("FRONT
msgdisplay ("PRESS SWITCH ");
lcdcmd(0xC0);
led1=led2=1;
msgdisplay("ACCIDENT ");
if(sw==0)
delay(100);
{
bbb=0;ccc=1;
lcdcmd(0x01);
goto st1;
lcdcmd(0x80);
}}}
msgdisplay ("NORMAL ACCIDENT ");
if(ccc==1)
lcdcmd(0xC0);
{
msgdisplay (" I AM OK
");
st1:
50
");
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GPRS
TRACK" );
tx("ACCIDENT OCCURED");tx("\r\n");delay(100);
tx("https://www.google.com/maps/place/");delay(100);
////////////////////////////////////////////////////////////////////////
tx(lt);tx(",");tx(lg);tx("\r\n");delay(100);
tx("AT\r\n");delay(50);tx("AT\r\n");delay(50);tx("AT\r\n
");delay(50);
tx(dt);tx("\r\n");delay(100);
tx("AT+CMGF=1\r\n");delay(50);
tx(hh);tx(":");tx(mm);tx("GMT");tx("\r\n");delay(100);
tx("AT+CIPGSMLOC=1,1\r\n");delay(100);read_gps();
ch_send_to_modem(0x1a);delay(200);
lcdcmd(0X80);msgdisplay("LT:");
lcdcmd(0X83);msgdisplay(lt);
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("SMS SENT"
);delay(200);
lcdcmd(0XC0);msgdisplay("LG:");
lcdcmd(0XC3);msgdisplay(lg);
/////////////////////////////////////////////////////////////////////
goto st;
tx("AT+CMGS=\"735551710\"\r\n");delay(100);
}}
tx("ACCIDENT OCCURED");tx("\r\n");delay(100);
///////////////////////////////////////BACK///////////////////////////////
tx("https://www.google.com/maps/place/");delay(100);
tx(lt);tx(",");tx(lg);tx("\r\n");delay(100);
if(((result1 >= 100) & (result1 <= 120 )) & ( (result2 >=
150) & (result2 <= 170 )) )
tx(dt);tx("\r\n");delay(100);
{
tx(hh);tx(":");tx(mm);tx("GMT");tx("\r\n");delay(100);
buzz=1;fan=0;aaa=1;ccc=0;led1=led2=0;
ch_send_to_modem(0x1a);delay(200);
lcdcmd(0x88);
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("SMS SENT"
);delay(200);
msgdisplay("BACK
");
lcdcmd(0xC8);
///////////////////////////////////////////////////////////////////////
msgdisplay("ACCIDENT");
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GPRS
TRACK" );
delay(300);
tx("AT\r\n");delay(50);tx("AT\r\n");delay(50);tx("AT\r\n
");delay(50);
if(aaa==1)
tx("AT+CMGF=1\r\n");delay(50);
{
tx("AT+CIPGSMLOC=1,1\r\n");delay(100);read_gps();
lcdcmd(0x01);
lcdcmd(0X80);msgdisplay("LT:");
lcdcmd(0X83);msgdisplay(lt);
for(bbb=30;bbb>0;bbb--)
{
lcdcmd(0XC0);msgdisplay("LG:");
lcdcmd(0XC3);msgdisplay(lg);
led1=led2=0;
tx("AT+CMGS=\"734881010\"\r\n");delay(100);
lcdcmd(0x80);
51
msgdisplay ("R U OK
");
aaa=0;
lcdcmd(0xC0);
lcdcmd(0x01);
integer_lcd(bbb);
lcdcmd(0x80);
lcdcmd(0xC3);
msgdisplay("BACK
msgdisplay ("PRESS SWITCH ");
lcdcmd(0xC0);
led1=led2=1;
msgdisplay("ACCIDENT ");
if(sw==0)
delay(100);
{
bbb=0;ccc=1;
lcdcmd(0x01);
goto st2;
lcdcmd(0x80);
}}}
msgdisplay ("NORMAL ACCIDENT ");
if(ccc==1)
lcdcmd(0xC0);
{
msgdisplay (" I AM OK
");
");
st2:
delay(40);
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GPRS
TRACK" );
buzz=0;fan=0;led1=led2=1;bbb=30;aaa=0,ccc=0;goto st;
////////////////////////////////////////////////////////////////////////
}
if(bbb==9)
tx("AT\r\n");delay(50);tx("AT\r\n");delay(50);tx("AT\r\n
");delay(50);
{
tx("AT+CMGF=1\r\n");delay(50);
lcdcmd(0x01);
tx("AT+CIPGSMLOC=1,1\r\n");delay(100);read_gps();
lcdcmd(0x80);
lcdcmd(0X80);msgdisplay("LT:");
lcdcmd(0X83);msgdisplay(lt);
msgdisplay ("PRESS THE SWITCH");
lcdcmd(0XC0);msgdisplay("LG:");
lcdcmd(0XC3);msgdisplay(lg);
lcdcmd(0xC0);
tx("AT+CMGS=\"735551710\"\r\n");delay(100);
integer_lcd(bbb);
tx("ACCIDENT OCCURED");tx("\r\n");delay(100);
delay(50);
tx("https://www.google.com/maps/place/");delay(100);
}
tx(lt);tx(",");tx(lg);tx("\r\n");delay(100);
if(bbb==1)
tx(dt);tx("\r\n");delay(100);
{
52
tx(hh);tx(":");tx(mm);tx("GMT");tx("\r\n");delay(100);
buzz=1;fan=0;aaa=1;ccc=0;led1=led2=0;
ch_send_to_modem(0x1a);delay(200);
lcdcmd(0x88);
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("SMS SENT"
);delay(200);
msgdisplay("LEFT ");
lcdcmd(0xC8);
///////////////////////////////////////////////////////////////////////
msgdisplay("ACCIDENT");
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GPRS
TRACK" );
delay(300);
tx("AT\r\n");delay(50);tx("AT\r\n");delay(50);tx("AT\r\n
");delay(50);
if(aaa==1)
{
tx("AT+CMGF=1\r\n");delay(50);
lcdcmd(0x01);
tx("AT+CIPGSMLOC=1,1\r\n");delay(100);read_gps();
for(bbb=30;bbb>0;bbb--)
lcdcmd(0X80);msgdisplay("LT:");
lcdcmd(0X83);msgdisplay(lt);
{
lcdcmd(0XC0);msgdisplay("LG:");
lcdcmd(0XC3);msgdisplay(lg);
led1=led2=0;
tx("AT+CMGS=\"734881010\"\r\n");delay(100);
lcdcmd(0x80);
tx("ACCIDENT OCCURED");tx("\r\n");delay(100);
msgdisplay ("R U OK
tx("https://www.google.com/maps/place/");delay(100);
lcdcmd(0xC0);
tx(lt);tx(",");tx(lg);tx("\r\n");delay(100);
integer_lcd(bbb);
tx(dt);tx("\r\n");delay(100);
lcdcmd(0xC3);
tx(hh);tx(":");tx(mm);tx("GMT");tx("\r\n");delay(100);
msgdisplay ("PRESS SWITCH ");
ch_send_to_modem(0x1a);delay(200);
led1=led2=1;
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("SMS SENT"
);delay(200);
if(sw==0)
");
{
/////////////////////////////////////////////////////////////////////
lcdcmd(0x01);
goto st;
lcdcmd(0x80);
}}
msgdisplay ("NORMAL ACCIDENT ");
////////////////////////////////////////LEFT///////////////////////////////////
lcdcmd(0xC0);
if(((result2 >= 210) & (result2 <= 250 )) & ( (result1 >=
150) & (result1 <= 180 )) )
msgdisplay (" I AM OK
{
delay(40);
53
");
buzz=0;fan=0;led1=led2=1;bbb=30;aaa=0,ccc=0;goto st;
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GPRS
TRACK" );
}
////////////////////////////////////////////////////////////////////////
if(bbb==9)
{
tx("AT\r\n");delay(50);tx("AT\r\n");delay(50);tx("AT\r\n
");delay(50);
lcdcmd(0x01);
tx("AT+CMGF=1\r\n");delay(50);
lcdcmd(0x80);
tx("AT+CIPGSMLOC=1,1\r\n");delay(100);read_gps();
msgdisplay ("PRESS THE SWITCH");
lcdcmd(0X80);msgdisplay("LT:");
lcdcmd(0X83);msgdisplay(lt);
lcdcmd(0xC0);
lcdcmd(0XC0);msgdisplay("LG:");
lcdcmd(0XC3);msgdisplay(lg);
integer_lcd(bbb);
tx("AT+CMGS=\"735551710\"\r\n");delay(100);
delay(50);
tx("ACCIDENT OCCURED");tx("\r\n");delay(100);
}
tx("https://www.google.com/maps/place/");delay(100);
if(bbb==1)
tx(lt);tx(",");tx(lg);tx("\r\n");delay(100);
{
tx(dt);tx("\r\n");delay(100);
aaa=0;
tx(hh);tx(":");tx(mm);tx("GMT");tx("\r\n");delay(100);
lcdcmd(0x01);
ch_send_to_modem(0x1a);delay(200);
lcdcmd(0x80);
msgdisplay("LEFT
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("SMS SENT"
);delay(200);
");
lcdcmd(0xC0);
///////////////////////////////////////////////////////////////////////
msgdisplay("ACCIDENT ");
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GPRS
TRACK" );
delay(100);
bbb=0;ccc=1;
tx("AT\r\n");delay(50);tx("AT\r\n");delay(50);tx("AT\r\n
");delay(50);
goto st3;
tx("AT+CMGF=1\r\n");delay(50);
}
tx("AT+CIPGSMLOC=1,1\r\n");delay(100);read_gps();
}}
lcdcmd(0X80);msgdisplay("LT:");
lcdcmd(0X83);msgdisplay(lt);
if(ccc==1)
{
lcdcmd(0XC0);msgdisplay("LG:");
lcdcmd(0XC3);msgdisplay(lg);
st3:
tx("AT+CMGS=\"734881010\"\r\n");delay(100);
54
tx("ACCIDENT OCCURED");tx("\r\n");delay(100);
msgdisplay ("R U OK
");
tx("https://www.google.com/maps/place/");delay(100);
lcdcmd(0xC0);
tx(lt);tx(",");tx(lg);tx("\r\n");delay(100);
integer_lcd(bbb);
tx(dt);tx("\r\n");delay(100);
lcdcmd(0xC3);
tx(hh);tx(":");tx(mm);tx("GMT");tx("\r\n");delay(100);
msgdisplay ("PRESS SWITCH ");
ch_send_to_modem(0x1a);delay(200);
led1=led2=1;
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("SMS SENT"
);delay(200);
if(sw==0)
{
/////////////////////////////////////////////////////////////////////
lcdcmd(0x01);
goto st;
lcdcmd(0x80);
}}
msgdisplay ("NORMAL ACCIDENT ");
///////////////////////////////////////RIGHT/////////////////////////////////
////////////
lcdcmd(0xC0);
if(((result2 >= 100) & (result2 <= 120 )) & ( (result1 >=
150) & (result1 <= 180 )) )
msgdisplay (" I AM OK
");
delay(40);
{
buzz=0;fan=0;led1=led2=1;bbb=30;aaa=0,ccc=0;goto st;
buzz=1;fan=0;aaa=1;ccc=0;led1=led2=0;
}
lcdcmd(0x88);
if(bbb==9)
msgdisplay("RIGHT ");
{
lcdcmd(0xC8);
lcdcmd(0x01);
msgdisplay("ACCIDENT");
lcdcmd(0x80);
delay(300);
msgdisplay ("PRESS THE SWITCH");
if(aaa==1)
lcdcmd(0xC0);
{
integer_lcd(bbb);
lcdcmd(0x01);
delay(50);
for(bbb=30;bbb>0;bbb--)
}
{
if(bbb==1)
led1=led2=0;
{
lcdcmd(0x80);
55
aaa=0;
tx(hh);tx(":");tx(mm);tx("GMT");tx("\r\n");delay(100);
lcdcmd(0x01);
ch_send_to_modem(0x1a);delay(200);
lcdcmd(0x80);
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("SMS SENT"
);delay(200);
msgdisplay("RIGHT
");
///////////////////////////////////////////////////////////////////////
lcdcmd(0xC0);
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GPRS
TRACK" );
msgdisplay("ACCIDENT ");
tx("AT\r\n");delay(50);tx("AT\r\n");delay(50);tx("AT\r\n
");delay(50);
delay(100);
bbb=0;ccc=1;
tx("AT+CMGF=1\r\n");delay(50);
goto st4;
tx("AT+CIPGSMLOC=1,1\r\n");delay(100);read_gps();
}}}
lcdcmd(0X80);msgdisplay("LT:");
lcdcmd(0X83);msgdisplay(lt);
if(ccc==1)
{
lcdcmd(0XC0);msgdisplay("LG:");
lcdcmd(0XC3);msgdisplay(lg);
st4:
tx("AT+CMGS=\"734881010\"\r\n");delay(100);
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GPRS
TRACK" );
tx("ACCIDENT OCCURED");tx("\r\n");delay(100);
tx("https://www.google.com/maps/place/");delay(100);
////////////////////////////////////////////////////////////////////////
tx(lt);tx(",");tx(lg);tx("\r\n");delay(100);
tx("AT\r\n");delay(50);tx("AT\r\n");delay(50);tx("AT\r\n
");delay(50);
tx(dt);tx("\r\n");delay(100);
tx("AT+CMGF=1\r\n");delay(50);
tx(hh);tx(":");tx(mm);tx("GMT");tx("\r\n");delay(100);
tx("AT+CIPGSMLOC=1,1\r\n");delay(100);read_gps();
ch_send_to_modem(0x1a);delay(200);
lcdcmd(0X80);msgdisplay("LT:");
lcdcmd(0X83);msgdisplay(lt);
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("SMS SENT"
);delay(200);
lcdcmd(0XC0);msgdisplay("LG:");
lcdcmd(0XC3);msgdisplay(lg);
/////////////////////////////////////////////////////////////////////
tx("AT+CMGS=\"735551710\"\r\n");delay(100);
goto st;
tx("ACCIDENT OCCURED");tx("\r\n");delay(100);
}}}}
tx("https://www.google.com/maps/place/");delay(100);
////////////////////////////////////////
tx(lt);tx(",");tx(lg);tx("\r\n");delay(100);
float adc_convert (void)
tx(dt);tx("\r\n");delay(100);
{
56
unsigned char byte0,byte1,byte2;
DIN=0;
int i1;
CLK=0;
float val1;
if(DOUT==1)
CLK=0;
c|=mask;
CS=1;
mask>>=1;
CS=0;
}
select_channel();
while(mask>0);
byte0=byte_write_read(AA);
return c;
byte1=byte_write_read(CC);
}
byte2=byte_write_read(0x00);
void select_channel (void)
CS=1;
{
i1=(byte1&0x0f);
unsigned char x;
i1=((i1<<8)| byte2);
x=(channel*4)+0x60;
val1=((i1*5.00)/4095);
AA = x>>4;
return val1;
CC = x<<4;
}
}
///////////////////////////////////////////////////////////////////////////////////
////////
void integer_lcd(int n)
{
unsigned char byte_write_read (unsigned char a)
unsigned char c[6];
{
unsigned int i2=0;
unsigned char c=0,mask=0x80;
if(n<0){lcddata('-');n=-n;}
do
{
if(n==0)lcddata('0');while(n>0){c[i2++]=(n%10)+48;n/=1
0;}
CLK=1;
while(i2-->=1)lcddata(c[i2]);
if(a&mask)
}
DIN=1;
void read_gps()
else
{
57
‫};‪for(i=0;i<1;i++){while(RI==0);a=SBUF;RI=0‬‬
‫;)'‪do{while(RI==0);a=SBUF;RI=0;}while(a!='+‬‬
‫};‪for(i=0;i<2;i++){while(RI==0);mm[i]=SBUF;RI=0‬‬
‫};‪for(i=0;i<13;i++){while(RI==0);a=SBUF;RI=0‬‬
‫};‪for(i=0;i<4;i++){while(RI==0);a=SBUF;RI=0‬‬
‫};‪for(i=0;i<9;i++){while(RI==0);lg[i]=SBUF;RI=0‬‬
‫;'‪lt[9]='\0‬‬
‫};‪for(i=0;i<1;i++){while(RI==0);a=SBUF;RI=0‬‬
‫;'‪lg[9]='\0‬‬
‫};‪for(i=0;i<9;i++){while(RI==0);lt[i]=SBUF;RI=0‬‬
‫;'‪dt[10]='\0‬‬
‫};‪for(i=0;i<1;i++){while(RI==0);a=SBUF;RI=0‬‬
‫;'‪hh[2]='\0‬‬
‫};‪for(i=0;i<10;i++){while(RI==0);dt[i]=SBUF;RI=0‬‬
‫;'‪hh[2]='\0‬‬
‫};‪for(i=0;i<1;i++){while(RI==0);a=SBUF;RI=0‬‬
‫}‬
‫};‪for(i=0;i<2;i++){while(RI==0);hh[i]=SBUF;RI=0‬‬
‫‪ 7.4‬الملخص العربي‬
‫ػُٕاٌ ْزا انًششٔع ْٕ انرماؽ انًؼهٕياخ نهًشكثح انًظذٔيح تاسرخذاو ذمُ‪ٛ‬ح ال ‪َ ْٕ GSM&GPRS‬ظاو انًؼرًذ ػهٗ‬
‫انًؼًُح ‪ .‬يٍ خالل ْزا انركُٕنٕج‪ٛ‬ا انًرمذيح َرًكٍ يٍ انحظٕل ػهٗ يؼهٕياخ دل‪ٛ‬مح ػٍ انؼح‪ٛ‬ح ‪ْ ,‬زا انُظاو ‪ٚ‬جًغ ت‪ٍٛ‬‬
‫ذظً‪ٛ‬ى األجٓضج انًرمذيح ٔذمُ‪ٛ‬ح انرحكى اإلنكرشَٔ‪ ٙ‬انًرطٕسج ف‪ ٙ‬نٕحح يذيجح يٕثٕق تٓا ‪.‬‬
‫ف‪ْ ٙ‬زا انًششٔع اسرخذو حساط االْرضاص نهكشف ػٍ انحادز ‪ ,‬فؼُذيا انًشكثح ذٕاجّ حادثا ً يا فئٌ انحساساخ انًٓرضج ذٕنذ‬
‫إشاساخ ٔذماسٌ ْزِ اإلشاساخ يغ ل‪ٛ‬ى انؼرثاخ فئرا ذجأصخ انم‪ًٛ‬ح انًٕنذج انؼرثح ‪ٚ‬رى انرؼشف ػهٗ اَّ حادز لذ حظم ‪ ,‬فرثهؾ‬
‫ْزِ انًؼهٕياخ ػهٗ انفٕس انٗ األشخاص انًؼُ‪ ٍٛ‬يٍ خالل يٕد‪ٚ‬ى ‪ GSM‬كشسانّ َظ‪ٛ‬ح انٗ انٓاذف انًحًٕل ‪.‬‬
‫ف‪ْ ٙ‬زا انُظاو اسرخذو حساساخ االْرضاص نهكشف ػٍ يجًٕػح يٍ االططذاياخ ت‪ٛ‬اَاخ انحساط سركٌٕ ف‪ ٙ‬شكم ذًاثه‪ٙ‬‬
‫نزنك ‪ٚ‬جة ذحٕ‪ٚ‬هٓا انٗ انُظاو انشلً‪ٔ ٙ‬انر‪ ٙ‬سركًم يٍ خالل يحٕل ذًاثه‪ ٙ‬انٗ سلً‪ٚٔ , ٙ‬رى إسسال ْزِ انث‪ٛ‬اَاخ انشلً‪ٛ‬ح‬
‫انٗ انًرحكى ُْٔا س‪ٛ‬رى انًماسَح يغ ل‪ٛ‬ى انرؼث‪ٛ‬ح ‪ ,‬فئٌ ذجأصخ ل‪ٛ‬ى انؼرثح فسٕف ذشسم انث‪ٛ‬اَاخ انًخظظح نًٕدو ‪ٚٔ GSM‬رى‬
‫انرماؽ ت‪ٛ‬اَاخ انًٕلغ تًساػذج ال ‪َ( GPRS‬ظاو انحضو انشاد‪ٕٚٚ‬ح انؼاو)‪َ .‬حٍ ُْا اسرفذَا يٍ ذمُ‪ٛ‬ح ال ‪ GPRS‬نرحذ‪ٚ‬ذ يٕلغ‬
‫االططذاو‪.‬‬
‫ْزا انُظاو ‪ٚ‬ظًى يكاٌ نُظاو إَزاس انحٕادز تًا ًء ػهٗ ال‪( ARM‬يجًٕػح ذؼه‪ًٛ‬اخ تُ‪ٛ‬ح انحاسة انًرمذيح) ٔال‪, GPRS‬‬
‫ػُذ ٔلٕع حادز فئٌ انرُث‪ ّٛ‬ان‪ٛ‬ذٔ٘ ٔا‪ٜ‬ن‪ٚ ٙ‬رحمك حانح انًشكثاخ ٔيؼهٕياخ انًسرخذيح انٗ جاَة يٕالغ اإلَزاس سٕف ذحال‬
‫انٗ يشكض اإلسؼافاخ االٔن‪ ٙ‬أ انشئ‪ٛ‬س‪ٔ ٙ‬تؼذ اسرمثال يؼهٕياخ يمهمح راخ انظهح فئٌ يشكض اإلسؼافاخ س‪ٛ‬ؼشع ْزا‬
‫انًؼهٕياخ ف‪ ٙ‬خاسؽرّ ٔتؼذ ذهم‪ ٙ‬يؼهٕياخ اإلَزاس فئٌ انؼايه‪ ٍٛ‬انًُأت‪ ٍٛ‬ف‪ ٙ‬يشكض اإلسؼاف س‪ٛ‬مٕيٌٕ تأشؼاس الشب‬
‫‪58‬‬
‫دٔس‪ ّٚ‬اسؼاف نًكاٌ انحادز ف‪ ٙ‬انٕلد انًُاسة ‪ ,‬يٍ اجم انٕطٕل انٗ يكاٌ انحادز ف‪ ٙ‬انًشج األٔنٗ ٔانحظٕل ػهٗ‬
‫‪ ٙ‬نؼالج جشحٗ االططذاو ٔخفغ ٔف‪ٛ‬اخ انحٕادز ٔكزنك انحذ يٍ حذٔز إػالح ػهٗ حشكح انًشٔس ‪.‬‬
‫ٔلد كاف ً‬
‫ف‪ٔ ٙ‬لرُا انحاػش ٔيغ ذمذو انرمُ‪ٛ‬اخ ٔذطٕس انظُاػاخ أطثحد انًشاكة انحذ‪ٚ‬ثح راخ سشػح ػان‪ٛ‬ح ٔشك انطشلاخ راخ‬
‫انًسافاخ انثؼ‪ٛ‬ذج ٔانٕػشج ٔانخط‪ٛ‬شج فاصدادخ انحٕادز ف‪ ٙ‬انطشلاخ يًا أدٖ انٗ ص‪ٚ‬ادج ػذد انٕف‪ٛ‬اخ تسثة انحٕادز‬
‫ٔانرأخش ف‪ ٙ‬اَمارْى ٔػذو اَمار انًظات‪ ٍٛ‬يٍ انجٓاخ انًخرظح ٔانًسؤٔنح ٔرنك ػذو اإلتالؽ أ ػذو انؼهى ػُذ ٔلٕع‬
‫انحٕادز ف‪ ٙ‬انًسافاخ انثؼ‪ٛ‬ذج ٔتؼذ اإلسؼافاخ ػُٓى يًا ‪ٚ‬ؤد٘ اح‪ٛ‬اَا ً انٗ ٔفاخ انًظاب لثم ٔطٕل انُجذج ان‪ٛ‬ح يًا جؼهُا‬
‫انرفك‪ٛ‬ش ف‪ ٙ‬ذظًى َظاو يرحكى ان‪ٚ ٙ‬مٕو تئتالؽ ػٍ حظٕل حادز ٔيٕلغ حظٕل انحادز ٔلد حظٕل انحادز ٔإسسانّ‬
‫نهجٓاخ انًؼُ‪ٛ‬ح ٔ انًمشت‪ ٍٛ‬حرٗ ‪ٚ‬رًكٍ انٕطٕل انٗ انًظاب ف‪ ٙ‬انٕلد انًُاسة ن‪ٛ‬رًكٍ يٍ اسؼافّ َٔجذج‪.‬‬
‫‪59‬‬
Download