loading
WORKING – First when the vehicle starts running it displays the minimum charge. The minimum charge gets incremented every 200m. The meter also displays the distance travelled & the speed. It also has the facility to record waiting time in case of waiting & to calculate the waiting change custom has facility of cashless travel with the help of prepaid card. The charge of the travel is going to be debited from his prepaid card account.

Step 1:

LIST OF COMPONENT


Item Number Quantity Value Description Part Number Part Reference
1 1 22p C1
2 1 22p C2
3 1 10u/16v C3
4 1 10uf C6
5 1 10uf C7
6 1 10uf C8
7 1 10uf C9
8 1 10uf C14
9 1 1n4001 D1
10 1 LED D2
11 1 LED D3
12 1 LED D4
13 1 LED D5
14 1 LED D6
15 1 LED D7
16 1 LED D8
17 1 LED D9
18 1 LED D10
19 1 CON16 J10
20 1 CON2 J11
21 1 CON3 J12
22 1 CON3 J13
23 1 CON4 J14
24 1 CON8 J16
25 1 CON16 J17
26 1 CON8 J18
27 1 CONNECTOR DB9 P1
28 1 10k R1
29 1 RESISTOR SIP 9 R3
30 1 10k R4
31 1 330 R5
32 1 R R6
33 1 R R7
34 1 R R8
35 1 R R9
36 1 R R10
37 1 R R11
38 1 R R12
39 1 R R13
40 1 SW TACT-SPST SW1
41 1 SW PUSHBUTTON SW2
42 1 SW TACT-SPST SW3
43 1 SW TACT-SPST SW4
44 1 SW TACT-SPST SW5
45 1 SW TACT-SPST SW6
46 1 SW TACT-SPST SW7
47 1 SW TACT-SPST SW8
48 1 SW TACT-SPST SW9
49 1 8052 U1
50 1 MAX232 U2
51 1 LM7805/TO U3
52 1 LM7812/TO U4
53 1 11.0592 Y1

 

Step 2:


PCB DESIGNING SYSTEM



















Step 3: Some Image

Step 4: Program in C Languagemy Lo

this is an example program but u can get the idea of programing.


#include
#include
#include "24LC256.h"
#include
/*----------------------------------------------------
****** port and bit assignment for LCD *******
----------------------------------------------------*/
#define TH0RELOAD_VALUE 0X3c
#define TL0RELOAD_VALUE 0Xb0
#define wheel_diameter 5
#define TRUE 1
#define LED_DSP P2 // LED Display (7 segments LED)


typedef unsigned char bit_8;

bit_8 g_byCountOf50ms;
code unsigned char num_led[16] =
{0x3F,0x06,0x5B,0x4F,0x66, //0,1,2,3,4
0x6D,0x7D,0x07,0x7F,0x6F, //5,6,7,8,9
0x77,0x7C,0x39,0x5E,0x79, //A,b,C,d,E
0x71};

unsigned char sensor_variable,speed,switch_inc_variable;
unsigned char waiting_time_chargevariable,charge_pulse;
unsigned char EData;
float distance_temp;
unsigned int distance=0,distance_temp2=0,distance_temp1;
unsigned int waiting_time_temp,waiting_time,chargevariable,charge_variable=8;
bit distance_inc_flag,switch_mode_flag,change_status_flag,device1_flag,device2_flag,device3_flag,device4_flag,device5_flag,device6_flag,device7_flag,device8_flag;
bit run_bit;

code bit_8 *val[]={"0","1","2","3","4","5","6","7","8","9","10","11","12"}; // digit array
code unsigned char *route1[]={"MP nagar ","MP nagar ","MP nagar ","MP nagar ","MP nagar "};
code unsigned char *route2[]={"5-No Stop ","Arera Colony ","T T Nagar ","Ayodhya ","Piplani "};
code unsigned char *charge[]={"Max Charge=50Rs ","Max Charge=60Rs ","Max Charge=200Rs","Max Charge=200Rs","Max Charge=60Rs"};
code unsigned char *distance1[]={"MaxDistance=15km","MaxDistance=25km","MaxDistance=30km","MaxDistance=35km","MaxDistance=13km"};
sbit rs=P0^0; // register select is port 3.5
sbit rw=P0^1; // read/write is port 3.4
sbit en=P0^2; // enable is port 3.3
sbit d7=P1^7; // busy flag is port 1.7
sbit DSP1 = P0^3; // DSP1 enable (Active Low level)
sbit DSP2 = P0^4; // DSP2 enable (Active Low level)
sbit DSP3 = P0^5; // DSP3 enable (Active Low level)
sbit Dot_Point = P2^7;
sbit route_selection=P0^7;
sbit run=P0^6;
sbit prepaid=P0^5;




void command(bit_8);
void data_in(bit_8*);
void initlcd(void);
void display_numeric(bit_8 );
void display_int(unsigned int);
void delay (unsigned int);
void display_led(int num, int dly);



void external0 ()interrupt 0
{
sensor_variable++;
charge_pulse++;
waiting_time_temp=0;
EX0=0;

}


void timer1 ()interrupt 3
{

}



void timer0 () interrupt 1
{
TH0 = TH0RELOAD_VALUE ;
TL0 = TL0RELOAD_VALUE ;
g_byCountOf50ms ++ ;

if(charge_pulse==10)
{
charge_variable=charge_variable+2;
charge_pulse=0;

}
if (g_byCountOf50ms >= 20)
{
// it means 1 second (50 ms X 20) is over
g_byCountOf50ms = 0 ;
//calculating the temp distance for 1 secound
distance_temp=distance_temp1=sensor_variable*wheel_diameter;
//calculating the speed in 1 secound
speed=distance_temp/0.0166;

distance_temp2=distance_temp2+distance_temp1;

//calculating the total distace from the distance_temp1
distance=distance_temp1+distance;
waiting_time_temp++;
sensor_variable=0;
// if(distance_fare)

if(waiting_time_temp>20)
{
waiting_time++;
waiting_time_chargevariable++;
}
if(waiting_time_chargevariable>10)
{
chargevariable++;
waiting_time_chargevariable=0;
}



}

}







void main()
{



unsigned char route_selection_variable;
route_selection=1;
run=1;
prepaid=1;



initlcd();

command(0x80);
data_in ("AutomatedDigital");
command(0xc0);
data_in ("***Taxi Meter***");
command(0x90);
data_in ("Pres * To List");
command(0xd0);
data_in ("Pres # To Run ");

TMOD = 0x01 ;
TCON = 0x11 ;
// IE = 0x83 ;

while(1)
{
if(route_selection==0)
{
command (0x80);
data_in (route1[route_selection_variable]);
command (0xc0);
data_in (route2[route_selection_variable]);
command (0x90);
data_in (charge[route_selection_variable]);
command (0xd0);
data_in (distance1[route_selection_variable]);
route_selection_variable++;
delay (100);
if(route_selection_variable==4)
{
route_selection_variable=0;
}

}
if(run==0)
{
run_bit=1;
initlcd();
IE = 0x83 ;

}
if(prepaid==0)
{
initlcd();
command (0x80);
data_in ("Prepaid mode");
command (0xc0);
data_in ("CustomerID=");
DelayMs(50);
EData = ReadBYTE(0x00); // read back
command (0xcb);
display_int(EData);
command (0x90);
data_in ("Secret ID=");
EData = ReadBYTE(0x01); // read back
command (0x9b);
display_int(EData);

}

if(run_bit==1)
{
EX0=1;
command (0x80);
data_in ("Trav Dist=");
command (0x8a);
display_int (distance);
command (0xc0);
data_in ("Speed=");
command (0xc6);
display_int (speed);
command (0xcb);
data_in ("km/hr");
command (0x90);
data_in ("Wait Time=");
command (0x9a);
display_int (waiting_time);
command (0xd0);
data_in ("Wait crgs=");
command (0xda);
display_int(chargevariable);
display_led(charge_variable,150);
// display_led(waiting_time,150);

}

// delay (1000);






}
}


/*--------------------------
*** initialising the LCD ***
--------------------------*/

void initlcd()
{
command(56);
command(0x01);
command(0x02);
command(12);
}

/*----------------------------
*** checking the busy flag ***
----------------------------*/

void busy()
{
d7=1;
rs=0;
rw=1;
while(d7!=0)
{
en=0;
en=1;
}
}

/*-------------------------
*** send command to LCD ***
-------------------------*/

void command(bit_8 val)
{
busy();
P1=val;
rs=0;
rw=0;
en=1;
en=0;
}

/*--------------------------
*** entering data to LCD ***
--------------------------*/

void data_in(bit_8 *string)
{
bit_8 i;
busy();
for(i=0;string[i]!='\0';i++)
{
P1=string[i];
rs=1;
rw=0;
en=1;
en=0;
}
}










void display_int(unsigned int i)
{
unsigned char ten_thousands,thousands,hundreds,tens,ones;
ten_thousands=i/10000;
data_in(val[ten_thousands]);
i=i%10000;
thousands=i/1000;
data_in(val[thousands]);
i=i%1000;
hundreds=i/100;
data_in(val[hundreds]);
i=i%100;
tens=i/10;
data_in(val[tens]);
ones=i%10;
data_in(val[ones]);

}




void delay(unsigned int k)
{
unsigned int i,j;
for(i=0;i<=k;i++)
for(j=0;j<=100;j++);
}

void display_led(int num, int dly) {
int i,n1, n2,n3;

n1 = (int)(num/100); // Division operator (53/10=5)
num = (int) (num%100);
n2 =(int) (num/10);
n2 = (int)(num%10); // Modules operator (53%10=3)

for(i=0; i DSP1 = 0; // DSP1 enable active
DSP2 = 1;
DSP3 = 0;
LED_DSP = num_led[n3];
delay(1);
DSP2 = 0; // DSP2 enable active
DSP1 = 1;
DSP3 = 0;
LED_DSP = num_led[n2];
delay(1);
DSP2 = 0; // DSP2 enable active
DSP1 = 0;
DSP3 = 1;
LED_DSP = num_led[1];
delay(1);
}
}
/*
void display_led(int num, int dly) {
int i,n1,n2,n3;

n1 = (int)(num/100); // Division operator (321/100=3)
num = (int)(num%100); // Modules operator (321%100=21)
n2 = (int)(num/10); // Division operator (21/10=2)
n3 = (int)(num%10);

for(i=0; i DSP1 = 1; // DSP1 enable active
DSP2 = 0;
DSP3 = 0;
LED_DSP = num_led[n3];
delay(1);
DSP2 = 1; // DSP2 enable active
DSP1 = 0;
DSP3 = 0;
LED_DSP = num_led[n2];
delay(1);
DSP3 = 1; // DSP2 enable active
DSP1 = 0;
DSP2 = 0;
LED_DSP = num_led[n1];
delay(1);
}
} */
#include
#include
#include "24LC256.h"
#include
/*----------------------------------------------------
****** port and bit assignment for LCD *******
----------------------------------------------------*/
#define TH0RELOAD_VALUE 0X3c
#define TL0RELOAD_VALUE 0Xb0
#define wheel_diameter 5
#define TRUE 1
#define LED_DSP P2 // LED Display (7 segments LED)


typedef unsigned char bit_8;

bit_8 g_byCountOf50ms;
code unsigned char num_led[16] =
{0x3F,0x06,0x5B,0x4F,0x66, //0,1,2,3,4
0x6D,0x7D,0x07,0x7F,0x6F, //5,6,7,8,9
0x77,0x7C,0x39,0x5E,0x79, //A,b,C,d,E
0x71};

unsigned char sensor_variable,speed,switch_inc_variable;
unsigned char waiting_time_chargevariable,charge_pulse;
unsigned char EData;
float distance_temp;
unsigned int distance=0,distance_temp2=0,distance_temp1;
unsigned int waiting_time_temp,waiting_time,chargevariable,charge_variable=8;
bit distance_inc_flag,switch_mode_flag,change_status_flag,device1_flag,device2_flag,device3_flag,device4_flag,device5_flag,device6_flag,device7_flag,device8_flag;
bit run_bit;

code bit_8 *val[]={"0","1","2","3","4","5","6","7","8","9","10","11","12"}; // digit array
code unsigned char *route1[]={"MP nagar ","MP nagar ","MP nagar ","MP nagar ","MP nagar "};
code unsigned char *route2[]={"5-No Stop ","Arera Colony ","T T Nagar ","Ayodhya ","Piplani "};
code unsigned char *charge[]={"Max Charge=50Rs ","Max Charge=60Rs ","Max Charge=200Rs","Max Charge=200Rs","Max Charge=60Rs"};
code unsigned char *distance1[]={"MaxDistance=15km","MaxDistance=25km","MaxDistance=30km","MaxDistance=35km","MaxDistance=13km"};
sbit rs=P0^0; // register select is port 3.5
sbit rw=P0^1; // read/write is port 3.4
sbit en=P0^2; // enable is port 3.3
sbit d7=P1^7; // busy flag is port 1.7
sbit DSP1 = P0^3; // DSP1 enable (Active Low level)
sbit DSP2 = P0^4; // DSP2 enable (Active Low level)
sbit DSP3 = P0^5; // DSP3 enable (Active Low level)
sbit Dot_Point = P2^7;
sbit route_selection=P0^7;
sbit run=P0^6;
sbit prepaid=P0^5;




void command(bit_8);
void data_in(bit_8*);
void initlcd(void);
void display_numeric(bit_8 );
void display_int(unsigned int);
void delay (unsigned int);
void display_led(int num, int dly);



void external0 ()interrupt 0
{
sensor_variable++;
charge_pulse++;
waiting_time_temp=0;
EX0=0;

}


void timer1 ()interrupt 3
{

}



void timer0 () interrupt 1
{
TH0 = TH0RELOAD_VALUE ;
TL0 = TL0RELOAD_VALUE ;
g_byCountOf50ms ++ ;

if(charge_pulse==10)
{
charge_variable=charge_variable+2;
charge_pulse=0;

}
if (g_byCountOf50ms >= 20)
{
// it means 1 second (50 ms X 20) is over
g_byCountOf50ms = 0 ;
//calculating the temp distance for 1 secound
distance_temp=distance_temp1=sensor_variable*wheel_diameter;
//calculating the speed in 1 secound
speed=distance_temp/0.0166;

distance_temp2=distance_temp2+distance_temp1;

//calculating the total distace from the distance_temp1
distance=distance_temp1+distance;
waiting_time_temp++;
sensor_variable=0;
// if(distance_fare)

if(waiting_time_temp>20)
{
waiting_time++;
waiting_time_chargevariable++;
}
if(waiting_time_chargevariable>10)
{
chargevariable++;
waiting_time_chargevariable=0;
}



}

}







void main()
{



unsigned char route_selection_variable;
route_selection=1;
run=1;
prepaid=1;



initlcd();

command(0x80);
data_in ("AutomatedDigital");
command(0xc0);
data_in ("***Taxi Meter***");
command(0x90);
data_in ("Pres * To List");
command(0xd0);
data_in ("Pres # To Run ");

TMOD = 0x01 ;
TCON = 0x11 ;
// IE = 0x83 ;

while(1)
{
if(route_selection==0)
{
command (0x80);
data_in (route1[route_selection_variable]);
command (0xc0);
data_in (route2[route_selection_variable]);
command (0x90);
data_in (charge[route_selection_variable]);
command (0xd0);
data_in (distance1[route_selection_variable]);
route_selection_variable++;
delay (100);
if(route_selection_variable==4)
{
route_selection_variable=0;
}

}
if(run==0)
{
run_bit=1;
initlcd();
IE = 0x83 ;

}
if(prepaid==0)
{
initlcd();
command (0x80);
data_in ("Prepaid mode");
command (0xc0);
data_in ("CustomerID=");
DelayMs(50);
EData = ReadBYTE(0x00); // read back
command (0xcb);
display_int(EData);
command (0x90);
data_in ("Secret ID=");
EData = ReadBYTE(0x01); // read back
command (0x9b);
display_int(EData);

}

if(run_bit==1)
{
EX0=1;
command (0x80);
data_in ("Trav Dist=");
command (0x8a);
display_int (distance);
command (0xc0);
data_in ("Speed=");
command (0xc6);
display_int (speed);
command (0xcb);
data_in ("km/hr");
command (0x90);
data_in ("Wait Time=");
command (0x9a);
display_int (waiting_time);
command (0xd0);
data_in ("Wait crgs=");
command (0xda);
display_int(chargevariable);
display_led(charge_variable,150);
// display_led(waiting_time,150);

}

// delay (1000);






}
}


/*--------------------------
*** initialising the LCD ***
--------------------------*/

void initlcd()
{
command(56);
command(0x01);
command(0x02);
command(12);
}

/*----------------------------
*** checking the busy flag ***
----------------------------*/

void busy()
{
d7=1;
rs=0;
rw=1;
while(d7!=0)
{
en=0;
en=1;
}
}

/*-------------------------
*** send command to LCD ***
-------------------------*/

void command(bit_8 val)
{
busy();
P1=val;
rs=0;
rw=0;
en=1;
en=0;
}

/*--------------------------
*** entering data to LCD ***
--------------------------*/

void data_in(bit_8 *string)
{
bit_8 i;
busy();
for(i=0;string[i]!='\0';i++)
{
P1=string[i];
rs=1;
rw=0;
en=1;
en=0;
}
}










void display_int(unsigned int i)
{
unsigned char ten_thousands,thousands,hundreds,tens,ones;
ten_thousands=i/10000;
data_in(val[ten_thousands]);
i=i%10000;
thousands=i/1000;
data_in(val[thousands]);
i=i%1000;
hundreds=i/100;
data_in(val[hundreds]);
i=i%100;
tens=i/10;
data_in(val[tens]);
ones=i%10;
data_in(val[ones]);

}




void delay(unsigned int k)
{
unsigned int i,j;
for(i=0;i<=k;i++)
for(j=0;j<=100;j++);
}

void display_led(int num, int dly) {
int i,n1, n2,n3;

n1 = (int)(num/100); // Division operator (53/10=5)
num = (int) (num%100);
n2 =(int) (num/10);
n2 = (int)(num%10); // Modules operator (53%10=3)

for(i=0; i DSP1 = 0; // DSP1 enable active
DSP2 = 1;
DSP3 = 0;
LED_DSP = num_led[n3];
delay(1);
DSP2 = 0; // DSP2 enable active
DSP1 = 1;
DSP3 = 0;
LED_DSP = num_led[n2];
delay(1);
DSP2 = 0; // DSP2 enable active
DSP1 = 0;
DSP3 = 1;
LED_DSP = num_led[1];
delay(1);
}
}
/*
void display_led(int num, int dly) {
int i,n1,n2,n3;

n1 = (int)(num/100); // Division operator (321/100=3)
num = (int)(num%100); // Modules operator (321%100=21)
n2 = (int)(num/10); // Division operator (21/10=2)
n3 = (int)(num%10);

for(i=0; i DSP1 = 1; // DSP1 enable active
DSP2 = 0;
DSP3 = 0;
LED_DSP = num_led[n3];
delay(1);
DSP2 = 1; // DSP2 enable active
DSP1 = 0;
DSP3 = 0;
LED_DSP = num_led[n2];
delay(1);
DSP3 = 1; // DSP2 enable active
DSP1 = 0;
DSP2 = 0;
LED_DSP = num_led[n1];
delay(1);
}
} */ 

Step 5: This Is How My Model Looks Like


About This Instructable

9,739views

4favorites

License:

More by xyber:Digital Taxi Meter 
Add instructable to: