Normally, digital speedometers are found only in luxury cars and high-end motorbikes. Even if your motorbike has a mechanical speedometer, what will you do when it gets damaged? First, you need to replace the mechanical worn gear and then the cable. Here we describe how to build a microcontroller based speedometer-cum-odometer for your motorbike. The circuit uses a microcontroller, an LCD display and some commonly available components. It is a better alternative to the mechanical speedometer and even a beginner with minimal skill level can assemble it.
The features of the digital microcontroller based speedometer-cum-odometer are:
1. Digital readout
2. Speed displayed in km/hour
3. Distance traveled displayed in kilometres
4. Readings saved in non-volatile memory (EEPROM)
5. Reliability due to use of the microcontroller
6. No mechanical wear and tear
7. Home-brewed speed transducer/sensor
8. Self reset to zero after completion of 99,999.9 km
9. Easy to build and fix onto the bike
You first need to know the radius of the bike’s front wheel. The calculations here are based on Hero Honda’s Splendor model. The radius of the front wheel is 30 cm. (This can vary with the brand or model.)
Circumference of the wheel= 2πr (where ‘r’ is in cm)
= 188.4 cm or 1.884 metres
Speed: Let’s assume that in 1 second the wheel
completes one revolution. In other words, in one second, the bike has covered 1.88 metres. Therefore the speed in km/hour:
= N×6.784 or N×6.8
where ‘N’ is the number of revolutions per second.
‘6.8’ is a constant and only ‘N’ varies; for example, if ‘N’
is 5, the speed equals 5×6.8= 34 km/hour.
Distance: The odometer is updated every 100 metres.
To cover 100 metres, the wheel is required to make approximately 53 revolutions (100/1.88). The microcontroller takes care of the tasks of revolutions counting, speed calculation, conversion and display of results.
The circuit of the digital microcontroller based speedometer-cum-odometer is shown in Fig. 1. The functions of various components used in the circuit are described below.
A 20-pin AT89C2051 microcontroller from Atmel is used here because of its low pin count, affordability and compatibility with CISC-based 8051 family. All the available pins of the microcontroller are utilised in the project. This microcontroller features 2 kB of Flash, 128 bytes of RAM, 15 input/output (I/O) lines, two 16-bit timers/counters, a five-vector two-level interrupt architecture, a full-duplex serial port, a precision analogue comparator, on-chip oscillator and clock circuitry.
To display the speed and distance traveled, we have used a 16×2 alphanumeric
LCD based on HD44780 controller. The backlight feature of the LCD allows data to be visible even at night.