How Car Electronic Control Units (ECUs) Work.

Every year cars become more complex, and today a car can contain more than 50 microprocessors. Although microprocessors make it much harder to understand how a car works, they are designed to make it easier to use.
Let's look at some of the reasons for so many microprocessors:
- The need for complex control to reduce emissions and meet fuel economy standards;
- Expanded diagnostic capabilities;
- Simpler car production and development;
- New safety features;
- New comfort features;
The complexity of engine control.
Before the law regulating harmful emissions into the atmosphere came out, you could easily do without microprocessors. With the adoption of this law, complex control systems became necessary. These systems regulate the air-fuel mixture so that the catalytic converter cleans harmful substances from the exhaust gases as effectively as possible.
The busiest control unit in a car is the engine control module (ECM). The ECM is the most powerful computer on board the car, and it uses closed-loop control. Feedback means that information from the system's output is used to control the system's input. Information for control is collected from dozens of sensors. The ECM knows everything from the air temperature to the amount of oxygen in the exhaust. Based on this data, thousands of operations are performed per second, working with tables and solving long equations. All this is done to calculate the ignition timing and the injector opening time. A modern ECM usually contains a 32-bit processor running at 40 MHz.
ECU components.
In an ECU, hundreds of components sit on a multilayer board together with the microcontroller. Let's look at some of them.
The analog-to-digital converter (ADC) is needed to read data from some of the car's sensors, for example the oxygen sensor. The oxygen sensor's output voltage is typically 0 to 1.1V. The processor understands only digital signals, and the ADC converts the analog value into a 10-bit binary number that the processor understands.
A driver is a device needed to convert signals in order to control something.
Digital-to-analog converter (DAC): sometimes the ECM needs to provide an analog signal to drive certain engine components.
Communication chip: these chips implement the various communication standards used in a car. There are several standards, but at the moment the most common communication standard in cars is CAN (Controller Area Network). This standard allows data to be transmitted at 500 kilobits per second (Kbps). This speed is needed because some modules exchange data hundreds of times per second. Physically, the CAN bus consists of 2 wires.
In many modern cars, the injectors, the spark plugs and the cooling fan are controlled by digital signals. A digital signal can be described as follows: either it's present, in which case the output is said to be 1, or it's absent, in which case the output is said to be 0, with no intermediate values. So, to control the fan, you need to apply 12 volts to the relay controlling the fan and supply 0.5 amperes of current. A microcontroller can't provide such current and voltage; it can typically output 5 volts and 0.02 amperes, so a transistor is placed between the relay and the microcontroller. This provides the conditions needed to switch on the fan.
Advanced diagnostics.
Another advantage of the CAN bus is that each module can communicate with the central module and report any errors it has. The central module stores them and displays this information on the instrument panel and at the diagnostic connector. This makes it easier to track down so-called intermittent faults, which disappear as soon as the car arrives at the workshop. Every car comes with documentation decoding the error codes stored in the ECU. Sometimes these errors can be read without diagnostic equipment. For example, on some cars, if you short two pins of the diagnostic connector and turn on the ignition, the "Check Engine" light will start flashing, and you can determine the error code from the number of flashes.
Simpler development and production.
With the advent of a communication standard, designing and producing cars became much easier. A good example of this simplification is the instrument panel. The instrument panel collects and displays data from various parts of the car. Most of this data is used by other modules in the car. For example, the ECM knows the coolant temperature and engine speed. The ECM sends a packet consisting of a header and data, where the header is a number that identifies the packet as either the driving speed or a temperature reading. The instrument panel contains another module that parses the packet and updates the reading of the corresponding gauge. Most automakers buy the instrument panel fully assembled from a supplier that develops it to a specification. This makes the work of designing the instrument panel much easier for both the automaker and the supplier. The automaker writes a specification describing the list of packets the instrument panel will receive; the rest is defined by the standard. So there's no question of which signal will correspond to a speed of 30 km/h or how it's generated. Communication standards make it possible to outsource the development of some car components.
Microprocessor sensors.
For example, a traditional pressure sensor contains a device that outputs different voltages depending on the applied pressure. As a rule, the output voltage is nonlinear and very small, so it needs further amplification. Some manufacturers develop smart sensors with an integrated microprocessor. This makes it possible to read the voltage, calibrate it using temperature compensation curves, amplify it and transmit the pressure directly over the communication bus. This reduces the load on the module that works with this sensor; otherwise it would have to perform all these calculations itself. Another advantage of a smart sensor is that a digital signal sent over the communication bus is less susceptible to interference than an analog one. Having a communication bus also simplifies wiring. Let's look at how this works in more detail.
Simplified wiring.
The method that simplifies a car's wiring is called multiplexing. In old cars, the wires from each switch had to be connected to power, and the number of different switches grew every year. A multiplexed system runs two wires to every device in the system: a power wire, which supplies the “plus” of the supply network to the load, and a control wire, which carries the on or off signal encoded in binary. The signal is generated in the multiplexer when the corresponding switch is pressed. The load's demultiplexer, having received the signal, decodes it and, if it matches the switch-on code for that load, connects it to the supply. Loads are switched off in the same way. So there's no need to run a whole bundle of wires into the door to monitor all the driver's door switches.
Safety, comfort and convenience.
Over the past decades, safety systems such as ABS, SRS and ESC have become commonplace in cars. Each of these systems adds a new module to the car, which in turn contains several microprocessors. In the future the number of these modules will only grow. More modules mean higher power consumption, so in the near future there are plans to move from the current 14V system to a 42V system.