Overview
In this project we will build a prototype of a Digital Taxi Fare Meter using Arduino & Speed Sensor. This project calculates the speed and distance traveled by the taxi’s wheel using the LM393 Speed Sensor. The LCD Display will display the speed and distance traveled continuously. It also generates the final fare amount when we press the push button.
The overall idea of this project is to develop a cost-effective fare meter that can accurately measure the distance and also can give solutions to fare payment difficulties. Using this technology we can digitize the current system in such a way that would be convenient both for the driver, vehicle owner, and passenger.
The display unit displays the parameters by means of the number of rotations of the wheel using the LM393-based Speed Sensor. This system mainly consists of an Arduino board, a Liquid Crystal Display, and Slotted Encoder.
Bill of Materials
Following is the list of materials for making the Arduino Digital Taxi Fare Meter project. You can purchase all these components online from the Amazon link.
| S.N. | Components | Quantity | Purchase Link |
|---|---|---|---|
| 1 | Arduino Nano Board | 1 | Amazon | AliExpress |
| 2 | LM393 Speed Sensor + Encoder Wheel | 1 | Amazon | AliExpress |
| 3 | 16x2 I2C LCD Display | 1 | Amazon | AliExpress |
| 4 | 10K Potentiometer | 1 | Amazon | AliExpress |
| 5 | 1K Resistor | 1 | Amazon | AliExpress |
| 6 | Push Button Switch | 1 | Amazon | AliExpress |
| 7 | ULN2003 Motor Driver IC | 1 | Amazon | AliExpress |
| 8 | 6-12V DC Motor | 1 | Amazon | AliExpress |
| 9 | Zero PCB | 1 | Amazon | AliExpress |
| 10 | 9V Power Adapter | 1 | Amazon | AliExpress |
LM-393 Speed Sensor Module
The LM-393 module is an IR counter that has an IR transmitter and receiver. The Infrared Light sensor consists of the light source (IR-LED) and a phototransistor sensor. If any obstacle is placed between these sensors, an interrupt signal is generated which is sent to the microcontroller.
It requires an encoder disc to count the number of times the sensor goes low to high or vice versa, we can calculate the revolution in a given period of time.
The module can be used in association with a microcontroller for motor speed detection, pulse count, position limit, etc.
Features
- Main Chip: LM393
- Working Voltage: 3.3V to 5V
- Output Form: digital switch output (0 and 1)
- Output: Covered, output high level; Without sunscreen, the output is low level
- Slotted Width: 5mm
Pinout
- VCC: Connect the positive 3.3v-5v power supply
- GND: Connect power negative
- DO: TTL switch signal output
- AO: Analog output
Digital Taxi Fare Meter using Arduino & Speed Sensor
Now let us see the circuit diagram for Digital Taxi Fare Meter made using Arduino & LM-393 Speed Sensor Module. The connection is fairly simple.
Connect the 16X2 LCD Display I2C SDA/SCL Pins to Arduino A4/A5 Pin. Similarly, connect the digital output pin DO of the Speed Sensor to the D2 of Arduino. The push button is connected to the D3 of Arduino and is pulled low via a 1K resistor.
A push button is used for generating the fare amount when pressed. Similarly, the potentiometer is used for varying speeds of the motor wheel.
As a motor driver IC, we can use ULN2003 Darlington Pair IC & connect its input pin 1 to D8 of Arduino. Connect the output pin 16 of ULN2003 to DC Motor. You can use any DC motor between 5V-12V and power it via a 9V external power supply as in the schematic above.
For the demo purpose, you can use a Robot base and chassis along with the complete body part. The speed sensor LM393 should be attached on one of the wheels from the inside.
The encoder disk should be placed between the gap of the Slotted Speed Sensor.
Project PCB Gerber File & PCB Ordering Online
If you don’t want to assemble the circuit on a breadboard and you want PCB for the project, then here is the PCB for you. I used EasyEDA to design the PCB. The PCB Board for Arduino Digital Taxi Fare Meter looks something like below.
The Gerber File for the PCB is given below. You can simply download the Gerber File and order the PCB from ALLPCB at 1$ only.
You can use this Gerber file to order high quality PCB for this project. To do that visit the ALLPCB official website by clicking here: https://www.allpcb.com/.
You can now upload the Gerber File by choosing the Quote Now option. From these options, you can choose the Material Type, Dimensions, Quantity, Thickness, Solder Mask Color and other required parameters.
After filling all details, select your country and shipping method. Finally you can place the order.
You can assemble the components on the PCB Board.
System Working & Speed + Fare Calculation
In this Arduino Taxi Fare Meter project, we need to measure the Speed of the rotating wheel. For this, we placed the encoder slot between the gap of the Speed Sensor which has a total number of 20 holes in it.
When the slot makes a complete rotation, 20 pulses are calculated. Therefore to calculate speed we need the total number of pulses produced per second.
To get the value of RPM (Revolution Per Minute), multiply the speed by 60.
In order to calculate the distance covered in one rotation, we need to measure the circumference of the wheel, which is given by the formulae:
The wheel used in this project has a diameter of 6.60 cm. So the circumference is 20.7 cm.
In order to calculate the distance traveled, multiply the no. of pulses detected by the circumference.
Divide the total distance by 100 to convert the distance from centimeter to meter.
To get the final total fare amount, multiply the distance traveled by the fare rate. For example in this project, we are assuming the fare rate to be 0.5$ per meter.
Source Code/Program
The source code/program for Fare Meter Arduino is written on Arduino IDE. Before moving to the coding part download and install I2C LCD Library and also the TimerOne Library.
Copy the following code and upload it to the Arduino Nano board.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
#include "TimerOne.h" #include <LiquidCrystal_I2C.h> //https://www.arduino.cc/reference/en/libraries/liquidcrystal-i2c/ LiquidCrystal_I2C lcd(0x27, 16, 2); volatile unsigned int mycounter = 0; volatile unsigned int turns = 0; float turnsperminute = 0; unsigned int speed = 0; void setup() { pinMode(A5, INPUT); pinMode(8, OUTPUT); lcd.init(); lcd.backlight(); lcd.clear(); lcd.setCursor(0, 0); lcd.print(" Welcome To "); lcd.setCursor(0, 1); lcd.print("Taxi Fare Meter"); delay(2000); lcd.clear(); Timer1.initialize(1000000); Timer1.attachInterrupt(timerIsr); attachInterrupt(digitalPinToInterrupt(2), count, RISING); attachInterrupt(digitalPinToInterrupt(3), finalfare, HIGH); } void count() { mycounter++; turns++; delay(10); } void timerIsr() { detachInterrupt(digitalPinToInterrupt(2)); Timer1.detachInterrupt(); lcd.clear(); float speed = (mycounter / 20.0) * 60.0; float totalturns = 230 * (turns / 20); turnsperminute = totalturns / 100; lcd.setCursor(0, 0); lcd.print("Dist:"); lcd.print(turnsperminute); lcd.print("m"); lcd.setCursor(0, 1); lcd.print("Speed:"); lcd.print(speed); lcd.print("rpm"); mycounter = 0; int analoginput = analogRead(A5); int motorspeed = map(analoginput, 0, 1023, 0, 255); analogWrite(8, motorspeed); Timer1.attachInterrupt(timerIsr); attachInterrupt(digitalPinToInterrupt(2), count, RISING); } void finalfare() { detachInterrupt(digitalPinToInterrupt(2)); Timer1.detachInterrupt(); float price = turnsperminute * 0.5; lcd.clear(); lcd.setCursor(0, 0); lcd.print("Fare: "); lcd.print(price); lcd.print("$"); lcd.setCursor(0, 1); lcd.print("0.5$ Per Meter"); } void loop() { } |
Test & Demo of Arduino Taxi Fare Meter
After uploading the code, you can start testing your Arduino Digital Taxi Fare Meter.
Initially the LCD will display the Speed and Distance both as zero.
Rotate the potentiometer so that the motor and wheels start rotating. You can also adjust & vary the speed of the motor using the potentiometer.
After rotating the motor wheel for some time, you can finally stop the motor using a Potentiometer. The speed will become zero but the distance covered is some meters.
Press the push button to calculate the final fare amount in dollars.
The LCD will also display the rate of the distance traveled. In our case, it’s 0.5$ per meter. You can change the rate in your code.




















