Tuesday, June 30, 2009

Honda Mileage:Vehicle Information Device(Introduction)

The other day, I started to discuss my project to construct my own Vehicle Information Unit (trip computer). Today, I will share a few photographs of both that device, and the NET application I use to debug and calibrate it. Because of the grainy nature of these images, I plan to replace these photographs very soon with better shots of each subject.

This image (to the left) shows the layout of the prototype CPU card. The CPU (located along the top edge of this card) is a Microchip 18F2520. The two other chip components on the card are a LM339 comparator, and a Maxim 232 RS-232 converter chip. Shown at the bottom edge is the RS-232 DB-9 connector. The RS-232 interface allows the device to be connected to a laptop via a serial USB device.

The device works by constantly monitoring the voltage across one of the transistors controlling the fuel injector for engine cylinder one. (see image below) Each time the transistor fires the injector, the VID measures the exact amount of time, that particular fuel injector remains on relative to the off time. For each second of operation the device determines an average on/off (Duty Cycle) time for that cylinder. Because the device knows the amount of fuel the fuel injector would emit if it was held on for one full minute, the CPU can extrapolate the amount of fuel the engine consumed that past second by multiplying the value for this cylinder by four. In my case, each fuel injector emits 240 cc per minute-- the engine there would therefore use about 15.5 gallons per hour. (I am glad the injector ON time is measured in milliseconds.)


This image shows what a typical injector pulse looks like hear the injector side of the resister ballast resister in the Honda Accord. Notice that, the ECU controller is not able to being this point to ground. Since this is where I am tapping in, I need to level shift this signal to ground using a LM339 comparator. The approximate on time shown here is about 2 milliseconds. The comparators' schmitt trigger inputs are also useful for squaring up the signal for the CPU.

While all that is going on, the device is also counting the number of Vehicle Speed Sensor pulses (VSS) it is receiving from the sensor attached to the transmission. Again, the device knows how many pulses the vehicle produces each mile--so it can easily compute the number of feet (or miles) the vehicle has traveled during the past second.

So--knowing the distanced traveled this past second, combined with the amount of gasoline consumed allows the VID to compute MPG (miles per gallon), M.P.H., G.P.H. (gallons per hour) and so on. The device has flash memory built in--so all accumulated numbers are saved to flash, allowing the device to be used across engine starts as a real trip computer.

The device can (if requested) send a complete packet of data to the host PC. The VID always sends two characters of data to the BCD display. When the new display is complete,, the device will have four digits plus status LEDs--each digit will be at least 1 inch tall. And they will be the same color--the two shown were drawn from my sparsely populated parts box.

The following four images show the four main screens of the Windows C# program used with the VID for debug and data logging. This program is used in the lab and the vehicle to verify software changes made to the VID's firmware. It can also be used to actively record all received data for later playback. These simulated drives are sometimes useful for spotting spurious events that are not noticed as the vehicle is being driven. Future versions of the VID software will allow use of PDA platforms for this purpose. In most cases, there is no need to constantly watch these parameters. As the VID stores the fuel/distance state to flash every time it either times out or notices the vehicle about to come to a stop. The prototype BCD display is displayed here showing the TANK miles per gallon of 18.

This image shows the default screen. The default screen displays preprocessed data from the VID such as MPH, GPH, RPM and all of the error and status code transmitted by the VID.



This image shows the TANK Status screen. Here the program displays accumulated tank data such as distance traveled in both total number of pulses and Miles. This screen also shows accumulated fuel used since tank reset, and the number of running seconds on this tank. See trip screen.



This screen shows the VID output for the current Fuel Injector pulse and period width.



Similar to the Tank screen, this screen shows the accumlated data assocated with this TRIP.



The image above shows the VID with a 2 digit version of the two-wire BCD card. The VID card has just been removed from the vehicle and is still displaying the tank mileage figure of 28 MPG. The BCD card (currently)uses two 16F series processors to ( interface with the VID via a custom two-wire interface and seven segment decoders. Because I am using 16F devices I also have the capability to mirror the segment display output--allowing it to be positioned on the dashboard and the LED's reflected on to the windshield--- a HUD effect--if you will.

Located in the lower right corner of the board are a series of tactile switches. One switch is called UP, one called DN(down) and the other is labeled "action."It is by using these switches the user can select a parameter for display, or reset either tank or trip numbers. If the user selects either Trip or Tank MPG and then pushes the Action button, the all data for that entry will be cleared to zero. The user can clear the Tank, Trip data--or both. Later the Action switch will allow the user to change calibration constants for fuel and distance without using the laptop. Currently that is all a function of the NET C# programs.

Finally, in this picture, I show the Visual Studio 2008 produced C# program (with some open-source graphics support--see below) that provides me with a simulated Honda Accord Dashboard. The the Speedometer is the large item to the left, the tachometer to the right. In the center are two gauges showing the trip and tank miles per gallon figures. The display also shows simulated odometers for tank and trip distance and gallons used. Note: the 2 digit 2 wire BCD display now reads 25 MPG. This is because while being attached to the vehicle simulator in my lab, it has not been treated as well as when attached to the actual vehicle. The vehicle simulator sends pulses to the device showing about 10 MPH while sending fuel information showing about one gallon per hour,i.e 10 MPG.

NOTE: As stated before, the Windows interface is not normally required while out driving. However, it is useful sometimes for logging vehicle driving habits etc. Using xml serialization, I can easily log all data coming from the VID for later playback. The VID normally stores accumulated miles driven and gallons used in flash memory. It can also store information on maximum vehicle speed, maximum engine RPMs, and acceleration and braking habits. While I am sure that anyone using such a device would never be caught breaking the law, it is remotely possible that if the ticket was for a speed greater than the VIM recorded as maximum for that trip that you might be able to use this as evidence in your defense. In the future certain real-time markers can be added to the stored data to make it possible to legally correlate such things.



At this point in this project, I am almost satisfied with how the device works with the engine and the vehicle simulator etc. It has passed tests concerning electrical noise-- the two-wire BCD device is works well enough that the length of wire between the master and the slave does not produce measurable error. I was impressed that the wire length grew to four feet without negative consequences. I did add 10 K termination resistors to the receiver end, before the display settled down, however.

As I said the other day, I am making plans to produce two PCB for a full-up test of both sub-systems. In the meantime, I will continue to field test the device whenever the Accord is driven. In fact, it is nearing that point where a full tank test is called for. I will therefore be planning a trip to Vermont after the Forth Holiday.. I would go this weekend to my favorite remote camping location. However, experience tells me that the Forth of July is no time to expect any peace and quiet in that place.. not so remote after all.

During the next week, it will be my goal to get the exhaust and the front half axle replaced. After 220000 miles, I can not complain about the CV joints-- that is for sure. The right side was replaced last month. As I have said, the driver's side would have been already been replaced but to do it myself, I an still unable to get the 32 mm axle nut loosened up. I have broken several 1/2 inch drive tools trying.

References:


1.0 Thanking,Guillaume CHOUTEAU for open source Windows GUI support for custom controls

Friday, June 26, 2009

Honda Fuel Economy

The vehicle now has 220,000 miles on it. It does not use a drop of oil--and retains over 85 percent of its factory power. Currently, the vehicle is capable of 34-36 mph.

In the meantime, I have been working on an engineering project to design, and build a Vehicle Information Device (VID), that would at least mimic---OBDII in regard to fuel mileage. In some ways the VID provides the essential features of commercial devices like ScanGauge, but for cars older than the model year 1996.

At this stage I have settled on a PIC 18F2520 processor, and worked out the necessary algorithms to measure and/or record fuel usage and distance traveled. I've also developed an efficient method to transmit BCD data to a display board using a two wire interface. The display board can be configured as either an LCD module or a custom seven segment LED display. The LED display is the most interesting as it allows me to mirror the seven segment display and thus create a device capable of being read indirectly from reflection off the windshield. A HUD display--if you will. I use 1 inch seven segment LEDs for this purpose.

The existing VID currently monitors the duty-cycle status of one of four fuel injectors in this car. It also measures VSS (Vehicle Speed Sensor) pulse information. Combining the data allows the device to keep track of the number of gallons used over the distance traveled. It stores this accumulated data in internal flash memory and therefore forms the basics for a vehicle trip computer.

The VID prototype also employs three tactile switches. These switches allow the user to select the type of data displayed. The user can view tank and trip mile per gallon and distance traveled. Currently the display also shows RPM and MPH.The user can use these switches reset trip and/or tank data whenever desired.

The VID also includes an RS-232 interface. This allows the VID to send a constant stream of data to a Windows based program, located on a laptop. The program can be configured to simply monitor and display data, or actually log the data in XML format--for later play back. This feature is useful in analyzing driving styles and locations. I have two windows C# based programs for the laptop. One is a simple graphical/text based program that allows the user to select one of four different data messages and watch the data as it changes. The other program features a nice application of the C#/NET drawing class. It uses bitmaps representations of both the actual vehicle's speedo and tachometer gauges. The application then rotates a bitmap of the pointer and paints it over the gauge display.

Currently the actual device is a 3*3 inch wire wrapped prototype board. Soon i plan to move it toward a PCB prototype as the next step before having multiple PCBs built by a PCB vendor. In the meantime, I am exploring other avenues for simplifying the device design and usage. Currently the device requires the user physically tap into the vehicle's wiring--for power,ground, injector and VSS signals--in what I consider, a rather intrusive way. And, while I don't see any way around taping the fuel injector signal, I am working on ideas to eliminate the need to tap into the VSS. I am also looking for options to eliminate most wiring to the the display Unit. My ultimate goal is to have a device that is battery powered and can be positioned anywhere--including flat on the dashboard--doing this would allow the user to view the mirrored information via the windshield---and thus--- not be accused to being distracted by electronic gadgets. This Heads up Display (HUD) would allow the device to be much more instrumental in assisting the drive with his driving habits.

In my testing so far, the VID device has proven that using the vehicle specifications for the fuel injectors produces realistic fuel use data. (For this engine, the fuel injectors are specified to emit 240 cc/min of 100 percent operation. Or, about 15.48 gallons per hour.) By measuring the real-time fuel injector on time, the device can easily infer the fuel usage to within 5 percent of the actual usage.

Practical use so far shows that by driving the vehicle very carefully around town, the device easily reaches 28-30 MPG. For more extensive drives---covering many more miles, the VID agrees with the numbers arrived by the old method of measuring vehicle mpg.(i.e filling up the tank and driving for n-miles) On a trip of 300 miles or more, the device shows the vehicle average over 34 mpg. Fuel measurement confirms these numbers.

The extensible nature of the PIC/VID architecture will allow it to eventually monitor more vehicle information--- just as OBD does. For instance, the device will eventually provide (4) four, 10 bit analog to digital inputs--useful for monitoring any number of vehicle or environmental data. For example, engine or road temperature, O2 Sensor output, and the like.

So.. please come back for further updates on my efforts to squeeze both more miles and less fuel from my old Honda Accord.