You are viewing an older revision! See the latest version

Speaking Taxi meter

Speaking Taxi Meter : A project to assist the blind

Project by Pranav Pralhad Sawant and Aditya Shrikant Kadam

Purpose and idea behind this project

In India, people most often use the public transport while going around places and Taxis are the most common medium. The fare of the Taxi is based on the duration of the journey which indirectly depends upon the distance covered. The Taxi union of India decides the distance fare ratio and thus the fare is calculated. However, the current meters used in India are mechanical and can be manipulated to read a different meter value than the real ones. Also, some taxi drivers even end up demanding more money from the visually impaired people, as they are not able to read the meter values and often end up paying more. This is also the case with the foreign tourists visiting India. Although, the tourists can read the meter value, they do not have access to the meter fare ratio and have to blindly pay what the taxi driver asks for. Moreover, when it comes to change in fare regulations, all the taxi meters need to be sometimes re-calibrated which is a very time consuming process, with the meters being mechanical. Our project aims to address these issues by making the meter mechanism completely automated by taking advantage of the vast expanding internet and embedded systems domain.

Modules used for accomplishing aims

  • DC motor : To replicate a rotating wheel of the taxi
  • IR sensor : To calculate the Number of revolutions of the wheel.
  • MBED chip : For integration of all the involved peripherals and logic implementation.
  • MicroSD card : For storing converted voice reading.
  • VS1053 : A mp3 encoder module necessary for encoding the mp3, in our case the text converted voice fare.
  • Audio Jack : A jack for facilitating connection to speakers.
  • Ethernet : To send a text (fare) to google translate service and get back a mp3 file(text to speech) containing the audio format of the fare.
  • LCD : To display the meter reading and the corresponding fare.

Connections

MBEDVS1053Headphone jack
3.3VVout
Micn
15RST
16DREQ
GPIO2
GPIO3
17Bsync
TX
RX
GndGnd
RightRSH
GbufGND
LeftTSH
GPIO1
GPIO0
6SO
5SI
7SCK
14CS


MicroSDMBED
CS8
DI11
VCC3.3V
SCK13
GNDGND
DO12


NetworkingMBED
P1TD1
P2TD-
P7RD+
P8RD-
P33.3V
P63.3V
GS1GND
GS2GND


LCDMBED
GND0V
VCC5V
VO1k resistor OV
RS10
RW0V
E18
D0
D1
D2
D3
D424
D523
D622
D721

Code

#include "mbed.h"
#include "VS1002.h"
#include "TextLCD.h"
#include "EthernetNetIf.h"
#include "HTTPClient.h"
#include "DebounceIn.h"
#include <string>
#include<stdlib.h>
#define PI 3.14
#define DIAMETER 0.076 
#define MINIMUM_FARE 11
#define FARE_PER_KM 10

TextLCD fareDisplay(p10, p18, p24, p23, p22, p21, TextLCD::LCD16x2 );
VS1002 audioDriver(p11, p12, p13, p8, "sd",
           p5, p6, p7, p14, p15,
           p16, p17, p20);
EthernetNetIf ethernet;                 
HTTPClient http;                   
AnalogIn sensorReading(p19);
DebounceIn setup(p9);
DebounceIn startMeter(p20);
DebounceIn stopMeter(p30);

void initializeAudioDriver()
{
#ifndef FS_ONLY
    audioDriver._RST = 1;
    audioDriver.cs_high();                                   
    audioDriver.sci_initialise();                            
    audioDriver.sci_write(0x00,(SM_SDINEW+SM_STREAM+SM_DIFF));
    audioDriver.sci_write(0x03, 0x9800);
    audioDriver.sdi_initialise();
#endif
}

float calculateFare(int noOfRevolutions)
{
    float distanceinKM;    
    distanceinKM = noOfRevolutions*PI*DIAMETER;//For Demo purposes we do not divide by 1000 as would be in real scenario.
    float fare;
    if(distanceinKM>1)
    fare = MINIMUM_FARE + FARE_PER_KM*(distanceinKM - 1); // Formula can be changed as per required or can be taken dynamically from a web server
    else
    fare = MINIMUM_FARE;
    return fare;
}


void convertFareToSpeech(float fare)
{
    string ttsURL=" http://translate.google.com/translate_tts?tl=en&q=Your+Fare+is+;+";
    char strFare[100];
    sprintf(strFare,"%d",(int)fare);
    ttsURL+=strFare; 
    ttsURL+="+Rupees+.+Thank+you+for+the+ride+.+Have+a+Nice+Day+.";
    printf("%s\n",ttsURL);
    HTTPFile audioOutput("/sd/Fare.mp3");
    HTTPResult result = http.get(ttsURL.c_str(),&audioOutput);
    if(result!=HTTP_OK)
    {
          printf("Error during speech convrsion!! Error Number : %d\n", result);
    }
    else
    printf("Done\n");
    audioDriver.play_song("/sd/Fare.mp3");
    
}

void initialize_system()
{
    
setup.mode(PullUp);
wait(0.001);
startMeter.mode(PullUp);
wait(0.001);
stopMeter.mode(PullUp);
wait(0.001);
wait(2);
printf("Press setup to continue....\n");
}

int main()
{ 
bool flag = false;
int noOfRevolutions =0;
float fare;
bool isMeterStopped=false;

initialize_system();

while(setup==1){wait(0.1);}
while(setup == 0){wait(0.1);}

initializeAudioDriver();        
EthernetErr error = ethernet.setup();
if(error)
{
    printf("Error in correction. Error number: %d.\n", error);
    return -1;
}
printf(" Connection established\n");
printf("Start Meter to continue.......\n");
while(startMeter==1){wait(0.1);}
while(startMeter==0){wait(0.1);}
int new_val = 0;
int old_val =0;
printf("Meter Startted !! Please press Stop button to stop counting\n");
while(!isMeterStopped)
{
    if(sensorReading>0.80)
    {
        flag=true;
        wait(0.2);
    }
    if(flag)
    {
        if(sensorReading<0.2)
        {
            flag=false;
            noOfRevolutions++;    
        }
    }
    new_val = stopMeter;
    if ((new_val==0) && (old_val==1))
    {        
       isMeterStopped = true;
       printf("Meter Stopped !!!\n");
    }   
     old_val=new_val; 
     wait(0.2);
}

 if(isMeterStopped)
 {
    isMeterStopped = false;
    fare = calculateFare(noOfRevolutions);
    printf("The total no of Revolutions is: %d\nThe Fare is: %f\n", noOfRevolutions,fare);
    convertFareToSpeech(fare);
 }   
   
}


All wikipages