Vehicle Black Box Final Report
Vehicle Black Box Final Report
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
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
parameters. The IEEE has also introduced some standards in this regard. The
2
Vehicle black box
SNG-EC
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
incorporated into a car as such systems will cost more than the car itself. Moreover
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
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
3
Vehicle black box
SNG-EC
CHAPTER -2
4
Vehicle black box
SNG-EC
BLOCK DIAGRAM
5
Vehicle black box
SNG-EC
MICROCONTROLLER
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.
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
APR 9600
6
Vehicle black box
SNG-EC
the real cause of the accident right from the speech of the people
inside
LCD DISPLAY
GSM MODEM
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
Vehicle black box
SNG-EC
CHAPTER -3
CIRCUIT DIAGRAM
8
Vehicle black box
SNG-EC
CIRCUIT EXPLANATION
9
Vehicle black box
SNG-EC
Power supply
+12V
D6
1 2
1N4007 + C11
D7
1 5 1 2 2200mf
230V T1
6 1N4007 U5 VCC
D8 L7805/TO220
4 8 1 2 1 2
230V
1
1N4007
1
+ C13
3
2200mfd
2
10
Vehicle black box
SNG-EC
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
Vehicle black box
SNG-EC
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.
MAX 232
12
Vehicle black box
SNG-EC
13
Vehicle black box
SNG-EC
GPS MODULE
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.
Tosc = 0.25Fosc
14
Vehicle black box
SNG-EC
WORKING OF CIRCUIT
15
Vehicle black box
SNG-EC
CHAPTER -4
16
Vehicle black box
SNG-EC
HARDWARE
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
Vehicle black box
SNG-EC
Applications
ARCHITECTURE OF PIC16F873A
18
Vehicle black box
SNG-EC
FEATURES
Core Features
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.
20
Vehicle black box
SNG-EC
21
Vehicle black box
SNG-EC
22
Vehicle black box
SNG-EC
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
23
Vehicle black box
SNG-EC
ARCHITECTURE
Features
• Single-chip, high-quality voice recording & playback solution
- No external ICs required
24
Vehicle black box
SNG-EC
25
Vehicle black box
SNG-EC
on the device’s output. This feature is enabled by asserting a logic high level on the
BE pin.
MAX-232
26
Vehicle black box
SNG-EC
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
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-
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
27
Vehicle black box
SNG-EC
GSM
28
Vehicle black box
SNG-EC
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
29
Vehicle black box
SNG-EC
CHAPTER -5
PROGRAM
30
Vehicle black box
SNG-EC
#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;
if(ADC_CHANNEL==0)
{
31
Vehicle black box
SNG-EC
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;
do
{
if((adc_dataL&0x01)==s)
{
tempt[q+1]=tempt[q]+voltage[q];
count1=q+1;
}
q++;
adc_dataL=(adc_dataL>>1);
32
Vehicle black box
SNG-EC
}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)
{decimal2[0]=0x30;}
else
{
q=0;
do
{
decimal2[q]=(decimal%10)+0x30;
decimal =decimal/10;
q++;
}
while(decimal!=0);
33
Vehicle black box
SNG-EC
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
#include"pic.h"
#include"delay.h"
#include"usart.h"
34
Vehicle black box
SNG-EC
#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()!='$');
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++)
35
Vehicle black box
SNG-EC
{
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();
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"
36
Vehicle black box
SNG-EC
#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;
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;
37
Vehicle black box
SNG-EC
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++;
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++)
{
38
Vehicle black box
SNG-EC
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);
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);
39
Vehicle black box
SNG-EC
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
{
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);
40
Vehicle black box
SNG-EC
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);
}
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];
41
Vehicle black box
SNG-EC
usart_string("AT");
usart_trx(0x0D);
DelayMs(5);
usart_trx(0x0A);
while(usart_rx()!='O');
while(usart_rx()!='K');
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);
}
42
Vehicle black box
SNG-EC
return;
}
void mess_send()
{
int i;
gps();
BAUD_RATE=0x19;
TRANSMIT_ENABLE=SET;
usart_string("AT+CMGS=\"+919790673734\"");
usart_trx(0x0D);
DelayMs(5);
usart_trx(0x0A);
DelayMs(50);
43
Vehicle black box
SNG-EC
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);
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;
44
Vehicle black box
SNG-EC
RB5=0;
RB4=1;
DelayUs(10);
RB4=0;
DelayMs(15);
}
void datwrt(char b)
{
char c;
c=b;
b=(b&0xF0)>>4;
PORTB=b;
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);
45
Vehicle black box
SNG-EC
DATA++;
}
DATA=0;
return;
}
#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"
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)
46
Vehicle black box
SNG-EC
{
aa=usart_rx();
datwrt(aa);
count++;
if(count==15)
{
cmdwrt(0X01);
count=0;
}
}
}
#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;
}
47
Vehicle black box
SNG-EC
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"
48
Vehicle black box
SNG-EC
#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];
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)
49
Vehicle black box
SNG-EC
{
mess_recv();
cmdwrt(0x01);
cmdwrt(0x80);
LCD_string("RECORDING...");
if(RC1==1)
goto read;
RC2=RC3=RC4=RC5=1;
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();
50
Vehicle black box
SNG-EC
cmdwrt(0x01);
cmdwrt(0x80);
LCD_string("RECORDING...");
if(RC1==1)
goto read;
RC2=RC3=RC4=RC5=1;
DelayMs(10);
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:
51
Vehicle black box
SNG-EC
cmdwrt(0x01);
cmdwrt(0x80);
LCD_string("ACCIDENT!!!..");
mess_send();
RC1=0;
check();
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);
52
Vehicle black box
SNG-EC
}
}
RC2=RC3=RC4=RC5=1;
DelayMs(10);
}
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
53
Vehicle black box
SNG-EC
void check()
{
BAUD_RATE=0x19;
cmdwrt(0xC0);
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;
54
Vehicle black box
SNG-EC
TRISC3=0;
TRISC4=0;
TRISC5=0;
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;
55
Vehicle black box
SNG-EC
RCIE=0;
mess_send();
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++)
{
56
Vehicle black box
SNG-EC
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;
}
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
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
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;
}
if(pp=='3')
59
Vehicle black box
SNG-EC
{
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;
}
}
60
Vehicle black box
SNG-EC
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;
}
}
void flags()
{
int i;
61
Vehicle black box
SNG-EC
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);
usart_trx(0x1A);
usart_trx(0x0D);
usart_trx(0x0A);
DelayMs(250);
GIE=1;
62
Vehicle black box
SNG-EC
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()
{
char a=0,b=0;
int tempr=0,l;
adc(0,0);
cmdwrt(0x01);
cmdwrt(0x80);
63
Vehicle black box
SNG-EC
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);
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;
64
Vehicle black box
SNG-EC
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 ");
gsm_init();
cmdwrt(0x80);
LCD_string("GSM INITIALIZED");
RC2=RC3=RC5=1;
for(l=0;l<16;l++) DelayMs(250);
while(1)
{
events();
65
Vehicle black box
SNG-EC
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
Vehicle black box
SNG-EC
CHAPTER-6
67
Vehicle black box
SNG-EC
68
Vehicle black box
SNG-EC
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.
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.
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.
PCB PARAMETERS
Clearance - 60mil
On board - Through
PCB LAYOUT
70
Vehicle black box
SNG-EC
71
Vehicle black box
SNG-EC
72
Vehicle black box
SNG-EC
73
Vehicle black box
SNG-EC
CHAPTER-7
ADVANTAGES
74
Vehicle black box
SNG-EC
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
75
Vehicle black box
SNG-EC
CHAPTER -8
76
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.
77
Vehicle black box
SNG-EC
CHAPTER -9
78
Vehicle black box
SNG-EC
REFERENCE
• www.electronicsforu.com
• www.example projects.com
• www.constructionofpojects .com
• www.studyelectronics .com
• www.electroniccomponents .com
79
Vehicle black box
SNG-EC
CHAPTER -10
80
Vehicle black box
SNG-EC
APPENDIX
81
Vehicle black box
SNG-EC
82
Vehicle black box
SNG-EC
83
Vehicle black box
SNG-EC
84
Vehicle black box
SNG-EC
85
Vehicle black box
SNG-EC
86
Vehicle black box
SNG-EC
87