Saturday, December 28, 2013

Working like a regular car

EEPROM
In order to be practical I need the final version of my ECU to work with no thought or effort from the driver (me). I want to simply turn the key and have my car start. For the ECU to work it must have the engine tune data available. Where it previously was only provided by my laptop over a serial interface, it can now be written and read from the built in EEPROM memory. EEPROM memory will hold data even when power is disconnected from the ECU, but is much slower than RAM. When power is applied to the ECU, the data in the EEPROM is loaded into RAM so it can be quickly accessed when needed.

This works fine for now, but there is only 1KB of storage and I'm already using half. Later I'll need more data recorded, which might not fit in 1KB. The only other non volatile storage in the chip is the Flash program memory. It's much bigger at 64KB. The Flash storage is where the program is recorded, but I should be able record tune data into the unused areas.

Closed Loop Mode
Nearly all fuel injected cars will use a slightly rich air/fuel ratio while accelerating, under heavy load, or high RPM. This is based on values recorded in a fuel map and is called open loop mode. This allows for fast adjustments as engine load and speed changes, gives better power and helps prevent pinging(knocking). The disadvantage here is decreased fuel efficiency and more pollution.

While under light, steady load, such as when idling or cruising at a constant speed, closed loop mode is used. In closed loop mode the air/fuel ratio is continuously adjusted as close as possible to the ideal ratio. Using an oxygen sensor, the current ratio is determined by measuring the amount of oxygen in the exhaust gases. Voltage goes up when the engine is running rich, and down when lean. Small adjustments are made to the injector duty cycle based on measurements of this voltage. The end result is that less fuel is required and the function of the catalytic converter is improved. Unfortunately it does not function if it's cold, so cannot be used as soon as the car is started. And compared to a MAP sensor is much slower to respond to changes, which makes it unsuitable for situations where a sudden change in engine speed or load occurs.

http://www.youtube.com/watch?v=XHYJ5v8_8fs