# Digital Speedometer

### Abstract

In 1998 I had a passion for tuning engines and motors, and I had a 50cc scooter whose engine I brought to 70cc, racing crankshaft, a 19mm carburettor, and something else I enjoyed changing in a small, but well tooled workshop. In particular it had a digital speedometer.

Date

After spending months reading motor and tuning magazines, along with some technical notes from a mechanic friend of mine, I was all into engine tuning and racing. Me and a couple of friends were used to race with our scooters, but we were disappointed with the analog speedometer and quarrels started everytime the top speed entered into the discourse.

I decided to create a digital speedo for my scooter. It was 1998 and apart the main board and the original first draft of the schematic (on paper), nothing is left anymore. Not even the scooter.

I resurrected what I have got left and I am publishing it here. With a note on its inner working.

# The speed problem

Basically speed (velocity) considers the distance covered and the time it takes:

$$v={\frac {d}{t}}$$ where $v$ is velocity, $d$ is distance, and $t$ is time, but an actual motorcycle does not run at a fixed, uniform, speed, so the average velocity is represented by differences:

$$\mathbf{\bar{v}} = \frac{\Delta \mathbf{d}}{\Delta t}$$ Where $\mathbf{\bar{v}}$ is the average velocity, $\Delta \mathbf{d}$ is the change in distance, and $\Delta t$ is the change in time. Average velocity $\mathbf{\bar{v}}$ and change in distance $\Delta \mathbf{d}$ are vector quantities. More over the wheels are circular, so we could take into account the uniform circular motion formula:

$$v=r\omega$$ Where $v$ is tangential speed and $\omega$ (Greek letter omega) is rotational speed.

How could I get the speed of my motorcycle? I started to find a way so I could be certain that the wheel had made one full circle on the tarmac, thus its full circumference had been through. That is space.

$$v={\frac {2\pi r}{t}}$$

If I remember correctly, the circumference of my scooter’s wheel was something more than one linear meter.

# Getting the space and avoid the sun

Applying simply a infrared LED and a photodiode on a fork across one row of disc brake cooling holes, I easily got six impulses per each wheel revolution. So initially I thought, and actually it worked… at night only!

The sun interference and reflections on the disc during the day simply saturated the photodiode thus giving zero impulses. So the IR diode had to be modulated in PWM to avoid interference - and demodulated to get the actual pulses.

# The real time trick

So now I had the space and the time, but still I wanted to display the speed in Km/h (or mph) in the most real-time manner. I spend nights and nights to find out how to solve this problem, trying PIC microcontrollers, even a 6502 processor, but all were too slow to make a simple floating point division between the distance, the measured time and the wheel circumference.

Yes, the wheel circumference was the only constant: 1.6 meters (or so). Then I realized I just needed a hardware look-up table and the calculations could have been made offline and stored into two EPROMs: one for the units and the other for the tens. I wrote a simple software in C to calculate all speed values up to 120 Km/h. I stored the values on a binary file, taking into account the 7 segment display encoding - so I saved space on the board, and burned the EPROMs with the programmer. The values exceeding 99 Km/h were easily to get by using the counter ripple to turn on just two segments on a third LED display.

# Old Schematic

Only recently I found out one of the many schematic drafts I was used to make at school during boring lessons. It dates back to 1997 and was sketched on a squared sheet with lots of notes.

I used the impulses from the sensor to drive a CMOS CD4040 12-bit counter and once decided the update frequency would have been 1 Hz (using a NE555 of course), so each second I would get a speed update, using a double NOT delay line, I could trigger both the counter reset and set or clear a 8 bit memory latch, the 74LS273. The latter was used to address two 2764 EPROMs, whose outputs connected to a octal buffer 74LS244 each, would then drive the display LED directly.

# The main board

These are the pictures of the main board prototype, back and front. The hand wiring looks bad, as I did not have proper colored wires so I used all surplus materials. The empty DIL socket was used to connect to the display board.

# The display board

The display board depicted on this photos is a fake, but pretty much the original one was similar. I wanted to add the odometer and the fuel gauge but life went on with new things, and it stayed put 😄