The ECU or Engine Control Unit is a computer in an automobile which performs engine management tasks, controlling its operation. They are most commonly identified with electronic fuel injection or EFI, which cannot be performed without them. Since the widespread adoption of the OBD-II standard in 1996 the ECU is "officially" referred to as the powertrain control module, or PCM.
Duties
Depending on the car's capabilities, the ECU may have any of a long list of goals. In the typical car with a limited set of features, the ECU controls fuel delivery, timing advance, and the anti-smog equipment. As RPMs increase, it will increase timing; When the pedal is pressed down significantly further than the current speed would signify, it increases fuel and air delivery in order to provide more speed, and sometimes advances the timing still further to add power. If the knock sensor detects detonation it will retard the timing to preserve the engine. The simplest ECUs (used with carbureted engines) do nothing more than control timing advance and smog equipment for the best possible emissions, and perhaps also fuel delivery; while it is probably possible to make an efficient all-analog emissions control system, the required complexity of such a system makes the computer all but mandatory.
The use of electronic fuel injection (the main reason to have an ECU) provides a great boon to the environment. We do not actually want our cars to be inefficient, as they produce the most power (and get the best mileage) when they are running at their most efficient. You can tell the car is running efficiently when most or all of the fuel in the fuel/air mixture is being burned, known as the stoichiometric ratio. The ECU will monitor the output from the O2 sensor and adjust airflow and fuel delivery accordingly. It also controls the smog system and will add fresh air to the exhaust, which flows into the catalytic converter and helps to burn unburnt fuel there. Some cars actually have a "smog pump" which forcibly blows fresh air into the exhaust system, which is also controlled by the ECU.
On some vehicles, the ECU also provides a speed limiter to keep you from exceeding certain speeds; They usually kick in around 120mph though some notable examples cut out closer to 85mph. This is typically done by means of a fuel cut, or a total absence of fuel delivery until the RPMs drop below a certain point. On most cars the ECU also provides a rev limiter to keep you from overrevving your engine to the point where it runs dangerously out of balance and shakes itself apart, or when the engine runs too fast for the timing advance to keep up and you get detonation. Many vehicles have a combination of both, with different rev limits when the transmission is in different gears.
Cars with variable valve timing rely on the ECU to control it. This allows the computer to change intake and exhaust timing, sometimes also altering valve lift and duration. This primarily takes the form of changing cam profiles at a certain RPM (staged cam profiles) or degreeing the cam according to other engine parameters (phased cam profiling).
Finally, some ECUs communicate with other parts of the car, such as an antilock brake system (ABS). Another excellent example of communications with the ECU is traction control, the use of antilock brakes to increase traction, primarily to stop a vehicle from entering a spin or slide. In the best traction control systems, it is not only the brakes which alter their behavior in such situations, but also the engine. Subaru variable center diff, or VCD, also relies on communication between the engine control system and the antilock brake controller to determine how power should be split between the front and back of the car.
Benefits
As compared to cars without an ECU, which must regulate engine conditions mechanically, computer-managed vehicles tend to be more efficient, produce dramatically cleaner exhaust gases, enjoy a longer lifetime, and be more reliable due to a lower parts count and overall greater durability of a solid state electronic device over a collection of small, delicate parts sometimes making in excess of 20,000 reciprocations per minute. Much of performance tuning can often be carried out in a central location, at the ECU. Vehicles which are electronically controlled can often make up for problems which will stop a mechanically-regulated car or cause it to act suboptimally, such as dying unexpectedly only to start and seem to run fine in the next moment.
All cars today use fuel injection and electronic ignition because they greatly reduce toxic emissions, control of which now mandatory in most countries.
Since the ECU is constantly reading back information from a variety of sensors, and it is of course aware of what it is asking the engine to do, it can often be used to provide a wealth of diagnostic information (See "DIAGNOSTICS", below.)
Basic Design
While design strategies vary there are basic elements common to all or nearly all ECUs. While components may be integrated in any particular way (many manufacturers have had custom ICs designed for the ECU of an individual vehicle) ECUs all have essentially the same responsibilities and thus have some components in common. There are essentially three duties to any useful electronic circuit: sense, decide, and act. In order to sense, the ECU needs input conditioners, rectifiers, and counters; it also needs to operate sensors which need a reference voltage to provide proper output. In order to decide, it needs a CPU and memory, which typically consists of a ROM with the program code, RAM which is used as a scratchpad, and KAM or "keep-alive memory" which could be EEPROM, battery backed SRAM, or flash ram, but which is usually DRAM or SRAM which is powered by the car battery. In order to act it must have the ability to handle voltages larger than those which it needs for processing, so it has driver hardware.
Just as we have (at least) five senses with corresponding sensory organs or systems, the car has multiple senses which each correspond to a device which call a sensor. There are also senders or sending units which typically provide much less reliable and precise operation, and which are used to control gauge readings, though some vehicles are today eschewing them in favor of receiving their information from the ECU in order to minimize complexity in the engine bay. Most of these sensors are negative temperature coefficient (NTC) thermistors, devices whose resistance changes with their temperature. Unlike "ordinary" positive temperature coefficient (PTC) sensors, these thermistors' resistance decreases as they heat up. There are also voltage-generating sensors, variable resistors, potentiometers, and switches. What they all have in common is that most of them are provided with a five volt reference signal, with which their state is measured by the computer.
The computer's decide stage takes the data from these sensors (more on them later) and makes decisions about what to do based on the input. While a computer cannot make two different decisions based on the same information, the computer itself has state based on the keepalive memory (KAM). The computer is programmed to make decisions over time about the optimal way to operate the engine, and it stores the results of these decisions in the KAM so that over time it can adapt to changes in the motor due to wear of the engine and associated components. Program code is loaded from the ROM and executed by the CPU to process the sensor data and control the actuators in the act stage. Especially since the introduction of OBD-II, OEMs are using EEPROM and Flash RAM to store the "ROM" code so that it can be updated at a later time without replacing any physical hardware.
In the act state, an assortment of actuators are used to control the motor. In recent years drive-by-wire systems have become more popular, and in some cases even the throttle plate is computer controlled using a servo. The most common actuators are solenoids, including the fuel injectors, vacuum switches, and many emissions controls. You will also find motors, for example to control the mixture on carbureted vehicles, or to manage idle airflow, relays which typically control other devices but which might handle lighting a lamp (like the check engine light or the OBD-II MIL lamp) or activating a motor like the fuel pump. ECUs usually have a circuit called a quad driver in order to produce the voltages necessary to operate automotive actuators, which range between five and twelve volts.
Sensors
Typically the ECU will have an array of sensors, including but not limited to a crank angle sensor, an O2 sensor, a throttle position sensor/TPS, engine temperature sensor, and a variety of sensors connected to the smog equipment, like the air induction valve/AIV and exhaust gas recirculation/EGR valves. The ECU may also be connected to other systems which may be present on modern cars, such as an air bypass to increase idle speed while warming up, a system to adjust the opening of the butterfly valve controlling the intake airflow, a vehicle speed sensor, exhaust gas temperature sensor, and others.
Finally, advanced ECUs have a sensor for airflow; either a mass air flow (MAF) sensor, or a mass air pressure (MAP) sensor. The latter is better as it is better able to respond to the addition of a forced induction system or severe changes in atmospheric pressure. ECUs without this must rely on feedback from the speed sensor and a lookup table which assumes that you will have a certain amount of airflow at a certain speed. This is known as "speed density" airflow estimation for obvious reasons.
Aftermarket
There are aftermarket parts available to either upgrade or replace your car's ECU to improve performance. The most common ECU upgrade is known as "chipping"; the replacement of the IC with your ECU's program code on it with one with more aggressive settings. Along with the actual program which controls the ECU, the chip also contains the fuel map which tells what settings the ECU should use under certain conditions. Changing this "map" changes the behavior of the car such that you can get better performance at the cost of engine life or fuel efficiency. Chipping also commonly removes or resets speed and rev limits. Some ECUs also have "tip-in retard", which retards timing when you first get on the pedal after idling or running at low RPMs for an extended period of time, which is intended to extend engine life but which is also greatly annoying in a sports car.
It is also possible to replace your ECU entirely, or install one in a car which has never had one. Through the latter method it is possible to add fuel injection to cars which were not designed with that feature in mind. Various companies including haltech, trust, and Apex make complete engine management systems (EMS) with all the features listed above. They tend to use commodity sensors such as the MAP from later model Ford Mustang Cobras, which are readily available and well-known, though many of them will use the stock sensors which were installed with your already EFI-equipped vehicle. Many EMSes allow you to connect a computer (typically via RS-232 serial port connection) to view and change parameters in realtime. Some EMSes feature their own in-car configuration interface for altering fuel maps and other settings.
An ECU's behavior as relates to fuel injector timing, namely changing the duty cycle of the fuel injectors to control fuel delivery, can be altered by a device typically called an "air/fuel (ratio) controller", or AFC, which is installed between the ECU and the injectors. Most of these devices have a small display and keypad which allow you to alter fuel timing on the fly.
Diagnostics
Many and perhaps all ECUs have some facility for troubleshooting. There are generally five ways this is done. The first and least common today is through a proprietary checker connector, which requires the use of a tool made by the manufacturer. Methods 2 through 4 are OBD-I, OBD-II, and CAN, respectively. The final method is through the use of diagnostic LEDs on the device itself or through the check engine light. ECUs will commonly hold error codes in memory until the car has been started a certain number of times without failure, or until the codes are cleared manually. When an error is current, the check engine light is lit; a serious problem may cause that light to flash.
OBD-I and OBD-II are standards mandated by California law, which essentially drives emissions requirements in the United States. OBD-I satisfies Title 13 California Code 1968, "Malfunction and Diagnostic System for 1988 and Subsequent Model Year Passenger Cars, Light-Duty Trucks, and Medium-Duty Vehicles with Three-Way Catalyst Systems and Feedback Control." OBD-II covers Title 13 California Code 1968.1 titled "Malfunction and Diagnostic System Requirements-1994 and Subsequent Model-Year Passenger Cars, Light-Duty Trucks, and Medium-Duty Vehicles and Engines."
OBD-II is mandatory on all vehicles made on or after January 1, 1996. As such, it has become a primary method of diagnosing engine troubles. This has long been set back by the fact that manufacturers keep the best OBD-II codes to themselves. Anyone who follows the protocol can speak to an OBD-II device, and there are many scan code readers, but many of them are unknown to anyone but the manufacturer and the dealer. OBD-II specifies an electrical connector (one of several), commonly known standarized diagnostic trouble codes (DTC), data, and a communications protocol with more specific self-diagnostic on-board monitoring of emission malfunctions. There are three signalling protocols used for OBD-II: ISO 9141, SAE J1850 VPW (Variable Pulse Width Modulation), and SAE J1850 PWM (Pulse Width Modulation.)
While there is a list of standard codes used in OBD-II, automakers have always felt free to add their own codes to monitor things like throttle position and the amount of fuel being consumed. These values can be read in realtime and are of enormous interest both to repair shops and to hackers and tuners who would like to alter their car's behavior in ways other than repairing difficulties. It was not until 2002 that manufacturers were required to provide all of these codes to anyone for a "reasonable price".
The latest communications protocol for OBD-II is CAN, or "Controller Area Network" - a high-speed bus, capable of achieving 500 kBps, kilobytes per second. It is used (and has been in Europe for several years) for communication between control systems components, for example between the engine and transmission control units, but it can also be used to gather diagnostic data. Many cars will have both CAN for this purpose, and other protocols for reporting diagnostic data from the ECU. CAN C is the 500 kBps flavor, and there are also A (33.3 kBps) and B (125 kBps) versions.
The final solution, using onboard diagnostic lights, is the simplest and cheapest method, but it is not available on all cars. On those which do have it, it is usually accomplished by putting the ECU in a diagnostic mode and watching the flashing of one or more lights on the ECU or the dashboard, with the trouble codes thus revealed being listed in the factory service manual (FSM). While this method usually only gives a vague hint what is going on, the information can sometimes be quite precise. While it will not tell you as much as the full range of OBD-II codes, which could conceivably inform you as to the fact that a specific spark plug does not appear to be correctly firing, it can be the key to figuring out just why a car is misbehaving. Diagnostic mode is typically entered either through manipulation of a control on the ECU itself, or by unusual manipulation of the ignition key.
References
- Alex C. Peper, OBD-2 Automotive History and Information. (http://www.obd-2.com/hist.html)
- OBD-II Background. B&B Electronics, 2001. (http://www.obdii.com/background.html)
- Paul Weissler, Technical Preview of the 2003 Domestics. Motor Magazine, February 2002.
(http://www.motor.com/MAGAZINE/Articles/112002_07.htm)