Vehicle Black Box Final Report

111
CHAPTER-1

Transcript of Vehicle Black Box Final Report

Page 1: Vehicle Black Box Final Report

CHAPTER-1

Page 2: Vehicle Black Box Final Report

Vehicle black box SNG-EC

INTRODUCTION

In the present day everyone are running behind speed all want to come first.

In such sceneries accident are increasing. Daily May new vehicles are being added

On the road. This also increases the amount of accident. There won’t be a day on

which there is no death due to road accident? Many are being enforced to reduce

accidents but none of them have been able to stop them, but they are only able to

decrease them to an extent. The highway safety association in Europe and America

has been planning to implement some devices into vehicles which would safe

guard the interest of the passengers. The motor giant general motors have initiated

many research and developmental activities in this regard. The vehicles are fitted

with airbags, anti-lock breaking system and many such things. But in order to do

any research or development there is a need for the knowledge of the real cause of

the accident. The accident may occur due to the mistake of others or the problems

in the working of the vehicle such as break failure or fire accident.

The presently available features which are incorporated into vehicles are

GPS, tracking and mapping. The European Union and America are planning

to incorporate certain data loggers into vehicles which would record the vehicle

2

Page 3: Vehicle Black Box Final Report

Vehicle black box SNG-EC

parameters. The IEEE has also introduced some standards in this regard. The

system proposed to be like a black box which logs implementation inside the

vehicles and the performance of the vehicles. The proposal of the IEEE association

is audio and video logging and engine parameters such as the temperature brake

conditions, sharp turn, torque of the vehicle etc. this is analogous to a black box

billion dollar aircraft industry is affordable such costly devices cannot be

incorporated into a car as such systems will cost more than the car itself. Moreover

there is no alert system. So we made an initiative to design a data logger as an

emergency alert system. This initiative was made because of delayed medical help

and relief. We also kept in mind as to decrease the cost so as to make it affordable

to vehicle of all ranges. Our data logger logs the conversation and voice inside the

cabin and also the location. The accident is sensed for the fire accidents and

physical collision and when such an accident occurs an alert message is sent to

pre-stored mobile number.

Our system can be also further expanded by adding up many more sensors

such as vibration sensors, gas sensors. This can also be incorporated with GPS

mapping to find out the way. There is a video recording option but since it costly it

can only be incorporated in to high end cars.

3

Page 4: Vehicle Black Box Final Report

Vehicle black box SNG-EC

CHAPTER -2

4

Page 5: Vehicle Black Box Final Report

Vehicle black box SNG-EC

BLOCK DIAGRAM

S1- PRESSURE SENSER

5

Page 6: Vehicle Black Box Final Report

Vehicle black box SNG-EC

Fig 1. BLOCK DIAGRAM- VEHICLE BLACK BOX

BLOCK DIAGRAM EXPLANATION

MICROCONTROLLER

PIC16f873 is the brain of the entire system. This RISC controller, which

is accounted as one of the most popular general purpose microcontrollers, acts as

a control unit. The functions of the controller may be briefed as follows

Receiving the RF-id code from the authorized branch and cross-checking it with

the database in its data memory Sending text message “travel started” through

the GSM modem connected to its serial communication peripheral on receiving

the correct code.

Receiving GPS co-ordinates on reception of text message” where” from a GSM

number, requesting the location of the money carrier

USER MOBILE

User can get the alert message of accident. The alert message includes the

location where the accident occurred.

GPS MODULE

GPS module is used to receive the GPS values from the satellite. The values are

continuously sent to the microcontroller for storage

6

Page 7: Vehicle Black Box Final Report

Vehicle black box SNG-EC

APR 9600

Sound record/playback IC. Used to record the sounds inside the cabin, one

minute prior to the accident. This helps to understand the real cause of the

accident right from the speech of the people inside

LCD DISPLAY

Displays the location of where the accident occurred. This starts execution once

the data retrieve button is pressed after the module is recovered from the

accident affected vehicle.

GSM MODEM

The GSM modem is used to send alert message to the centers.

LCD MODULE

This module has two main lines. Control lines and data lines. The

control lines and the data lines are connected to PORTB. The 10K trim

potentiometer connected to the Contrast pin of the LCD is used to adjust the

contrast of the display. The LCD display is used to display the saved GPS location,

once the ‘Black Box’ module is retrieved from the affected vehicle. GPS and the

GSM modules are connected across a relay since there is only one serial

communication module for the controller and all the modules need to be connected

to the same peripheral. On an accident case, the GSM module sends the alert

message after receiving the GPS location

7

Page 8: Vehicle Black Box Final Report

Vehicle black box SNG-EC

CHAPTER -3

8

Page 9: Vehicle Black Box Final Report

Vehicle black box SNG-EC

CIRCUIT DIAGRAM

9

Page 10: Vehicle Black Box Final Report

Vehicle black box SNG-EC

Fig 2. CIRCUIT DIAGRAM OF VEHICLE BLACK BOX

CIRCUIT EXPLANATION

Power supply

The target board is powered by a 5V power supply. The power

supply is designed such that, an AC or DC voltage from the range 7V to 24V may

be given as input. The components used in the supply design are

a. 12-0-12/1A step down transformer

b. Bridge package – used for AC to DC conversion ( null effect when

DC supply is used)

c. L7805 voltage regulator – used to give a regulated 5V output

d. 1000µF capacitor acts as a filter circuit.

+ C132200mfd

12

+ C11

2200mf

+ C1210mfd

12

D7

1N4007

1 2230V

D8

1N4007

1 2

T1

12-0-12v/1A

1 5

6

4 8

D6

1N4007

1 2

VCCU5L7805/TO220

1

3

2VIN

GND

VOUT230V

+12V

D10

1N4007

1 2

10

Page 11: Vehicle Black Box Final Report

Vehicle black box SNG-EC

Fig.3 POWER SUPPLY

PIC 16F873A

It is the brain of the entire system. This RISC controller, which is accounted

as one of the most popular general purpose microcontrollers, acts as a control unit.

The functions of the controller may be briefed as follows Receiving the RF-id code

from the authorized branch and cross-checking it with the database in its data

memory Sending text message “accident occurred” through the GSM modem

connected to its serial communication peripheral on receiving the correct code.

Receiving GPS co-ordinates on reception of text message ” track” from a GSM

number, requesting the location of the money carrier. It also coordinates the

functioning of all the modules and takes the required steps when accident occurs.

The PIC is programmed according to our needs using appropriate programming

software and programmers.

11

Page 12: Vehicle Black Box Final Report

Vehicle black box SNG-EC

Fig4. PIN CONFIGURATION

APR 9600 VOICE RECORD/PLAYBACK IC

The figure shows the device configured in random access mode. The device

is using eight message segments, the maximum available, in this mode. Note that

message trigger pins that are not used, for modes with less than eight segments, can

be left unconnected with the exception of pin/M8_Option which should be pulled

to VCC through a 100K resistor.

Fig 5. APPLICATIONAL DIAGRAM FOR APR 9600

12

Page 13: Vehicle Black Box Final Report

Vehicle black box SNG-EC

MAX 232

The MAX232 also known as line driver is an integrated

circuit that converts signals from an RS-232 serial port to signals suitable for use

in TTL compatible digital logic circuits. The MAX232 is a dual driver/receiver and

typically converts the RX, TX, CTS and RTS signals. The drivers provide RS-232

voltage level outputs (approx. ± 7.5 V) from a single + 5 V supply via on-

chip charge pumps and external capacitors. This makes it useful for implementing

RS-232 in devices that otherwise do not need any voltages outside the 0 V to + 5 V

range, as power supply design does not need to be made more complicated just

for driving the RS-232 in this case.

Fig.6 CIRCUIT DIAGRAM

13

Page 14: Vehicle Black Box Final Report

Vehicle black box SNG-EC

GPS MODULE

Latina’s GGM309U GPS Receiver provides various applications such as car

navigating, marine navigating, mapping, surveying, security, agriculture and so on.

It communicates with device (such as pocket PC or notebook) via compatible dual

channel through RS-232 or TTL and satellite data by built in backup memory.

Further more, GGM309U can track up to 20 satellite at a time, re-acquire satellite

signals in 100ms and update position data every second.

GSM MODULE

The GSM Module is a simple internal circuit of a mobile which can insert a

SIM in itself and send a message. In this particular project the usage can be with a

GSM module or even a mobile handset. For convenience we are using a mobile

handset with a data cable.

4 MHz Crystal oscillator

Crystal oscillator is used to provide oscillation frequency to the PIC micro

controller.

Tosc = 0.25Fosc

Tosc = Time period required for one oscillation

Fosc= frequency of crystal oscillator

14

Page 15: Vehicle Black Box Final Report

Vehicle black box SNG-EC

WORKING OF CIRCUIT

The circuit in the normal working mode continuously collects the GPS data, through the serial communication peripheral of the PIC µC. The GPS data is received in NMEA protocol, which is a set of rules followed in representing the various GPS data parameters. The driver code in the µC, filters out the data that are not of concern to the working and saves the data string that contains the latitude and longitude of the GPS modem location. This process is done continuously. Parallel to the process, the APR9600 IC that works in the record mode, records the sound inside the cabin. The APR is controlled by the µC port pins.

When an accident condition is detected: ie. When a gas leakage or an over temperature is detected, the microcontroller does two process in parallel. The controllers send control to the APR to stop recording. The GPS location reception is also stopped and the current location in saved. An emergency alert system also comes into life

On retrieving the black box: the retrieve button in the module needs to be hit to push the module to data retrieve mode. On triggering the “Retrieve” button, the APR IC is changed to play-back mode and plays the sound inside the cabin from one minute prior to the accident to understand the possible reason.. The same method is successfully used in the cockpit of the aircraft to through more light into the possible reason the craft is in trouble from the pilots conversation with his co.

15

Page 16: Vehicle Black Box Final Report

Vehicle black box SNG-EC

CHAPTER -4

16

Page 17: Vehicle Black Box Final Report

Vehicle black box SNG-EC

HARDWARE

PIC MICROCONTROLLER 16F873A

The PIC microcontroller family is manufactured by Microchip Technology

Inc. Currently they are one of the most popular microcontrollers, used in many

commercial and industrial applications. Over 120 million devices are sold each

year. The PIC microcontroller architecture is based on a modified Harvard RISC

(Reduced Instruction set Computer) instruction set with dual-bus architecture,

providing fast and flexible design with an easy migration path from only 6 pins to

80 pins, and from 384 bytes to 128 kbytes of program memory.

The PIC is the small computer

The PIC, like the CPU, has calculation functions and memory, and is

controlled by the software. However, the throughput and the memory capacity are

low. Depending on the kind of PIC, the maximum clock operating frequency is

about 20 MHz and the memory capacity (to write the program) is about 1K to 4K

words. The clock frequency determines the speed at which a program is read and

an instruction is executed. The throughput cannot be judged with the clock

frequency alone. It changes with the processor architecture. However within the

same architecture, the one with the highest clock frequency has the highest

throughput. 14-bit WORD is the program memory capacity. An instruction is a

word long. Program memory is measured in BYTES, one byte is 8 bits. The bit is

the smallest unit, and can have the value of 1 or 0. The instruction word of the

PIC16F87X is composed of 14 bits.

17

Page 18: Vehicle Black Box Final Report

Vehicle black box SNG-EC

Applications

PIC16F873A perfectly fits many uses, from automotive industries and

controlling home appliances to industrial instruments, remote sensors, electrical

door locks and safety devices. It is also ideal for smart cards as well as for battery

supplied devices because of its low consumption.

EEPROM memory makes it easier to apply microcontrollers to devices

where permanent storage of various parameters is needed (codes for transmitters,

motor speed, receiver frequencies, etc.). Low cost, low consumption, easy handling

and flexibility make PIC16F873A applicable even in areas where microcontrollers

had not previously been considered (example: timer functions, interface

replacement in larger systems, coprocessor applications, etc.).

ARCHITECTURE OF PIC16F873A

Fig 10 ARCHITECTURE OF PIC16F873A

18

Page 19: Vehicle Black Box Final Report

Vehicle black box SNG-EC

FEATURES

Core Features

High-performance RISC CPU

Only 35 single word instructions to learn

All single cycle instructions except for program branches which are two

cycle

Operating speed: DC - 20 MHz clock input DC - 200 ns instruction cycle

Up to 8K x 14 words of FLASH Program Memory,

Up to 368 x 8 bytes of Data Memory (RAM)

Up to 256 x 8 bytes of EEPROM data memory

Interrupt capability (up to 14 sources)

Eight level deep hardware stack

Power-on Reset (POR)

Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable

operation

Programmable code-protection

Power saving SLEEP mode

Selectable oscillator options

Low-power, high-speed CMOS FLASH/EEPROM technology

Wide operating voltage range: 2.0V to 5.5V

Commercial and Industrial temperature ranges

Low-power consumption:

- < 2 mA typical @ 5V, 4 MHz

- 20 mA typical @ 3V, 32 kHz

- < 1 mA typical standby current

19

Page 20: Vehicle Black Box Final Report

Vehicle black box SNG-EC

I/O PORTS

Some pins for these I/O ports are multiplexed with an alternate function for

the peripheral features on the device. In general, when a peripheral is enabled, that

pin may not be used as a general purpose I/O pin.

PORTA and the TRISA Register

PORTA is a 6-bit wide, bidirectional port. The corresponding data direction

register is TRISA. Setting a TRISA bit (= 1) will make the corresponding PORTA

pin an input (i.e., put the corresponding output driver in a High Impedance mode).

Clearing a TRISA bit (= 0) will make the corresponding PORTA pin an output

(i.e., put the contents of the output latch on the selected pin). Reading the PORTA

register reads the status of thepins, whereas writing to it will write to the port latch.

All write operations are read-modify-write operations.

PORTB and the TRISB Register PORTB is an 8-bit wide, bidirectional port. The corresponding data

direction register is TRISB. Setting a TRISB bit (= 1) will make the corresponding

PORTB pin an input (i.e., put the corresponding output driver in a High-Impedance

mode). Clearing a TRISB bit (= 0) will make the corresponding PORTB pin an

output (i.e., put the contents of the output latch on the selected pin). Three pins of

PORTB are multiplexed with the In-Circuit Debugger and Low-Voltage

Programming function: RB3/PGM, RB6/PGC and RB7/PGD. Each of the PORTB

pins has a weak internal pull-up. A single control bit can turn on all the pull-ups.

This is performed by clearing bit RBPU (OPTION_REG<7>).

20

Page 21: Vehicle Black Box Final Report

Vehicle black box SNG-EC

PORTC and the TRISC RegisterPORTC is an 8-bit wide, bidirectional port. The corresponding data direction

register is TRISC. Setting a TRISC bit (= 1) will make the corresponding PORTC

pin an input (i.e., put the corresponding output driver in a High-Impedance mode).

Clearing a TRISC bit (= 0) will make the corresponding PORTC pin an output (i.e.,

put the contents of the output latch on the selected pin). PORTC is multiplexed

with several peripheral functions. PORTC pins have Schmitt Trigger input buffers.

When the I2C module is enabled, the PORTC<4:3> pins can be configured with

normal I2C levels, or with SMBus levels, by using the CKE bit

(SSPSTAT<6>).When enabling peripheral functions, care should be taken in

defining TRIS bits for each PORTC pin.

ANALOG-TO-DIGITALCONVERTER (A/D) MODULEThe Analog-to-Digital (A/D) Converter module has five inputs for the 28-pin

devices and eight for the 40/44-pindevices.The conversion of an analog input

signal results in a corresponding 10-bit digital number. The A/D module has high

and low-voltage reference input that is software selectable to some combination of

VDD, VSS, RA2or RA3.The A/D converter has a unique feature of being able to

operate while the device is in Sleep mode. To operate in Sleep, the A/D clock must

be derived from the A/D’s internal RC oscillator.

The A/D module has four registers. These registers are:

• A/D Result High Register (ADRESH)

• A/D Result Low Register (ADRESL)

• A/D Control Register 0 (ADCON0)

• A/D Control Register 1 (ADCON1)

21

Page 22: Vehicle Black Box Final Report

Vehicle black box SNG-EC

APR 9600(AUDIO PLAYBACK/RECORD)

General DescriptionThe APR9600 device offers true single-chip voice recording, non-volatile storage,

and playback capability for 40 to 60 seconds. The device supports both random and

sequential access of multiple messages. Sample rates are user-selectable, allowing

designers to customize their design for unique quality and storage time needs.

Integrated output amplifier, microphone amplifier, and AGC circuits greatly

simplify system design. The device is ideal for use in portable voice recorders,

toys, and many other consumer and industrial applications. APLUS integrated

achieves these high levels of storage capability by using its proprietary

analog/multilevel storage technology implemented in an advanced Flash non-

volatile memory process, where each memory cell can store 256 voltage levels.

This technology enables the APR9600 device to reproduce voice signals in their

natural form. It eliminates the need for encoding and compression, which often

introduce distortion.

Functional DescriptionThe APR9600 block diagram is included in order to give understanding of

the APR9600 internal architecture. A differential microphone amplifier, including

integrated AGC, is included on-chip for applications requiring its use. The

amplified microphone signal is fed into the device by connecting the Ana_Out pin

to the Ana_In pin through an external DC blocking capacitor. Recording can be fed

directly into the Ana_In pin through a DC blocking capacitor, however, the

connection between Ana_In and Ana_Out is still required for playback. The next

block encountered by the input signal is the internal anti-aliasing filter. After anti-

aliasing filtering is accomplished the signal is ready to be clocked into the memory

array. This storage is accomplished through a combination of the Sample and Hold

circuit and the Analog Write/Read circuit. These circuits are clocked by either the

22

Page 23: Vehicle Black Box Final Report

Vehicle black box SNG-EC

Internal Oscillator or an external clock source. When playback is desired the

previously stored recording is retrieved from memory, low pass filtered, and

amplified as shown on the right hand side of the diagram. The signal can be heard

by connecting a speaker to the SP+ and SP- pins. Chip-wide management is

accomplished through the device control block shown in the upper right hand

corner. Message management is controlled through the message control block

represented in the lower center of the block diagram. More detail on actual device

application can be found in the Sample Applications section. More detail on

sampling control can be found in the Sample Rate and Voice Quality section. More

detail on message management and device control can be found in the Message

Management section

ARCHITECTURE

23

Page 24: Vehicle Black Box Final Report

Vehicle black box SNG-EC

Fig 12 APR BLOCK DIAGRAM

Features• Single-chip, high-quality voice recording & playback solution

- No external ICs required

- Minimum external components

• Non-volatile Flash memory technology

- No battery backup required

• User-Selectable messaging options

- Random access of multiple fixed-duration messages

- Sequential access of multiple variable-duration messages• User-friendly, easy-to-

use operation

- Programming & development systems not required

- Level-activated recording & edge-activated playback switches

Message Management

General DescriptionPlayback and record operations are managed by on chip circuitry. There are

several available messaging modes depending upon desired operation. This

message modes determine message management style, message length, and

external parts count. Therefore, the designer must select the appropriate operating

mode before beginning the design. Operating modes do not affect voice quality; for

information on factors affecting quality refer to the Sampling Rate & Voice Quality

section.

• Random access mode with 2, 4, or 8 fixed-duration messages

• Tape mode, with multiple variable-duration messages, provides two options:

- Auto rewind

- Normal

Modes cannot be mixed. Switching of modes after the device has recorded an

initial message is not recommended. If modes are switched after an initial 24

Page 25: Vehicle Black Box Final Report

Vehicle black box SNG-EC

recording has been made some unpredictable message fragments from the previous

mode may remain present, and be audible on playback, in the new mode. These

fragments will disappear after a record operation in the newly selected mode. Table

1 defines the decoding necessary to choose the desired mode. An important feature

of the APR9600 message management capabilities is the ability to audibly prompt

the user to changes in the device’s status through the use of “beeps” superimposed

on the device’s output. This feature is enabled by asserting a logic high level on the

BE pin.

Recording in Random Access Mode On power up, the device is ready to record or play back, in any of

the enabled message segments. To record, /CE must be set low to enable the device

and /RE must be set low to enable recording. You initiate recording by applying a

low level on the message trigger pin that represents the message segment you

intend to use. The message trigger pins are labeled /M1_Message - /M8_Option on

pins 1-9 (excluding pin 7) for message segments 1-8 respectively.

Playback in Random Access ModeOn power up, the device is ready to record or playback, in any of the enabled

message segments. To playback, /CE must be set low to enable the

device and /RE must be set high to disable recording & enable playback. You

initiate playback by applying a high to low edge on the message trigger pin that

representing the message segment you intend. Playback will continue until the end

of the message is reached. If a high to low edge occurs on the same message trigger

pin during playback, playback of the current message stops immediately. If a

different message trigger pin pulses during playback, playback of the current

message stops immediately (indicated by one beep) and playback of the new

message segment begins.

25

Page 26: Vehicle Black Box Final Report

Vehicle black box SNG-EC

MAX-232

The MAX232 also known as line driver is an integrated circuit that converts

signals from an RS-232 serial port to signals suitable for use in TTL compatible

digital logic circuits. The MAX232 is a dual driver/receiver and typically converts

the RX, TX, CTS and RTS signals. The drivers provide RS-232 voltage level

outputs (approx. ± 7.5 V) from a single + 5 V supply via on-chip charge pumps and

external capacitors. This makes it useful for implementing RS-232 in devices that

otherwise do not need any voltages outside the 0 V to + 5 V range, as power

supply design does not need to be made more complicated just for driving the RS-

232 in this case.

GPS

GPS In This Project

In this project GPS is used for locating and tracking the vehicle. The GPS

module calculates the geographical position of the module. This helps in detecting

the location/position of the module. G-Mouse is a total solution GPS receiver,

designed based on the most high sensitivity first GPS kernel architecture. This

positioning application meets strict needs such as car navigation, mapping,

surveying, security, agriculture and so on. Only clear view of sky and certain

power supply are necessary to the unit. It communicates with other electronic

utilities via compatible dual-channel through RS-232 or TTL and saves critical

satellite data by built-in backup memory. With low power consumption, the G-

26

Page 27: Vehicle Black Box Final Report

Vehicle black box SNG-EC

Mouse tracks up to 8 satellites at a time, re-acquires satellite signal in 1 sec and

updates position data recovery second.4 power-saving mode allows the unit with

ultra low power request.

eg;$GPRMC,161229.487,A,3723.2475,N,12158.3416,W,0.13,309.62,120598,*10

GSM

GSM In This ProjectIn this project GSM module is used to send the messages containing the

accident information along with the latitude and longitude position of module at the

time of accident. For that we use an ordinary GSM mobile hand set. The GSM can

be controlled by certain commands called AT commands. Through our software

we control the GSM modem to generate and transmit the text messages on to

another GSM modem in the program.

Example for the AT command are,

AT: -Sends to the module for detecting the proper working of the module.

ATE0:-Command for turn off the echo.

27

Page 28: Vehicle Black Box Final Report

Vehicle black box SNG-EC

AT+CMGF=1:-Command for shifting module in to text mode.

AT+CMGS=”+91.............”-Command for connecting to another

module.

After sending the AT the module will return an OK message to show

the proper functioning of the module. If OK received then we will send

the command ATE0 to the module to turn off the echoing of the

commands. Then the commandAT+CMGF=1 shifts the module to the text

mode. The module now returns ”>”. Then AT+CMGS=”+91**********

If “>” is received from the GSM module, type the SMS data and give Ctrl+Z. This

will send the SMS.

LCD MODULE

This module has two main lines. Control lines and data lines. The control

lines and the data lines are connected to PORTB. The 10K trim potentiometer

connected to the Contrast pin of the LCD is used to adjust the contrast of the

display. The LCD display is used to display the saved GPS location, once the

‘Black Box’ module is retrieved from the affected vehicle. GPS and the GSM

modules are connected across a relay since there is only one serial communication

module for the controller and all the modules need to be connected to the same

peripheral. On an accident case, the GSM module sends the alert message after

receiving the GPS location

FEATURES

• 5 x 7 DOTS WITH CURSOR

• BUILT-IN CONTROLLER (KS0066 OR EQUIVALENT)

• 5 V POWER SUPPLY

• 1/16 DUTY CYCLE

4.2 V LED FORWARD VOLTAGE

28

Page 29: Vehicle Black Box Final Report

Vehicle black box SNG-EC

CHAPTER -5

29

Page 30: Vehicle Black Box Final Report

Vehicle black box SNG-EC

PROGRAM

#include "adc.h"

#include"pic.h"

#include"delay.h"

char adc_dataL,adc_dataH;

float bank1 tempt[11];

float bank1 temp_incelcius[1];

char bank1 count1;

char shift_number=0;

char flag=1;

int bank1 number;

int decimal;

void adc(char PIC_CHANNEL,char ADC_CHANNEL)

{

float

voltage[11]={.00488,.00976,.01952,.03904,.07808,.15616,.31232,.62

464,1.24928,2.49856};

int p;

static bit s;

adc_dataL=0X00;

adc_dataH=0X00;

q=0;

count1=0;

if(PIC_CHANNEL==0)

{

30

Page 31: Vehicle Black Box Final Report

Vehicle black box SNG-EC

ADCON1=0B10001110;

}

else if(PIC_CHANNEL==1)

{

ADCON1=0B10000100;

}

if(ADC_CHANNEL==0)

{

ADCON0=0B01000001;

}

else if(ADC_CHANNEL==1)

{

ADCON0=0B01001001;

}

else if(ADC_CHANNEL==2)

{

ADCON0=0B01010001;

}

else if(ADC_CHANNEL==3)

{

ADCON0=0B01011001;

}

for(p=0;p<=10;p++)

{

tempt[p]=0.00;

}

ADGO=1; //

while(ADGO==1)//Check whether ADGO==1

continue;

adc_dataH=ADRESH;

adc_dataL=ADRESL;

s=1;

31

Page 32: Vehicle Black Box Final Report

Vehicle black box SNG-EC

do

{

if((adc_dataL&0x01)==s)

{

tempt[q+1]=tempt[q]+voltage[q];

count1=q+1;

}

q++;

adc_dataL=(adc_dataL>>1);

}while(q<=7);

if(adc_dataH!=0x00)

{

do

{

if((adc_dataH&0x01)==s)

{

tempt[q+1]=tempt[q]+voltage[q];

count1=q+1;

}

q++;

adc_dataH=(adc_dataH>>1);

}while(q<=9);

temp_incelcius[0]=tempt[count1]*100;

}

else if(adc_dataH==0x00)

temp_incelcius[0]=tempt[count1]*100;

decimal =(int)temp_incelcius[0];

for(p=0;p<4;p++)

{

decimal2[p]=0X00;

}

if(decimal==0x00)

32

Page 33: Vehicle Black Box Final Report

Vehicle black box SNG-EC

{decimal2[0]=0x30;}

else

{

q=0;

do

{

decimal2[q]=(decimal%10)+0x30;

decimal =decimal/10;

q++;

}

while(decimal!=0);

}

return;

}

/*

* Delay functions

* See delay.h for details

*

* Make sure this code is compiled with full optimization!!!

*/

#include "delay.h"

void

DelayMs(unsigned char cnt)

{

#if XTAL_FREQ <= 2MHZ

do {

DelayUs(996);

} while(--cnt);

#endif

#if XTAL_FREQ > 2MHZ

unsigned char i;

33

Page 34: Vehicle Black Box Final Report

Vehicle black box SNG-EC

do {

i = 4;

do {

DelayUs(250);

} while(--i);

} while(--cnt);

#endif

}

#include"pic.h"

#include"delay.h"

#include"usart.h"

#include"gps.h"

char day1;

char day2;

char mon1;

char mon2;

char yer1;

char yer2;

char hr1;

char hr2;

char min1;

char min2;

void gps()

{

char aa,bb,cc;

char mm;

RC0=1;

DelayMs(250);

BAUD_RATE=0x33;

DelayMs(250);

while (usart_rx()!='$');

34

Page 35: Vehicle Black Box Final Report

Vehicle black box SNG-EC

while (usart_rx()!='G');

while (usart_rx()!='P');

while (usart_rx()!='R');

while (usart_rx()!='M');

while (usart_rx()!='C');

mm=usart_rx();

hr1=usart_rx();

hr2=usart_rx();

min1=usart_rx();

min2=usart_rx();

mm=usart_rx();

mm=usart_rx();

for(aa=0;aa<5;aa++)

{

mm=usart_rx();

}

while (usart_rx()!='A');

mm=usart_rx();

for(aa=0;aa<11;aa++)

{

latitude[aa]=usart_rx();

}

mm=usart_rx();

for(bb=0;bb<12;bb++)

{

longitude[bb]=usart_rx();

}

for(aa=0;aa<=11;aa++)

{

mm=usart_rx();

}

day1=usart_rx();

day2=usart_rx();

mon1=usart_rx();

mon2=usart_rx();

35

Page 36: Vehicle Black Box Final Report

Vehicle black box SNG-EC

yer1=usart_rx();

yer2=usart_rx();

RC0=0;

DelayMs(250);

BAUD_RATE=0x19;

DelayMs(250);

}

#include"pic.h"

#include"delay.h"

#include"usart.h"

#include"gsmreceive.h"

#include"gsmsend.h"

#include"string.h"

#include"gps.h"

#include"lcd_4.h"

void DELAY();

unsigned char bank1 inbox[10];

unsigned char bank1 recmob[14];

char bank1 latitude[11];

char bank1 longitude[12];

char mess_recv()

{

int j=0;

unsigned int i,k;

unsigned char l,sp1,sp2,val,x,qq;

usart_string("AT+CMGR=1");

usart_trx(0x0D);

DelayMs(5);

usart_trx(0x0A);

label:

qq=usart_rx();

if(qq=='+')

goto jump;

36

Page 37: Vehicle Black Box Final Report

Vehicle black box SNG-EC

else if(qq=='O')

goto exit;

goto label;

jump:

while(usart_rx()!='C');

while(usart_rx()!='M');

while(usart_rx()!='G');

while(usart_rx()!='R');

while(usart_rx()!=',');

x=usart_rx();

while(1)

{

x=usart_rx();

if(x=='"')

break;

else

{

recmob[j]=x;

j++;

continue;

}

break;

}

j=0;

while(usart_rx()!=0x0D);

x=usart_rx();

while(1)

{

x=usart_rx();

if(x==0x0D)

break;

else

{

inbox[j]=x;

j++;

37

Page 38: Vehicle Black Box Final Report

Vehicle black box SNG-EC

continue;

}

break;

}

x=usart_rx();

cmdwrt(0xC0);

LCD_string(" MSG RECEIVED ");

DELAY();

cmdwrt(0xC0);

LCD_string(" ");

cmdwrt(0xC0);

LCD_string("MSG=");

for(i=0;inbox[i]!='\0';i++)

{

datwrt(inbox[i]);

}

DELAY();

if(strcmp(inbox,"track")==0)

{

cmdwrt(0xC0);

LCD_string(" TRACKING.... ");

gps();

usart_string("AT+CMGS=\"");

for(i=0;recmob[i]!='\0';i++)

{

usart_trx(recmob[i]);

DelayMs(50);

}

usart_string("\"");

usart_trx(0x0D);

DelayMs(5);

usart_trx(0x0A);

DelayMs(50);

38

Page 39: Vehicle Black Box Final Report

Vehicle black box SNG-EC

usart_string("Vehicle Tracked!!, Location:-");

usart_trx(0x0D);

DelayMs(5);

usart_trx(0x0A);

DelayMs(100);

for(i=0;i<11;i++)

{

usart_trx(latitude[i]);

DelayMs(50);

}

for(i=0;i<12;i++)

{

usart_trx(longitude[i]);

DelayMs(50);

}

usart_trx(0x0D);

DelayMs(5);

usart_trx(0x1A);

DelayMs(50);

usart_trx(0x0D);

DelayMs(5);

usart_trx(0x0A);

while(usart_rx()!='O');

while(usart_rx()!='K');

usart_string("AT+CMGD=1");

usart_trx(0X0D);

DelayMs(5);

usart_trx(0X0A);

DELAY();

}

else

{

39

Page 40: Vehicle Black Box Final Report

Vehicle black box SNG-EC

cmdwrt(0xC0);

LCD_string("wrong command!!");

usart_string("AT+CMGS=\"");

for(i=0;recmob[i]!='\0';i++)

{

usart_trx(recmob[i]);

DelayMs(50);

}

usart_string("\"");

usart_trx(0x0D);

DelayMs(5);

usart_trx(0x0A);

DelayMs(50);

usart_string("Wrong Command!!");

usart_trx(0x0D);

DelayMs(5);

usart_trx(0x1A);

DelayMs(50);

usart_trx(0x0D);

DelayMs(5);

usart_trx(0x0A);

while(usart_rx()!='O');

while(usart_rx()!='K');

DelayMs(50);

usart_string("AT+CMGD=1");

usart_trx(0X0D);

DelayMs(5);

usart_trx(0X0A);

DELAY();

}

cmdwrt(0xC0);

LCD_string(" MSG SENT ");

exit:

for(i=0;i<12;i++)

DelayMs(250);

40

Page 41: Vehicle Black Box Final Report

Vehicle black box SNG-EC

}

void DELAY()

{

int xxxx;

for(xxxx=0;xxxx<32;xxxx++)

{

DelayMs(250);

}

}

#include"pic.h"

#include"delay.h"

#include"usart.h"

#include"gsmsend.h"

#include"gps.h"

extern char bank1 latitude[11];

extern char bank1 longitude[12];

void gsm_init() //GSM Initialisation

{

int ccc;

usart_string("AT");

usart_trx(0x0D);

DelayMs(5);

usart_trx(0x0A);

DelayMs(100);

usart_string("AT");

usart_trx(0x0D);

DelayMs(5);

usart_trx(0x0A);

while(usart_rx()!='O');

while(usart_rx()!='K');

41

Page 42: Vehicle Black Box Final Report

Vehicle black box SNG-EC

DelayMs(100);

usart_string("AT");

usart_trx(0x0D);

DelayMs(5);

usart_trx(0x0A);

while(usart_rx()!='O');

while(usart_rx()!='K');

DelayMs(100);

usart_string("AT+CMGF=1");

usart_trx(0x0D);

DelayMs(5);

usart_trx(0x0A);

while(usart_rx()!='O');

while(usart_rx()!='K');

for(ccc=0;ccc<=8;ccc++)

{

DelayMs(250);

}

return;

}

void mess_send()

{

int i;

gps();

BAUD_RATE=0x19;

TRANSMIT_ENABLE=SET;

usart_string("AT+CMGS=\"+919790673734\"");

usart_trx(0x0D);

42

Page 43: Vehicle Black Box Final Report

Vehicle black box SNG-EC

DelayMs(5);

usart_trx(0x0A);

DelayMs(50);

usart_string("ACCIDENT!! OCCURED AT ");

for(i=0;i<11;i++)

{

usart_trx(latitude[i]);

DelayMs(50);

}

for(i=0;i<12;i++)

{

usart_trx(longitude[i]);

DelayMs(50);

}

usart_trx(0x0D);

DelayMs(5);

usart_trx(0x1A);

DelayMs(50);

usart_trx(0x0D);

DelayMs(5);

usart_trx(0x0A);

DelayMs(250);

return;

}

#include"pic.h"

#include"delay.h"

#include"lcd_4.h"

void lcd_init()

{

TRISB=0x00;

cmdwrt(0x28);

cmdwrt(0x28);

43

Page 44: Vehicle Black Box Final Report

Vehicle black box SNG-EC

cmdwrt(0x28);

cmdwrt(0x06);

cmdwrt(0x0F);

cmdwrt(0x01);

}

void cmdwrt(char a)

{

char c;

c=a;

a=(a&0xF0)>>4;

PORTB=a;

RB6=0;

RB5=0;

RB4=1;

DelayUs(10);

RB4=0;

DelayUs(1);

a=(c&0x0F);

PORTB=a;

RB6=0;

RB5=0;

RB4=1;

DelayUs(10);

RB4=0;

DelayMs(15);

}

void datwrt(char b)

{

char c;

c=b;

b=(b&0xF0)>>4;

PORTB=b;

44

Page 45: Vehicle Black Box Final Report

Vehicle black box SNG-EC

RB6=1;

RB5=0;

RB4=1;

DelayUs(10);

RB4=0;

DelayUs(1);

b=(c&0x0F);

PORTB=b;

RB6=1;

RB5=0;

RB4=1;

DelayUs(10);

RB4=0;

DelayMs(15);

}

void LCD_string(const char *DATA)

{

while(*DATA)

{

datwrt(*DATA);

DATA++;

}

DATA=0;

return;

}

#include"pic.h"

#include"delay.h"

#include"usart.h"

#include"gsmreceive.h"

45

Page 46: Vehicle Black Box Final Report

Vehicle black box SNG-EC

#include"gsmsend.h"

#include"string.h"

#include"gps.h"

#include"lcd_4.h"

char bank1 inbox[10];

char bank1 recmob[14];

void main()

{

usart_init();

mess_recv();

while(1);

}

#include"pic.h"

#include"delay.h"

#include"lcd_4.h"

#include"usart.h"

void main()

{

char aa;

int count=0;

usart_init();

lcd_init();

while(1)

{

aa=usart_rx();

datwrt(aa);

count++;

if(count==15)

{

cmdwrt(0X01);

count=0;

}

}

}

46

Page 47: Vehicle Black Box Final Report

Vehicle black box SNG-EC

#include"pic.h"

#include"delay.h"

#include"usart.h"

char e;

unsigned int i;

/*USART Initialisation*/

void usart_init()

{

TRANSMIT_PIN=CLEAR;

RECEIVE_PIN=SET;

BAUD_TYPE=SET;

BAUD_RATE=0x19;

SERIAL_PORT=SET;

RECEIVE_ENABLE=SET;

TRANSMIT_ENABLE=SET;

}

/* USART transmission function*/

void usart_trx( char xx)

{

TRANSMIT_REGISTER=xx;

while(TRANSMIT_FLAG==CLEAR);

}

void usart_string(const char *DATA)

{

while(*DATA)

{

TRANSMIT_REGISTER=*DATA;

while(TRANSMIT_FLAG==CLEAR);

DelayMs(50);

47

Page 48: Vehicle Black Box Final Report

Vehicle black box SNG-EC

DATA++;

}

return;

}

/*USART reception function*/

char usart_rx()

{

char yy;

if(OVER_RUN==1)

{

OVER_RUN=CLEAR;

RECEIVE_ENABLE=CLEAR;

DelayUs(5);

RECEIVE_ENABLE=SET;

}

while(RECEIVE_FLAG==CLEAR);

yy=RECEIVE_REGISTER;

return yy;

}

#include"pic.h"

#include"delay.h"

#include"usart.h"

#include"gsmreceive.h"

#include"gsmsend.h"

#include"lcd_4.h"

void flags(void);

void read(void);

void check();

char nn,q,t;

unsigned char bank1 inbox[10];

48

Page 49: Vehicle Black Box Final Report

Vehicle black box SNG-EC

unsigned char bank1 recmob[14];

char bank1 pp;

char jj;

void main()

{

char a,b,c,i,d;

TRISC0=0;

RC0=0;

TRISC1=1;

RC1=0;

TRISC2=0;

TRISC3=0;

TRISC4=0;

TRISC5=0;

lcd_init();

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string(" BLACK BOX");

usart_init();

gsm_init();

RC2=RC3=RC4=RC5=1;

while(1);

for(a=0;a<16;a++)

DelayMs(250);

while(1)

{

mess_recv();

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("RECORDING...");

if(RC1==1)

goto read;

RC2=RC3=RC4=RC5=1;

49

Page 50: Vehicle Black Box Final Report

Vehicle black box SNG-EC

DelayMs(10);

RC2=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

{

DelayMs(250);

}

}

//*********************************

mess_recv();

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("RECORDING...");

if(RC1==1)

goto read;

RC2=RC3=RC4=RC5=1;

DelayMs(10);

RC3=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

{

DelayMs(250);

}

}

//********************************

mess_recv();

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("RECORDING...");

if(RC1==1)

goto read;

RC2=RC3=RC4=RC5=1;

DelayMs(10);

50

Page 51: Vehicle Black Box Final Report

Vehicle black box SNG-EC

RC4=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

{

DelayMs(250);

}

}

//*****************************

mess_recv();

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("RECORDING...");

if(RC1==1)

goto read;

RC2=RC3=RC4=RC5=1;

DelayMs(10);

RC5=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

{

DelayMs(250);

}

}

//******************************

}

read:

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("ACCIDENT!!!..");

mess_send();

RC1=0;

check();

51

Page 52: Vehicle Black Box Final Report

Vehicle black box SNG-EC

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("READING...");

while(1)

{

pp=usart_rx();

RC2=RC3=RC4=RC5=1;

DelayMs(10);

if(pp=='1')

{

RC2=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

{

DelayMs(250);

}

}

RC2=RC3=RC4=RC5=1;

DelayMs(10);

}

else if(pp=='2')

{

RC3=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

{

DelayMs(250);

}

}

RC2=RC3=RC4=RC5=1;

DelayMs(10);

}

52

Page 53: Vehicle Black Box Final Report

Vehicle black box SNG-EC

else if(pp=='3')

{

RC4=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

{

DelayMs(250);

}

}

RC2=RC3=RC4=RC5=1;

DelayMs(10);

}

else if(pp=='4')

{

RC5=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

{

DelayMs(250);

}

}

RC5=1;

}

}

}//main end

void check()

{

BAUD_RATE=0x19;

cmdwrt(0xC0);

53

Page 54: Vehicle Black Box Final Report

Vehicle black box SNG-EC

LCD_string("ENTER PC MODE..");

while(usart_rx()!='%');

usart_trx('#');

DelayMs(50);

return;

}

#include"pic.h"

#include"delay.h"

#include"string.h"

#include"usart.h"

#include"gsmreceive.h"

#include"gsmsend.h"

#include"gps.h"

#include"lcd_4.h"

void flags(void);

int flag1=0,flag2=0;

char nn,q,t;

unsigned char bank1 latitude[11];

unsigned char bank1 longitude[12];

unsigned char bank1 inbox[5];

unsigned char bank1 recmob[13];

char bank1 pp;

void main()

{

char a,b,c,i,d;

TRISC0=0;

RC0=0;

TRISC1=1;

RC1=0;

TRISC2=0;

TRISC3=0;

TRISC4=0;

TRISC5=0;

54

Page 55: Vehicle Black Box Final Report

Vehicle black box SNG-EC

lcd_init();

usart_init();

gsm_init();

RC2=RC3=RC4=RC5=1;

flag1=0;

flag2=0;

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("B");

for(a=0;a<16;a++)

DelayMs(250);

RCIE=1;

PEIE=1;

GIE=1;

while(1)

{

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("RECORDING...");

flags();

if(flag1==1)

{

flag1=0;

break;

}

if(RC1==1)

{

GIE=0;

RCIE=0;

mess_send();

55

Page 56: Vehicle Black Box Final Report

Vehicle black box SNG-EC

RC1=0;

GIE=1;

RCIE=1;

}

RC2=RC3=RC4=RC5=1;

DelayMs(10);

RC2=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

{

DelayMs(250);

}

}

RC2=RC3=RC4=RC5=1;

DelayMs(10);

flags();

if(flag1==1)

{

flag1=0;

break;

}

if(RC1==1)

{

GIE=0;

RCIE=0;

mess_send();

RC1=0;

GIE=1;

RCIE=1;

}

RC3=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

56

Page 57: Vehicle Black Box Final Report

Vehicle black box SNG-EC

{

DelayMs(250);

}

}

RC2=RC3=RC4=RC5=1;

DelayMs(10);

flags();

if(flag1==1)

{

flag1=0;

break;

}

if(RC1==1)

{

GIE=0;

RCIE=0;

mess_send();

RC1=0;

GIE=1;

RCIE=1;

}

RC4=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

{

DelayMs(250);

}

}

RC2=RC3=RC4=RC5=1;

DelayMs(10);

flags();

if(flag1==1)

{

flag1=0;

57

Page 58: Vehicle Black Box Final Report

Vehicle black box SNG-EC

break;

}

if(RC1==1)

{

GIE=0;

RCIE=0;

mess_send();

RC1=0;

GIE=1;

RCIE=1;

}

RC5=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

{

DelayMs(250);

}

}

RC2=RC3=RC4=RC5=1;

DelayMs(10);

flags();

if(flag1==1)

{

flag1=0;

break;

}

if(RC1==1)

{

GIE=0;

RCIE=0;

mess_send();

RC1=0;

GIE=1;

RCIE=1;

58

Page 59: Vehicle Black Box Final Report

Vehicle black box SNG-EC

}

}

while(1)

{

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("READING...");

GIE=0;

pp=usart_rx();

if(pp=='1')

{

RC2=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

{

DelayMs(250);

}

}

RC2=1;

}

if(pp=='2')

{

RC3=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

{

DelayMs(250);

}

}

RC3=1;

59

Page 60: Vehicle Black Box Final Report

Vehicle black box SNG-EC

}

if(pp=='3')

{

RC4=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

{

DelayMs(250);

}

}

RC4=1;

}

if(pp=='4')

{

RC5=0;

for(b=0;b<9;b++)

{

for(a=0;a<3;a++)

{

DelayMs(250);

}

}

RC5=1;

}

flag1=0;

}

}

static void interrupt usart(void)

{

if(RCIF==1)

{

60

Page 61: Vehicle Black Box Final Report

Vehicle black box SNG-EC

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("BAD");

for(t=0;t<9;t++)

{

for(q=0;q<3;q++)

{

DelayMs(250);

}

}

// nn=RECEIVE_REGISTER;

// if(nn=='+')

// {

// cmdwrt(0x01);

// cmdwrt(0x80);

// LCD_string("INT");

// mess_recv();

// flag2=1;

//

// }

// else //if(nn=='%')

// {

//

// // usart_trx('#');

// // flag1=1;

// }

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("BADesss");

RCIF=0;

}

}

61

Page 62: Vehicle Black Box Final Report

Vehicle black box SNG-EC

void flags()

{

int i;

if(flag2==1)

{

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("CHK");

RCIF=0;

if(strcmp(inbox,"track")==0)

{

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("TRACKING...");

gps();

GIE=0;

RCIE=0;

usart_string("AT+CMGS=\"");

for(i=0;i<=12;i++)

{

usart_trx(recmob[i]);

}

usart_string("\"");

usart_trx(0x0D);

usart_trx(0x0A);

for(i=0;i<11;i++)

{

usart_trx(latitude[i]);

}

for(i=0;i<12;i++)

{

usart_trx(longitude[i]);

}

usart_trx(0x0D);

62

Page 63: Vehicle Black Box Final Report

Vehicle black box SNG-EC

usart_trx(0x1A);

usart_trx(0x0D);

usart_trx(0x0A);

DelayMs(250);

GIE=1;

RCIE=1;

}

else

{

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("wrong command!!");

}

flag2=0;

}

}

#include"pic.h"

#include"delay.h"

#include"lcd_4.h"

#include"adc.h"

#include"gps.h"

#include"gsmreceive.h"

#include"gsmsend.h"

#include"usart.h"

extern char bank1 latitude[11];

extern char bank1 longitude[12];

char bank1 decimal2[2];

char q;

void events()

63

Page 64: Vehicle Black Box Final Report

Vehicle black box SNG-EC

{

char a=0,b=0;

int tempr=0,l;

adc(0,0);

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("TEMPERATURE=");

datwrt(decimal2[1]);

datwrt(decimal2[0]);

datwrt(' ');

a=decimal2[1]-0x30;

b=decimal2[0]-0x30;

tempr=(a*10)+(b*1);

if(tempr>50||RA1==1||RC1==1)

{

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string("ACCIDENT OCCURED");

mess_send();

while(RA3==0);

cmdwrt(0x01);

cmdwrt(0x80);

for(l=0;l<11;l++)

{

datwrt(latitude[l]);

}

cmdwrt(0xC0);

for(l=0;l<12;l++)

{

datwrt(longitude[l]);

}

while(1)

{

RC2=RC3=RC5=1;

DelayMs(100);

64

Page 65: Vehicle Black Box Final Report

Vehicle black box SNG-EC

RC2=0;

for(l=0;l<21;l++) DelayMs(250);

RC2=RC3=RC5=1;

DelayMs(100);

RC3=0;

for(l=0;l<21;l++) DelayMs(250);

RC2=RC3=RC5=1;

DelayMs(100);

RC5=0;

for(l=0;l<21;l++) DelayMs(250);

}

}

}

void main()

{

int l;

TRISA1=1;

TRISA2=1;

TRISA3=1;

TRISC1=1;

TRISC0=0;

TRISC2=0;

TRISC3=0;

TRISC5=0;

RC2=RC3=RC5=1;

RA1=0; // gas sensor

RA2=0; // alchahol sensor

RA3=0; // apr retreving switch

RC1=0; // accident trigger

RC0=0; // relay

lcd_init();

usart_init();

cmdwrt(0x01);

cmdwrt(0x80);

LCD_string(" BLACK BOX ");

65

Page 66: Vehicle Black Box Final Report

Vehicle black box SNG-EC

gsm_init();

cmdwrt(0x80);

LCD_string("GSM INITIALIZED");

RC2=RC3=RC5=1;

for(l=0;l<16;l++) DelayMs(250);

while(1)

{

events();

mess_recv();

cmdwrt(0xC0);

LCD_string("RECORDING PIN 1");

RC2=RC3=RC5=1;

DelayMs(100);

RC2=0;

for(l=0;l<21;l++) DelayMs(250);

//*********************************

events();

mess_recv();

cmdwrt(0xC0);

LCD_string("RECORDING PIN 2");

RC2=RC3=RC5=1;

DelayMs(100);

RC3=0;

for(l=0;l<21;l++) DelayMs(250);

//********************************

events();

mess_recv();

cmdwrt(0xC0);

LCD_string("RECORDING PIN 3");

RC2=RC3=RC5=1;

DelayMs(100);

RC5=0;

for(l=0;l<21;l++) DelayMs(250);

}

}

66

Page 67: Vehicle Black Box Final Report

Vehicle black box SNG-EC

CHAPTER-6

67

Page 68: Vehicle Black Box Final Report

Vehicle black box SNG-EC

68

Page 69: Vehicle Black Box Final Report

Vehicle black box SNG-EC

PRINTED CIRCUIT BOARD

Printed Circuit Board (PCB) is a piece of art. The performance of an electronic

circuit depends on the layout and design of PCB. A PCB mechanically supports and

connects components by conductive pathways, etched from copper sheets

laminated on to insulated substrate. PCB, are used to rotate electrical currents

and signals through copper tracts which are firmly bonded to an insulating base.

PCB Fabrication involves the following steps:

1. Drawing the layout of the PCB in a paper. The track layout of the Electronic

circuit should be made in such manner that the paths are in easy routes. It is then

transferred to a Mylar sheet. The sheet is then touched with black ink.

2. The solder side of the Mylar sheet is placed on the shiny side of the five- Star

sheet and is placed in a frame. Then it is exposed to sunlight with Mylar sheet

facing the sunlight.

3. The exposed five-star sheet is put in Hydrogen Peroxide solution. Then it is put

in hot water and shook till unexposed region becomes transparent.

4. This is put in cold water and then the rough side is stuck on to the silk screen.

This is then pressed and dried well.

5. The plastic sheet of the five-star sheet is removed leaving the pattern on the

screen.

69

Page 70: Vehicle Black Box Final Report

Vehicle black box SNG-EC

6. A copper clad sheet is cut to the size and cleaned. This is placed under screen.

7. As it resistant ink if spread on the screen so that a pattern of tracks and a pad

is obtained on a copper clad sheet. It is then dried.

8. The dried sheet is then etched using Ferric Chloride solution (32Baume) till all

the unwanted Copper is etched away. Swish the board to keep the each fluid

moving. Lift up the PCB and check whether all the unwanted Copper is removed.

Etching is done by immersing the marked Copper clad in Ferric Chloride solution.

After that the etched sheet is dried.

9. The unwanted resist ink is removed using Sodium Hydroxide solution Holes are

then dried.

PCB PARAMETERS

Copper thickness - 72mil (1mm=39.37mils)

Track width - 60mil

Clearance - 60mil

Pad width - 86mil

Pad height - 86mil

Pad shape - Oval

Pad hole size - 25mil

On board - Through

Hole size - 0.9mm (36mil)

Base -Paper phenolic, Hylam

PCB Quality - FRC470

Page 71: Vehicle Black Box Final Report

Vehicle black box SNG-EC

PCB LAYOUT

71

Page 72: Vehicle Black Box Final Report

Vehicle black box SNG-EC

DIAGRAM FOR COMPONENT PLACING

72

Page 73: Vehicle Black Box Final Report

Vehicle black box SNG-EC

CHAPTER-7

73

Page 74: Vehicle Black Box Final Report

Vehicle black box SNG-EC

ADV ANTAGES AND DISADVANTAGES

ADVANTAGES

The system is a very cost effective and scientific approach to security

of vehicles.

The module provides information like, a recorded audio that contains

the noises, including the speech of the people inside the cabin. This

brings forth strong evidence pointing to the cause of the accident.

When the accident occurs, the module alerts the accident to preset

mobile numbers stored in it.

The alert message includes the location in latitude and longitude,

thus the location of the accident can be easily understood for quick

rescue.

The module contains a data retrieve button. After the accident, the

module is recovered and the details like position of the vehicle on

accident is displayed on the LCD display and the recorded voice is

played back through the speaker on the same module.

Flaw less technologies like GSM and GPS which created

revolution in communication is used, these technologies makes the

system more reliable.

DISADVANTAGES

Creating record setup for a long duration is very costly since the

recording IC is costly.

The GSM module will not function where network coverage is not

there

74

Page 75: Vehicle Black Box Final Report

Vehicle black box SNG-EC

CHAPTER -8

75

Page 76: Vehicle Black Box Final Report

Vehicle black box SNG-EC

CONCLUSIONS

Accidents are common in these days as the number of vehicles is increased. What

ever traffic rules have been introduced, it could not be eliminated, but was able to

reduce up to some extent. Research activities are going on to decrease it further.

Many new safety standards are being introduced. Black box is an advanced

technology used for recording the data inside the aircraft cabin for accident

detection and for further investigations. We are also trying to make a system which

can be a safety standard in coming years. Our aim is to implement the same in

automobiles. The black box circuit will continuously record the relevant data for

stipulated time duration. When an accident occurs the recording gets stopped.

Proper sensor devices are connected along with the system for detecting the

accident. The accident spot is located using the GPS module and a emergency

message is sent to pre-stored number. Thus the accident spot can be found and

relief can be brought to them on time. Many a times people die because of belated

medical help. This can be avoided using our project. There are many flaws in

today’s safety systems. In case of any theft the vehicle can be tracked by our

system. Our system is a great help for research activities related to increase the

safety standards. Days are not far when one can see vehicles equipped with this

system surfing through the roads and of course with fewer accidents and easily

available relief.

76

Page 77: Vehicle Black Box Final Report

Vehicle black box SNG-EC

CHAPTER -9

77

Page 78: Vehicle Black Box Final Report

Vehicle black box SNG-EC

REFERENCE

www.electronicsforu.com

www.example projects.com

www.constructionofpojects .com

www.studyelectronics .com

www.electroniccomponents .com

Electronics For You Magazine

78

Page 79: Vehicle Black Box Final Report

Vehicle black box SNG-EC

CHAPTER -10

79

Page 80: Vehicle Black Box Final Report

Vehicle black box SNG-EC

APPENDIX

80

Page 81: Vehicle Black Box Final Report

Vehicle black box SNG-EC

81

Page 82: Vehicle Black Box Final Report

Vehicle black box SNG-EC

82

Page 83: Vehicle Black Box Final Report

Vehicle black box SNG-EC

83

Page 84: Vehicle Black Box Final Report

Vehicle black box SNG-EC

84

Page 85: Vehicle Black Box Final Report

Vehicle black box SNG-EC

85

Page 86: Vehicle Black Box Final Report

Vehicle black box SNG-EC

86