AVR 2004 Design Contest – First Prize
This low-cost project measures fuel consumption in real time. An ATmega8515 microcontroller collects vehicle speed and airflow data from the vehicle’s engine computer using the SAE J1850 VPW bit-serial bus, which is one of the on-board diagnostic buses required by the OBD-II standard. A modified off-the-shelf electronic tachometer is used as an analog display to show the consumption rate in miles per gallon. Only a few extra components are necessary for this efficient project, including transistors, diodes, resistors, and capacitors. Special automotive bus interface chips are unnecessary.
With the new and improved price of gasoline here in the U.S. many of us that own large SUVs want to know our fuel consumption efficiency while we are driving. Some newer vehicles display this “real time” data on a dashboard display, but those of us with older cars were out of luck…until now. If you drive a 1996 or newer “gas guzzler” made by General Motors you probably can make your own easy-to-read miles per gallon (MPG) display.
This project and its accompanying design files unlock the secrets of one of the five onboard diagnostic busses mandated by the U.S. OBD-II standard, namely SAE J1850 VPW, first used by General Motors, now found in a number of vehicle models, including those from Chevrolet, GMC, Buick, Pontiac, Saturn, Toyota, Chrysler, Isuzu and Daewoo. The project demonstrates how to use an inexpensive Atmel ‘8515 AVR microcontroller to collect real-time vehicle speed and air-flow data from an engine computer using the J1850 VPW bit-serial bus and display that information as a fuel consumption rate in miles per gallon (MPG) using an “analog display” made from an off-theshelf, electronic tachometer with a modified meter face-plate. Bill of materials costs are under $50, most of that going to the electronic tachometer.
The article shows how a microcontroller-based design can be connected safely to the “power supply from hell”, the 12VDC automotive battery bus, and provide a simple, robust connection to a vehicle’s SAE J1850 VPW bus, while still tolerating ground and power-supply short circuits, as well as reversed battery voltage. This “magic” is performed without the need for special automotive bus interface chips. Simple transistors, diodes, resistors, and capacitors are all that are needed.
Through the use of embedded C-code the mysteries of the J1850 VPW protocol are revealed and a gateway to the real-time data stored in your engine computer is opened. We also see how emulating the instruction-by-instruction behavior of the AVR microcontroller can be used to speed firmware development. Finally, we show how to acquire an inexpensive junkyard “brain” for your favorite vehicle, so you can experiment with an engine computer in the lab, before doing the same in your driveway…or on the highway!