MPG-meter For Vehicles with Mech. Speedometers


I wanted to build an mpg-meter, so i could see some feedback on my driving habits.

To calculate active MPG, simply divide distance by fuel used. Distance can be integrated over time from a speedometer to get miles per second and fuel used can be found from integrating injector pulsewidth over time to get gallons per second. Simple right?

So whats the catch?

Well, as murphy's law dictates, something will always not go to plan. In this case, my assumption that the speedometer was just a variable pulse width going to an analog gague was completley wrong.  I quickly learned that things were done different back in the day where mechanical things ruled the land.

(Jump to images & how to)

Types of speedometers through-out the ages

The basis behind a mechanical speedometer is that a mechanical linkage, basically a well lubricated cable) spins at a speed proportional to wheel speed. this enclosed cable travels the length of the vehicle (from the back differential in my case) all the way to the back of the dashboard.  at the dashboard a mechanical device converts rpm of the shaft to miles per hour. Suprising as it sounds, the spinning shaft is connected to a magnet. this magnet spins inside an aluminum cup. The spinning magnet induces an eddy current in the aluminum, causing the aluminum disk to move in the same direction as the spinning magnet. the aluminum disk is fighting a weak spring with a well defined spring constant, so, as magnet rpm increases the induced eddy force on the aluminum cup increases, and the position of the aluminum disk fights the weak spring. the postion of this aluminum disk is now your speedometer. 

a mechanical derivative machine, all to find vehicle speed. Apparentley this made monetary sense at one point in time.

Kinda mechanical

a small genorator type device would be installed on the vehicle's drive axel (outside the diff or trans probably). the generator would output a voltage proportional to vehicle speed. Basically, an analog voltmeter would be functioning as a speedometer. The drawback is any resistance would cause a skew in the speed value produced by this method.


A magnet sensor would replace the dynamo-generator. In this case, a pulse would be produced / rotation. this variable pwm would be interpreted by a digital circuit and convert the pwm into speed electronically.

Creating a second speedometer

I didnt want to interfere with my current mechanical speedometer, so i used an IR beam break sensor mounted to my vehicle's underside right alongside the driveshaft. The driveshaft speed is proportional to the vehicle speed.


Here's a view of a simple beambrake sensor, from a non-pulsed ir source. This is a really simple device: if IR light is present there's a logic on. If IR light isnt present, there's a logic 0.  Based on the on/off ratio, the driveshaft speed can be determined. 
So here's the IR beam break sensor mounted on aluminum angle iron.

3. Here's an image of the driveshaft and beam-break sensor. later on i ring-clamped a protrusion on the driveshaft so that the ir beam is broken as the shaft spins. "wouldnt this make the shaft unbalanced?" yes it does, but my newfound engineering friends at GM said it'd be ok, and this project is in the name of science, so i went for it.

4. The beam break sensor required +12, gnd, and provided a logic output, so i resistivley divided the output to become 0-5v instead of 0-12v.

5. I wired everything together (shcematic link) so that the interrupt from the injector pwm and the driveshaft pwm could be used by the micro (5v logic). i also housed the lcd in a project box (radioshack) so that it would look semi-nice.

The Schematic
(coming soon)

modifications between MPGduino schematic and this one.
(coming soon)

The Code Behind the Scenes
(coming soon)

Future modifications(linked):
- Adding a serial printer to the mix
- Logging data

Rensselaer Polytechnic Institute 
Electrical & Electrical Power

Free Domain Names @ .co.nr!