Adaptive Vehicle System (AVS)
Adaptive Vehicle System (AVS)
APPENDIX F
External Advisor
Assistants Professor
Manager Electronics
SUPARCO
SSUET, Karachi
Submitted by
Karachi
Rehman Gul
Mahesh Kumar Chugh
Adamjee Ashraf Moten
Muhammad Tarique Saleem
Muhammad Abdul Hayee
2008 - EE - 008
2088 - EE - 010
2008 - EE - 015
2008 - EE - 016
2008 - EE - 025
DEPARTMENT
OF ELECTRONIC
ENGINEERING
APPENDIX F
JANUARY 2012
PREFACE
Being the student of electronic engineering it is vital that we do some field work.
Whatever we have learnt during our four years of our bachelor program we gather all of
it and bring it to the zone of practicality.
Communication has become the fastest growing technology in our modern day society
and without life would be impossible. One feels that a text should serve not only for the
benefit of the reader but also pedagogically sound outline for a course of instruction. A
text should be sufficiently clear to enable the reader to understand the material well by its
reading, with a realism that approaches hand-on experience. We also think that the text
should be more comprehensive than the course of action for which it is used: thus, the
student and engineer can use some material both as a reference source and source of
further examples and illustration. Finally, we feel that the text should be able to stand
alone, with minimal need of supplement documentation and references. We hope that
each student and instructor finds that all these objectives have met in this text.
The report, A.V.S, includes complete knowledge of the project that describes the devices
used in the formation and these associated with it. The text also elaborates the
terminologies and factors related to the project.
ACKNOWLEDGEMENTS
In the name of ALLAH the most merciful; the one and only supreme power, the one
whose will makes everything possible, and the one without whose will the simplest is
impossible.
We would like to thanks to our Family members for their prayers, guidance, support and
care. Without their moral and financial support it would not have been possible for us to
achieve this milestone.
We are thankful to Mr. Shakir Karim Bukhsh, Assistant Professor, Electronic Engineering
Department SSUET who under took the task of being our project supervisor, for his kind
support and guidance during the troubled times we have faced until now.
We also wish our gratitude to all the staff in the university and last but not the least we
acknowledge the efforts of our teachers who have been our source of inspiration
throughout the university years and have shared their knowledge and skills with us.
Muhammad Sharif
FYP Project Coordinator
ABSTRACT
The modern technology in every field is all about making the life more convenient, safe
and secure for human beings. Thus living up to this fact AVS aims to make the car more
convenient and user friendly, by incorporating set of electronic features.
The smart design of ADAPTIVE VEHICLE SYSTEM frees the car user from various
tedious tasks of performing checks on cars basic parameters along with providing
intuitive control system. More over the smart design features various nourished safeties
and securities simple to operate and easy to use. The project comprises of four main sets
of features:
Security (2) Safety (3) Control (of accessories) (4) Monitoring
Upon entering car, system automatically starts-up, welcoming the driver & show
car/engines basic parameters on a LCD screen, eliminating the need of performing
physical checks like radiator water lever, battery water etc. With simple to use interactive
keypad, user can easily control windows, door locks, Boot & Fuel lid.
AVS will make the car ever more secure with the Anti-Theft & Dacoit System (using
GSM, via SMS commands) along with car immobilizing techniques. Moreover, AVS will
make the car & passenger of car safer by providing speed limiting options, overrevolution alert & alert upon detecting accident or collision.
Major Hardware components/modules used are: PIC18F452, PIC16F877A, GSM
Sim900D, GPS GR-89, ADXL-335.
AVS makes automobile much more convenient, reliable, and safe & secure, along with
much intuitive control & access to car. AVS can further be improved very much by
adding more features. In this modern era Convenience, Reliability, Safety & Security
are such aspects with the help of which choice of better product is made. So it would be
worth spending an additional amount of money while buying a vehicle with AVS.
TABLE OF CONTENTS
ACKNOWLEDGEMENTS.................................................................................................i
ABSTRACT.......................................................................................................................iii
LIST OF FIGURES.............................................................................................................1
1
OVERVIEW.3
1.1.1
1.1.2
DESCRIPTION.............................................................................................3
1.1.3
BACKGROUND...........................................................................................4
1.2
MOTIVATION.....5
1.3
METHODOLOGY...6
1.3.1
1.4
IMPLEMENTATION PHASE.....6
1.4.1
1.5
2
TESTING PHASE.........................................................................................6
DESIGN FLOW...7
AVS FEATURES.........................................................................................................8
2.1
DESIGN PHASE...........................................................................................6
AVS FEATURES.....9
2.1.1
MONITORING FEATURES........................................................................9
2.1.2
CONTROLLING FEATURES....................................................................10
2.1.3
SAFETY FEATURES.................................................................................10
2.1.4
SECURITY FEATURES.............................................................................11
SYSTEM EXPLANATION......................................................................................12
3.1
SYSTEM OVERVIEW......13
3.2
OVERALL SYSTEM.....13
3.3
SYSTEM EXPLANATIONS.....14
3.3.1
MONITORING UNIT.................................................................................14
3.3.2
CONTROL UNIT:.......................................................................................15
3.3.3
SAFETY UNIT:...........................................................................................16
3.3.4
SECURITY UNIT:......................................................................................17
3.3.5
SYSTEM OPERATION............................................................................................20
4.1
4.2
4.2.1
COMPARISON...........................................................................................21
4.2.2
WHY I2C?...................................................................................................22
4.3
4.4
4.5
4.5.1
4.6
4.7
SYSTEM DESIGN....................................................................................................30
5.1
5.2
5.2.1
5.3
5.3.1
PROTEUS PRO..........................................................................................36
5.3.2
RESULT.............41
6.2
PROBLEMS FACED.............41
6.2.1
NON-AVAILIBILITY OF HARDWARE...................................................41
6.2.2
6.2.3
APPLICATIONS............44
7.2
FUTURE ENHANCEMENTS...........44
7.3
CONCLUSSION............44
APPENDIX A....................................................................................................................46
TIME ANALYSIS............46
APPENDIX B....................................................................................................................47
COST ANALYSIS............47
APPENDIX C....................................................................................................................49
SCHEMATICS..............49
APPENDIX D...................................................................................................................56
SOURCE CODE OF MICROCONTROLLER.....56
APPENDIX E....................................................................................................................61
LIST OF SMS COMMANDS SUPPORTED.......61
APPENDIX F....................................................................................................................62
DATASHEETS.............62
ADXL335..................................................................................................................62
GRAPHICAL LCD JHD240128...............................................................................64
GPS RECEIVER MODULE HOLUX GR-89..........................................................65
GSM MODULE SIM900D.......................................................................................67
LIST OF FIGURES
Figure 1-1 AVS System diagram........................................................................................3
Sir Syed University of Engineering & Technology
3
CHAPTER # 1
1.1
OVERVIEW
1.1.1
The modern technology in every field is all about making the life more convenient, safe
and secure for human beings, thus living up to this fact our project lies in making the car
way more convenient and user friendly.
Nowadays we are facing issues related to safety and security, where encountering them
needs professional expertise and such systems can lead to a great deal of expenditure.
Since the world is going through a phase of global recession, the system being developed
by us is going to be comparatively cost effective.
1.1.2
DESCRIPTION
The design of ADAPTIVE VEHICLE SYSTEM frees the car user from various tedious
tasks of performing checks on cars basic parameters along with providing intuitive
control system. More over the design features various nourished safeties and securities
simple to operate and easy to use.
Monitoring
Controlling
Safety
Security
Monitoring
Controlling
FigureFigure
1-1 AVS
1-1 System
Design Flow
diagram
Safety
1.1.3
Security
BACKGROUND
With the never ending efforts of making the car much efficient & powerful, same efforts
are also made to make it much Intuitive, Safe & Secured.
When using the word Intuitive, it is meat that Easy to use & understand. In this era,
everybody is busy & prefers many things over having to spend time, even if it means to
spend money to save time. There has been a race going on between Car industries, on
who makes the car as much easier & requiring less time to use & understand.
The numbers of car users are increasing at such a high rate each year, along with it,
issues of safety & security concerns are also on the rise. There been various solution of
security issue were & are being launched in the market, but many of them has been failed
either due to the lack in thinking ahead of the criminals or due to the such a high cost of
that solution.
1.2
MOTIVATION
Ideas that are innovative and incentive, challenges student and motivates them towards
the development of skills & knowledge. The knowledge acquired & the skills developed
Sir Syed University of Engineering & Technology
5
with the implementation of those ideas enhance the capabilities of an individual. Students
acquire various skills such as designing, problem-solving, communication, collaboration,
planning, and self- evaluation skills.
There is rapid advancement being made in the automobile industry and we are also
motivated towards in contributing towards such developments, giving an exponential rise
to the automobile industry in Pakistan. We also have in our mind the goal of making a
cost effective system.
1.3
METHODOLOGY
The methodology of our project will be Spiral Methodology, in which there are multiple
cycles of design, implementation and testing phase. The spiral methodology extends the
waterfall model by introducing prototyping. It is generally chosen over the waterfall
approach for large, expensive, and complicated projects.
1.3.1
DESIGN PHASE
In design phase, we analyzed several aspects of implementing our system in car and
defined an operational strategy of coordination between modules of our system. Circuit
modules were also designed in this phase.
1.4
IMPLEMENTATION PHASE
In this phase, designed circuits were first implemented initially on jigs & development
boards for further improvement and analyzing of the output of circuit/system. So that, if
there is any modification needed in the circuit, can be done easily before finalizing &
making PCBs. Coding for microcontroller was also done based on strategy defined in
design phase.
1.4.1
TESTING PHASE
In testing phase both software (of microcontroller) & hardware were tested & checked
thoroughly for bugs & error in worst-case scenarios. Errors & bugs were detected and
removed.
1.5
DESIGN FLOW
1.6
CONCLUSION
The scope and context of AVS was properly outlined. The particular line of action was
particularly defined for our convenience. All possible table work and calculation was
carried out before commencing the project. AVS was divided into three phases design,
testing and implementation respectively. The design flow of AVS was proposed.
Sir Syed University of Engineering & Technology
8
CHAPTER # 2
AVS FEATURES
2.1
AVS FEATURES
2.1.1
MONITORING FEATURES
LCD Display: Showing various Engine Basic Parameters, notifications & Alerts.
Touchpad: Let user easily interact with the system.
Engine Basic Parameters: includes following parameters which will be analyzed
2.1.2
CONTROLLING FEATURES
Automatic System Start-up: Upon detecting the entry of driving, system will
Power Windows Control: Power windows will be interfaced with the control
system, allowing flexible automatic control like, rolling-up the window
2.1.3
SAFETY FEATURES
Collision Detector: System will send instant emergency alert to user-defined
contact number, in case collision of car occurs.
Speed Limiter: Car owner will have an additional feature of limiting the speed of
car, ensuring the safety of car (from misshapen or accidents) along with
individuals other than the owner. Upon reaching the limit, owner will get a SMS
of over-speeding alert.
This feature is especially for the Parents who are worried for the safety of their
children.
Over Rev (Engine Revolution) Alert: Driver of the car will be notified upon over
revving the engine or upon the choice of owner, notification SMS will be sent.
2.1.4
SECURITY FEATURES
Anti-Theft/Dacoit System: Enhanced security features for car with the help of
GSM based communication. Featuring:
o Mobile (GSM SMS mode) communication between car & user
o SMS based various configurable alerts & notifications
o Tracking of Car via GPS (Global Positioning System)
Car/Engine Immobilizer: In case of theft or dacoit, car owner will have option to
completely immobilize the car, with a single SMS.
2.2
CONCLUSION
The features and key elements of AVS have been listed under their respective units of
AVS. Feedback and suggestions regarding AVS features were asked for from the internal
and members of FYP committee. The features have been elaborated in more detail in the
coming chapters.
CHAPTER # 3
SYSTEM EXPLANATION
3.1
SYSTEM OVERVIEW
AVS is divided into five units. Each unit is responsible for the operation and handling of
its respective set of features of AVS. The five units are
1)
2)
3)
4)
5)
3.2
Monitoring Unit
Control Unit
Safety Unit
Security Unit
Master Control Unit
OVERALL SYSTEM
SYSTEM EXPLANATIONS
Whole system is powered by the cars 12V battery and as system is divided into units,
where each unit handles corresponding set of features. So, in case of Security Unit, this
unit has an auxiliary power supply, of which source is 3.7V Lithium-Ion Battery. This
makes the security unit independent & more reliable such as for the case, cars battery is
drained due to any reason or if thieve tries to disconnect the battery to shut-off the
system. Removing/disconnecting the cars battery will make the security unit to switch to
its auxiliary power supply & will notify the car owner.
3.3.1
MONITORING UNIT
Monitoring unit acquires parameter like Raditor water level, battery water level, engine
temperature & radiator temperature. Data acquired by the sensors is processed by the
monitoring units microntroller and makes the data ready for the master control unit to
read.
3.3.2
CONTROL UNIT:
Control unit is responsible for performing the control (of accessories) operations
requested by user. Master control delivers the control commands to control units
microcontroller to perform specific operation like rolling up/down the window,
lock/unlock door and release the boot/fuel lid lock.
Feedback sensors, which are basically limit switches, are used to detect the upper &
lower limits of position of door locks & windows.
Reed switch is used as the limit switch for the windows, so that there is far less chances
of misaligment or damage of switch due to vibrations & shock.
Door lock actuators commonly used for electronic locking/unlocking of car door locks
are utilized to release the boot-lid and fuel-lid locks.
3.3.3
SAFETY UNIT:
Safety unit handles safety operation. Safety units microcontroller measures speed, RPM
of engine, acceleration of the car and does speed limiting operation.
Using accelerometer sensor module, ADXL335, safety unit monitors the acceleration
undergone by the car. This acceleration parameter is utilized to detect collision and
perform driving analysis.
RPM of the engine is measured by counting the pulses from the ignition coil, which gives
high voltages to spark plugs to cause ignition of fuel in engine cylinder.
Speed is measured by the counting the pulses coming out of the encoder which is
mounted on a rotating cable connected with gear box.
Speed limiting function is implemented by switching the power supply to ignition coil
which will controlled according to the speed of the car and the speed limit set by the user.
So whenever the car reaches the speed limit, safety unit will switch the ignition coils
power such that car will not be able to cross the speed limit.
3.3.4
SECURITY UNIT:
Security unit, most important part of AVS, does handles two primary operations:
1) Security of Car
2) Communication between car and user.
Security unit behaves as a slave device with respect to Master Control Unit but
independent of it. Means, it doesnt matter whether Master Control Unit is operational or
shut down, like due to attempt by theif to unarm/disable the security of car by
disconnecting car battery. Security unit will be operational and keep the car jammed in
such cases and user will still be able to maintain communication with the car.
Auxiliary battery power makes the security unit more reliable and makes sure that it
keeps operating even if in case car battery is disconnected or drained for any reason.
3.3.5
Master Control Unit controls the all the units of AVS and maintains coordination. It also
a means of communication between the units, like if Security unit receives command to
get the speed of the car it requests to get car speed status to Master Control Unit which
gets the info from Control unit and then gives back to Security unit.
Master Control Unit also handles the display, touchpad, flash memory (for data logging)
interface.
Graphic LCD is used for the display of various parameters for the user.
Touchpad is used for the interaction between the system and user as input device.
Flash memory, SD card is used for the data logging of the car.
3.4
CONCLUSION
The system block diagram of AVS has been demonstrated. The respective units of AVS
have been separately shown. It gives a clearer picture of the entire AVS. The system
operation of AVS is discussed in the next chapter.
CHAPTER # 4
SYSTEM OPERATION
4.1
Mentioned previously, how sets of features of AVS are handled by their respective unit.
Each unit performs the required operations and after the processing puts the relevant data
in to set of registers so that it can easily be read or modified by the master. In AVS,
master control unit gets relevant data from each unit by polling & update each unit with
new status or commands one by one.
4.2
For the communication between all units I2C (Inter-Integrated Communication) protocol
is selected. Adopting I2C protocol for the inter-modular communication was much
feasible for us to use. However, much better protocol like CAN bus could have been used
for better performance and reliability as it is done now in modern cars highly
sophisticated electronics integrated in the automobiles.
4.2.1
COMPARISON
SPI
I2C
CAN
Mode
Asynchronous
Full Duplex
Synchronous
Full Duplex
Synchronous
Half Duplex
Synchronous
Half Duplex
Low
Speed
Low
High Up to
Low
10Mbps
100kbps,400kbps,3.4Mbps
40kbps to
1Mbps
Error
No
No
No
Yes
No
No
No
Yes
Detection
Error
Correction
4.2.2
WHY I2C?
Only two wires needed for communication between as many as 121 devices.
I2C is much simpler in implementation than CAN bus.
No licensing required as it is in CAN bus.
Easier to configure.
Reasonable speed of data communication.
When powered on, this units microcontroller first initializes and updates the status of
windows and door locks, i.e. whether open or closed. Then it keeps checking whether
there is new command issued by the Master control unit to operate any of the requested
accessories. If any command is being issued, then control unit executes the command and
get back to its routine.
4.5.1
FUNCTION
The speed limiter will perform several times better if it is done by controlling the fuel
throttle of car instead of ignition system. But to do so, throttle will need to be electronic
rather than traditional mechanical one, like ones being implement new cars.
To make electronic throttle, direct mechanical link between accelerator pedal and fuel
valve, i.e. cable will be removed and a potentiometer will need to be installed at the pivot
of accelerator pedal so as to detect position of the pedal. Fuel valve will be controlled be
servo or stepper motor. System will monitor the position of accelerator pedal and control
the fuel valve accordingly, so it gives advantage to easily program the system to not to let
accelerate car more than the speed limit.
Start
No
Yes
No
Yes
Yes
No
Yes
No
Execute
Command
Sir Syed University of Engineering
& Technology
No
/Update Status
29
Yes
Execute
Command
/Update Status
4.8
CONCLUSION
The system operation of AVS has been discussed. The flow diagram explaining the
operation of each unit has been demonstrated separately. The reasons behind selecting
I2C
as
the
communication
protocol
have
CHAPTER # 5
SYSTEM DESIGN
been
clearly
discussed.
The project AVS basically involves only electronics and there is no mechanical
system/structure. The electronic structure of this project includes various components,
sensors and modules, which has made possible for us to get AVS function as required.
Accelerometer(ADXL335)
GPS Module(GR89)
Graphic LCD(JHD 241028)
GSM Module(SIM900D)
PIC Microcontrollers (PIC18F452 and 16f877A)
4 Wire Resistive TouchPanel
5.2.1
Following is the given discription and features of each component used in most
comprehensive way possible. Further information about each component can be acquired
from appendix D.
5.2.1.1
The ADXL335 is a small, thin, low power, complete 3-axis accel-erometer with signal
conditioned voltage outputs, with 300mV/g sensitivity. The product measures
acceleration with a minimum full-scale range of 3 g. it can measure the static
acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration
resulting from motion, shock, or vibration.
5.2.1.2
HOLUX GR-89 is a very low power GPS receiver module. It is tracks and gets the
location in longitude and latitude with the help of satellites. It is a 20 channel GPS
receiver which can track up to 12 satellites at a time.
It is used for Real time navigation, tracking and positioning.
5.2.1.3
JHD240128 is a monochrome graphic LCD with 240 x 128 pixels in the screen. It is
controlled by Toshibas T6963 GLCD controller, which lets user to interface and display
very easily with a set of commands and methods.
5.2.1.4
This is a complete Quad-band GSM/GPRS module in a SMT type and designed with a
very powerful single-chip processor integrating AMR926EJ-S core, allows to benefit
from small dimensions and cost-effective solutions.
It has very low power consumption, makes it ideal for battery powered devices.
Sim900D supports text mode for SMS and is controlled via AT commands.
5.2.1.5
PIC 18F452
PIC 16F877A
applications that benefits from the availibility several communcation modes. It is also
enriched with number of peripherals which saves lot of hardware, programming & time.
Resistive touch panels enables to sense and detect the touch by any object on the screen,
which lets user to select any option just by touching on the screen selecting an option.
Construction
Resistive touch panels are composed of two flexible sheets coated with a resistive
material and separated by an air gap or microdots. There are two different types of
metallic layers. The first one is Matrix, which is a striped electrodes on substrates such as
glass or plastic face each other. The second type of layer is Analogue which consists of
transparent electrodes without any patterning facing each other and Low production
costs. When contact is made to the surface of the touch panel, the two sheets are pressed
together.
5.3.1
PROTEUS PRO
ISIS is a powerful simulator, with it you can simulate digital circuits, analog circuits and
microprocessorbased circuits . It also has a virtual laboratory that contains an
oscilloscope, voltmeter,function generator etc. Now the updated version with practically
all the necessary components includes microcontrollers. In this version they have grown
beyond the component library also gave an improvement in the program.
ISIS has been created with this in mind. It has evolved over twelve years of research and
development, and has been proven by thousands of users worldwide. The strength of its
architecture allows us to integrate conventional graph based simulation and now with
PROTEUS VSM interactive circuit simulation into the design enviornment. For the
Sir Syed University of Engineering & Technology
36
first time ever it is possible to draw a complete circuit for a microcontroller based system
and then test it interactively , all from within the same piece of software. Meanwhile,
ISIS retains a host of features aimed at the PCB designer, so that the same design can be
exported for production with ARES or other PCB layout software.
circuits.
Design Global Annotation allowing multiple instances of a sub-circuit to have
5.3.2
The MikroC PRO for PIC is a powerful, feature-rich development tool for PIC
microcontrollers. It is designed to provide the programmer with the easiest possible
solution to developing applications for embedded systems, without compromising
performance or control.
PIC and C fit together well: PIC is the most popular 8-bit chip in the world, used in a
wide variety of applications, and C, prized for its efficiency, is the natural choice for
developing embedded systems. MikroC PRO for PIC provides a successful match
featuring highly advanced IDE, ANSI compliant compiler, broad set of hardware
libraries, comprehensive documentation, and plenty of ready-to-run examples.
FEATURES:
MikroC PRO for PIC allows you to quickly develop and deploy complex
applications:
Write your C source code using the built-in Code Editor (Code and Parameter
Assistants, Code Folding, Syntax Highlighting, Auto Correct, Code Templates,
and more.)
Use included MikroC PRO for PIC libraries to dramatically speed up the
development: data acquisition, memory, displays, conversions, communication
etc.
Monitor your program structure, variables, and functions in the Code Explorer.
Generate commented, human-readable assembly, and standard HEX compatible
Simulator.
Generate COFF (Common Object File Format) file for software and hardware
5.4
CONCLUSION
The function and operation of major hardware modules and software tools used in AVS
have been briefly discussed and shown in the report for better understanding and learning
of the tools that contributed a major part in achieving the overall goal of the system.
CHAPTER # 6
6.1
RESULT
We managed to achieve our goals in making the AVS. Whole system was operating as
expected. All the features were tested to be working alright. Sending commands via SMS
were resulting in execution of operation as per programmed. There was a minor error in
the speed measurement & speed limiting function was causing minor jerks, whenever it
got active, i.e. when speed of the car tries to get higher than speed limit set by the user.
If we were to repeat the project from scratch, we would do few things differently. Like,
Implementing better method of speed limitation, using higher resolution of GLCDs,
design of PCBs with extra noise immunity etc.
6.2
6.2.1
PROBLEMS FACED
NON-AVAILIBILITY OF HARDWARE
A common issue, due to which lot of time is wasted in searching for the part, ordering &
waiting for the shipment. This issue leaves one with no choice but to use the only
hardware available in the market.
6.2.2
There were complications in defining and making the strategy for the operation of each
unit. Whole system operation, on software part, was either changed or modified many
times to get the system working as per required that cost a huge amount of time.
6.2.3
A critical issue occurred which also caused lot of time and cost to resolve it. Noises and
interferences generated by the cars ignition system and alternater were causing huge
Electromagnetic Interfernce (EMI). Due to induction of EMI and EMI inducing on any of
the nearby circuits was cauing generation of high voltages which resulted in
Oscillator hangup
Reseting of micrcontroller
Corruption of code memory of micrcontroller
Corruption of EEPROM of microcontroller
False hardware interrupts generation
Damaging LCD due to high voltage generation
Following methods were used to reduce induction of EMI, which were proved to be very
much effective:
CHAPTER # 7
7.1
APPLICATIONS
The basic application of the AVS are its features itself. However, AVS is a low cost
solution to mentioned features, which can be implemented in every car with some
required specifications. AVS can also be implemented in cars during manufacturing with
customized, special configurations & enhanced features.
7.2
FUTURE ENHANCEMENTS
7.3
CONCLUSION
AVS makes automobile much more convenient, reliable, safer & secure, along with much
intuitive control & access to car. AVS can be enhanced with the addition of further more
features. It would be worth spending money on AVS.
Major problem faced in AVS was of noise produced by the ignition system of car
resulting in malfunctioning of operation of system and even causing damage to hardware.
So it is important to design the system with capability to be safe from noises produced
Sir Syed University of Engineering & Technology
43
with in the car by ignition system and alternator and should ensure reliable operation of
whole system.
APPENDICE
APPENDIX A
APPENDIX A
TIME ANALYSIS
It took approximately 6 months with average of 3-4hrs/day to finalize the project. With
the design of AVS as being divided into units, so time analysis according to different
phases or working on unit is shown in GANTT chart below.
APPENDIX C
APPENDIX B
COST ANALYSIS
The total approximate cost of the project has been Rs. 46500/=
Cost listing of items is given below:
S.No.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Items
Graphic LCD T240128
Graphic LCD JHD240128
ADXL335
SIM900D
Holux GR-89
4-Wire Resistive Touch Panel
RF Modules
SD Card 1Gb
Door Lock Actuators
x7
PIC16F877A
x 11
PIC18F452
x8
DS1307
Other ICs
Wires / Cables
Various pins / Connectors
Electric Tapes
x 12
Glue / Adhesives
Relay 12v 22A
x7
Relay 12v 10A
x 12
PCB Copper boards
Vero boards
Ferric Chloride
Photo paper
Soldering wire
Modules soldering labor
Door lock installation labor
High resistance spark plug cables
Spark plugs
Rubber pipe for shielding
Foil paper
USB to Serial cables
x2
Cost (Rs.)
1400
3500
3300
3300
3000
2000
4750
550
1000
2750
2800
120
2000
2900
800
240
300
480
900
1500
400
300
600
600
200
700
900
600
500
150
850
APPENDIX C
31
32
33
34
34
35
36
37
38
750
500
400
500
500
3000
1400
1500
3000
APPENDIX C
SCHEMATICS
Security Module Circuit
APPENDIX C
APPENDIX C
APPENDIX C
APPENDIX C
APPENDIX C
C-2 Snapshot of GPS circuit
APPENDIX C
APPENDIX C
C-4 Snapshot of GLCD Display + Touchscreen
APPENDIX D
APPENDIX D
SOURCE CODE OF MICROCONTROLLER
Security Unit
sbit pwr_key at PORTd.B0;
sbit status_gsm at portd.b1;
sbit rid at portb.b0;
sbit sel_dev at portd.b2;
// = 0, Device = GSM && =1, Device = GPS
sbit lock1 at portb.b1;
sbit lock2 at portb.b2;
sbit lock3 at portb.b3;
sbit lock4 at portb.b4;
const Addy = 0x68;
const char arr [40][18]={"freeze.","ready.","lock o.","lock c.","lock s.",
"engine o.","engine c.","engine s.","window o.",
"window c.","window s.","lights o.","lights c.",
"lights s.","speed s.","loc s.","drive s.",
"user s.","status o.","talk.","unjam.","boot o.","fuellid o."};
const char sms_resp[30][25]={"Done!.","locks open.","locks closed.","engine on.",
"engine off.","window open.","window closed.",
"car speed = .","driving Analysis = .","lights on.",
"lights off.","user = ."};
const char resp [15][15]={"OK\r\n","ERROR\r\n"};
const char at_cmds[20][22]={"AT\r\n","ATE0\r\n","AT+CMGF=1\r\n",
"AT+CMGR=1\r\n", "AT+CMGDA=\"DEL ALL\"\r\n","AT+CMGS=\"","\z"};
const char *gps_cmds0="$PSRF100,1,9600,8,1,0*0D\r\n"; //SET BAUDRATE=9600
const char *gps_cmds1="$PSRF103,00,00,00,01*24\r\n"; //disable GGA msg rate
const char *gps_cmds2="$PSRF103,01,00,00,01*25\r\n"; //disable GLL msg rate
const char *gps_cmds3="$PSRF103,02,00,00,01*26\r\n"; //disable GSA msg rate
const char *gps_cmds4="$PSRF103,03,00,00,01*27\r\n"; //disable GSV msg rate
const char *gps_cmds5="$PSRF103,04,00,00,01*20\r\n"; //disable RMC msg rate
const char *gps_cmds6="$PSRF103,05,00,00,01*21\r\n"; //disable VTG msg rate
const char *gps_gll="$PSRF103,01,01,00,01*24\r\n"; //Query GLL msg
unsigned int compare
unsigned char rx_data
void
tx_atcmd
void
discard_rx
void
init
APPENDIX D
void
buffer_resp
(unsigned int l_cmds);
void
clear_buff_rx
(void);
unsigned int compare_resp
(unsigned int n_cmds,unsigned int l_cmds);
void
check_get_sms_cmd (void);
void
init_gps
(void);
void
get_gps_data
(void);
void
update_status
(void);
void
process_status
(void);
void
send_sms
(void);
void
freeze_car
(unsigned short i);
unsigned char master_pass[4];
unsigned char sender_specific[13];
unsigned char cmd_sender[13];
unsigned char longi_data[]="12345.0000,E";
unsigned char lati_data[]="1234.0000,N";
unsigned short int speed=205;
unsigned short int speed_limit=30;
unsigned short int status1=0x00;
unsigned short int status2=0;
unsigned short int cmd2master1=0;
unsigned short int cmd2master2=0x00;
unsigned short int car_user=0;
unsigned short int cid=0; //Command ID , info ID request by Master in I2C comm.
unsigned char
m_data;
/* RU */
unsigned short int pos=0,l=0,ni=0;
unsigned int
i=0,j=0,k=0;
unsigned short int flag=0;
unsigned short int buff_i2c;
unsigned short int mbi_i2c=0; //multi_bytes_index_ for i2c
unsigned char
rec[20]; // for response buffering
unsigned char
buff_sms[40]; // for sms compilation buffering
unsigned char
buff_short2str[5]; //for speed (n other) short int conversion buffer
unsigned int
e_wr,e_rd;
void main(void){
init();
sel_dev=0; //gsm
if (status_gsm)
{
pwr_key = 1; //->
delay_ms(1000); //-> Powering on GSM module
pwr_key = 0; //->
}
init_gps(); // initializing GPS module
delay_ms(4000); // waiting for GSM to register with network
uart1_init(9600);
tx_atcmd(0); // sending (testing) with "AT"
APPENDIX D
buffer_resp(20); //excluding the <CR><LF> in the beginning
delay_ms(100);
clear_buff_rx();
tx_atcmd(1); // disabling command echo with "ATE0"
discard_rx(12); //discarding the response
flag=compare_resp(15,12); //checking response whether OK received or not?
tx_atcmd(2); // changing GSM to "Text mode"
discard_rx(6); // discarding response
tx_atcmd(4); // delete all messages in GSM Module
discard_rx(6); //discard response
for (ni=0; ni<4; ni++) // load master password from EEPROM , Add=0x00
{
master_pass[ni] = EEPROM_Read(0x00+ni);
delay_ms(21);
}
for (ni=0; ni<13; ni++) // load cmnd sender no. (for restriction to single mobile number)
from EEPROM , Add=0x00
{
sender_specific[ni] = EEPROM_Read(0x06+ni);
delay_ms(21);
}
while(1)
{
portb.b0=!portb.b0; //debugger
get_gps_data();
check_get_sms_cmd();
process_status();
delay_ms(600);
}
} //End of main program
// Interrupt Serivce Routines /////
void interrupt()
{
if (PIR1.SSPIF == 1)
// I2C Interrupt
{ portb.b7=!portb.b7; //debugger
PIR1.SSPIF = 0;
//Receiev request.transmit data to master
if (SSPSTAT.R_W == 1)
{
// Read request from master
if (cid==0)
{ SSPBUF = 0x00;//tx_data;
// Get data to send
cid=0;
APPENDIX D
}
if (cid==45){ SSPBUF = cmd2master1; cid=0; cmd2master1=0;}
if (cid==46){ SSPBUF = cmd2master2; cid=0; cmd2master2=0;}
if (cid==47){ SSPBUF = speed_limit; cid=0; }
if (cid==48)
{
SSPBUF = longi_data[mbi_i2c];
mbi_i2c++;
if (mbi_i2c==12){ mbi_i2c=0; cid=0; }
}
if (cid==49)
{
SSPBUF = lati_data[mbi_i2c];
mbi_i2c++;
if (mbi_i2c==11){ mbi_i2c=0; cid=0; }
}
if (cid==50)
{
SSPBUF = cmd_sender[mbi_i2c];
mbi_i2c++;
if (mbi_i2c==13){ mbi_i2c=0; cid=0; }
}
if (cid==51)
{
SSPBUF = sender_specific[mbi_i2c];
mbi_i2c++;
if (mbi_i2c==13){ mbi_i2c=0; cid=0; }
}
SSPCON1.CKP = 1;
buff_i2c = SSPBUF;
return;
}
if (SSPSTAT.BF == 0)
{
// all done,
j = SSPBUF;
return;
}
APPENDIX D
{
cid=SSPBUF; // if no command has previously been issued by master. then the byte
received is taken as CID ,for info exchange request of specific data
goto FIN_I2C
}
// if CID <64 , then master is requesting slave to send data corresponding to CID
// if CID >64 , then master is requesting slave to receive command/status bytes.
if (cid==65) { status1 = SSPBUF; cid = 0; }
if (cid==66) { status2 = SSPBUF; cid = 0; }
if (cid==67) { speed = SSPBUF; cid = 0; }
if (cid==68)
{
master_pass[mbi_i2c] = SSPBUF;
mbi_i2c++;
if (mbi_i2c==4){ mbi_i2c=0; cid=0; }
}
if (cid==69)
{
sender_specific[mbi_i2c] = SSPBUF;
mbi_i2c++;
if (mbi_i2c==13){ mbi_i2c=0; cid=0; portb.b6=!portb.b6; }
}
FIN_I2C:
j = SSPBUF;
return;
}
}
buff_i2c = SSPBUF;
} // Enf of Interrupt Serivce Routine //
APPENDIX E
LIST OF SMS COMMANDS SUPPORTED
Command Syntax: <command><full stop>
O = open / on
C = close / off
S = Get status
List of commands:
1
2
3
freeze.
unjam.
ready.
APPENDIX D
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
lock o.
lock c.
lock s.
engine o.
engine c.
engine s.
windows o.
windows c.
windows s.
speed s.
loc s.
drive s.
lights o.
lights c.
lights s.
user s.
status o.
talk.
Lock open
Lock close
Lock status
Engine open
Engine close
Engine status
Windows open
Windows close
Windows status
Speed status
Location status
Driving status
Lights on
Lights close
Lights status
User status
User status
Send message to car, car will call the mobile by which
message have received.
APPENDIX F
DATASHEETS
APPENDIX D
ADXL335
APPENDIX D
APPENDIX D
APPENDIX D
APPENDIX D
APPENDIX D
GR-89
APPENDIX D
APPENDIX D
APPENDIX D
Software features
* 0710 MUX protocol
* embedded TCP/UDP protocol
* FTP/HTTP( available at July ,2010)
* FOTA ( available at July ,2010)
* MMS (available at July ,2010)
* Embedded AT (available at
Q3,2010)
Specifications for Voice
* Tricodec
Half rate (HR)
Full rate (FR)
Enhanced Full rate (EFR)
Half rate (HR)
Full rate (FR)
Interfaces
* Interface to external SIM 3V/ 1.8V
* analog audio interface
* RTC backup
* SPI interface (option)
* Serial interface
* Embedded SIM (option )
* Antenna pad
* GPIO
* ADC
* Charge interface for Li battery
* PWM
Compatibility
* AT cellular command interface
APPENDIX D
Pic16f877a
APPENDIX D
APPENDIX D
APPENDIX D
PIC18F452
APPENDIX D
Pin outs of PIC18F452
REFERENCES
REFERENCES
Articles
[1]
Parallex inc. & Nuts and Volts - Graphical Liquid Crystal Display
[2]
[3]
[4]
[5]
[6]
Books
[7]
[8]
Internet
[9]
REFERENCES
[10]
[11]
[12]
[13]
[14]
http://www.simplify-technologies.de/lcd_modules/index.html
[15]
[16]
SD Card Interfacing
http://www.electro-tech-online.com/microcontrollers/29648-sd-cardinterfacing.html
[17]
Sparksfun ADXL335
http://www.sparkfun.com/products/9269