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.
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.
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.
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.
modifications between MPGduino schematic and this one.
The Code Behind the Scenes
- Adding a serial printer to the mix
- Logging data
Rensselaer Polytechnic Institute
Electrical & Electrical Power