Example: bachelor of science

AVR-Based Fuel Consumption Gauge - Lightner

Circuit Cellar, the Magazine for Computer Applications. Reprinted by permission. For subscription information, call (860) 875-2199, or Entire contents copyright 2005 Circuit Cellar Inc. All rights reserved. FEATURE ARTICLE by Bruce D. Lightner AVR-Based fuel Consumption Gauge Contest Winner With gas prices at record highs, wouldn't it be useful to be able to monitor your vehicle's fuel Consumption rate in real time? Bruce's fuel Consumption Gauge is the answer. I came up with this project because I. wanted to be able to determine my gas- air/ fuel mixture, thereby cooling the exhaust gases and ruining your gaso- Although the OBD-II connector has provisions for a total of 16 signal lines, powered, four-wheel-drive 1999 Chevy line mileage.

www.circuitcellar.com CIRCUIT CELLAR® Issue 183 October 2005 61 with the following response packet: 0x48, 0x6B, ECU, 0x41, 0x0D, KPH, CRC where ECU is the engine computer’s ID byte (e.g., 0x10). KPH is a byte encoded with the current vehicle speed in

Tags:

  Based, Consumption, Gauge, Fuel, Avr based fuel consumption gauge

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of AVR-Based Fuel Consumption Gauge - Lightner

1 Circuit Cellar, the Magazine for Computer Applications. Reprinted by permission. For subscription information, call (860) 875-2199, or Entire contents copyright 2005 Circuit Cellar Inc. All rights reserved. FEATURE ARTICLE by Bruce D. Lightner AVR-Based fuel Consumption Gauge Contest Winner With gas prices at record highs, wouldn't it be useful to be able to monitor your vehicle's fuel Consumption rate in real time? Bruce's fuel Consumption Gauge is the answer. I came up with this project because I. wanted to be able to determine my gas- air/ fuel mixture, thereby cooling the exhaust gases and ruining your gaso- Although the OBD-II connector has provisions for a total of 16 signal lines, powered, four-wheel-drive 1999 Chevy line mileage.

2 Avoid this operating only two or three are needed to commu- Suburban's fuel Consumption rate, espe- mode if you care about gas mileage. nicate with a given vehicle. The OBD-II. cially when it's towing my large travel connector standard provides for four dis- trailer. The best highway fuel consump- OBD-II tinct bit-serial electrical interfaces: SAE. tion rate I ever saw was approximately If your car was manufactured for J1850 VPW, SAE J1850 PWM, ISO 9141-2, 13 miles per gallon (mpg). During a sale in the after 1995, it includes and ISO 15765 controller area network summer trip across the country, my a 16-pin on-board diagnostics (OBD-II) (CAN).

3 Each manufacturer is free to pick truck's highway mileage varied from a connector somewhere in the passenger any one of these buses to provide the low of to a high of 9 mpg while tow- compartment. The OBD-II connector legally mandated data defined by OBD-II. ing. I desperately wanted to see a real- enables a scan tool to read diagnostic regulations. In the case of ISO 9141-2, time readout of the truck's fuel con- data from the engine computer. By there is a choice of two different net- sumption rate in miles per gallon. I law, the OBD-II connector must sup- work protocols, the newest being figured I could start adjusting my driv- ply a number of key parameters relat- Keyword 2000 (ISO 15031).

4 The OBD-II. ing habits when the miles per gallon ing to the on-board monitoring of connector also provides unswitched got too bad. emissions from vehicles, including 12-V power from the battery and two My truck's power train control mod- data such as engine speed, coolant ground connections. ule (the engine computer) supplies two temperature, and oxygen sensor read- Why so many bus choices? When key real-time engine parameters that ings. Table 1 is an abbreviated list of OBD-II regulations were written in enable me to calculate the instanta- OBD-II parameters. the early 1990s, there were three neous fuel Consumption rate in miles per gallon: speed and the intake air- flow rate.

5 More on this later. PID Size Data format Description As for the dashboard display, I select- 0x00 4 One bit each PID (1 = present) PIDs supported (0x01 0x20): ed an off-the-shelf, after-market elec- 0x01 4 See SAE J1979 MIL lamp status, monitor support/status, and no. of DTCs 0x03 2 0, 2, 3, 4 = open, 1 = closed fuel system status tronic tachometer from a local auto 0x04 1 100/255% per bit Calculated load value parts store. As you'll see, the inexpen- 0x05 1 1 C per bit, 40 C offset Engine coolant temperature sive tachometer provides an easy-to- 0x0A 1 3 kPa per bit fuel pressure read analog display that features a one- 0x0B 1 1 kPa per bit Intake manifold absolute pressure (MAP).

6 Wire digital input. I also wanted a visual 0x0C 2 1/4 rpm per bit Engine speed (revolutions per minute). indication whenever the engine's fuel 0x0D 1 1 km/h per bit Vehicle speed (kilometers per hour). system controller switched over to 0x0E 1 1/2 per bit, 64 offset Ignition timing spark advance Open Loop mode. Modern engines enter 0x0F 1 1 C per bit, 40 C offset Intake air temperature this mode when they start, but they 0x10 2 gm/s per bit Mass air flow (MAF) sensor rate also reenter it for extra power and when 0x11 1 100/255% per bit Absolute throttle position sensor trying to protect the catalytic convert- 0x12 1 0 = upstream, 1 = down, 2 = off Commanded secondary air status er one of the only parts in your vehi- 0x13 2 See SAE J1979 Location of oxygen sensors cle that's warranted for 100,000 miles!

7 0x1C 1 1 = California, 2 = federal OBD requirements level At high speed under heavy load, a mod- Table 1 An abbreviated list of OBD-II Mode 0x01 PIDs, this table shows the kinds of real-time data that you can ern engine computer protects the cat- read from you car's engine computer. Multi-byte data returns in big endian format. This is a tiny subset of the data alytic converter by enriching the that's available from your vehicle's OBD-II bus. CIRCUIT CELLAR Issue 183 October 2005 59. widely used serial diagnostic bus A sample J1850 VPW packet is Active + + + +. standards: Ford's (now SAE J1850 128 s 64 s shown in Figure 2.)

8 Note that the Or PWM), General Motors's (now Passive + + + + J1850 VPW data rate is variable, 1 Bit SAE J1850 VPW), and Chrysler's Active + + + +. ranging from 976 to 1,953 bytes and others' (now ISO 1941-2). 64 s Or 128 s per second, depending on the Each of the Big Three got to make Passive + + + + exact bit patterns in a packet. The 0 Bit its diagnostic bus of choice part of average data rate is approximately the OBD-II standard. Figure 1 These sample waveforms, straight from the SAE J1850 Kbps. This relatively low data Keyword 2000 appeared in VPW standards document, show you how to send variable pulse width rate is why modern vehicles are (VPW) data bits to the engine computer.

9 The width and polarity of the model year 2000. CAN OBD-II data bit pulses determine whether you're sending a 0 bit or a 1 bit. transitioning to the CAN stan- first appeared in model year 2003 dard, which signals at either 250. vehicles. CAN-bus is scheduled to or 500 Kbps ( , 30 or 60 KBps). be the only OBD-II bus allowed for vehicle's expensive engine computer new vehicle designs by 2008. However, while experimenting. SAE J1979 PACKET FORMAT. because the new vehicle design cycle SAE J1850 VPW messages are priori- The format of J1850 VPW OBD-II. takes approximately five years, and tized using a preassigned identifier.

10 Packets is specified by the SAE stan- because vehicles last upwards of 15 years Nodes take turns signaling each other dard J1979 E/E Diagnostic Test (30-plus years in my household!), CAN- either by driving approximately 8 V Modes. Every OBD-II data packet bus will not take over any time soon. onto the bus (active state) or not (pas- begins with a 3-byte header. That's sive state). This scheme provides for 1 byte each for priority/type, target SAE J1850 VPW nondestructive collision detection. If a address, and source address. The header It's possible to build a generic diag- transmitting node sees a positive volt- is followed by one or more data bytes nostic scan tool that can communicate age (active state) on the bus when it and a trailing CRC byte (as defined by with any vehicle produced today.)


Related search queries