Introduction:
In most cases, the electrical signals coming from the sensors need to be conditioned before they are supplied to the processor. On the other side of the computer, the actuators are controlled. These are often inductive circuits that typically switch high currents. The hardware used to condition the sensor signals and actuator currents is called interface circuitry. An interface circuit provides the conversion of an analog voltage to a digital voltage.
- Sensors send a voltage with a low current. The interface circuit converts this voltage into a digital value (0 or 1).
The current of a sensor signal is low; - Actuators require a higher current.
To control the actuators, the ECU contains output stages in the form of (a combination of) transistors or FETs, which are also called “drivers”. We will go into more detail on this in the paragraph “output signals”.

The image below shows the sensors and actuators of a (petrol) engine management system. The upper group of sensors (from the accelerator pedal position sensor to the lambda sensors) fall into the “analog” category. That means that the incoming sensor voltages first have to be digitized in the ADC (analog-to-digital converter). The lower group of sensors (from the crankshaft position sensor to the vehicle speed sensor) already supply their signal in digital form. The on-off signals or square-wave voltages are supplied directly to the CPU.
The actuators on the right-hand side are controlled by an output stage. An output stage, also called a driver, consists of a circuit of multiple transistors that converts a control pulse from the computer into a usable voltage and current to drive the actuator.
Transistor Transistor Logic (TTL):
The processor operates with voltages of 5 volts. Input and output voltages are therefore limited to a range of 0 to 5 volts (TTL level, short for Transistor Transistor Logic). Signals that deviate from this voltage level are adapted in an interface circuit.
The images below show how a 1 or a 0 is formed from a switch position. By means of a pull-up resistor, the 5‑volt supply ensures a logical 1 at the input of the processor when the switch is open. The voltage across the pull‑up resistor is then not switched to ground.
When the switches close, a voltage drop occurs across the pull‑up resistor. The 0‑volt level at the input of the processor is interpreted as logical 0.
A combination of open and closed switches produces a sequence of ones and zeros. In the image, the 8‑bit message to the processor is: 00101001.
With an 8‑bit processor, the eight bits are read in simultaneously per cycle. During the next cycle, which takes place at the next “tick” of the clock (see the system bus on the page about the operation of the ECU), a new sequence of eight bits follows.
Conversion of analog sensor voltages to digital message:
Digital input signals are processed directly by the processor. Analog signals are first converted into a digital signal in the A/D converter. As an example, we take the analog voltage curve of a turbo pressure sensor:
- at idle the voltage is approximately 1.8 volts;
- when accelerating the voltage rises to almost 3 volts.
The change in voltage cannot be processed directly in the processor. First, the measured voltage must be converted into a decimal value (0 to 255).
With a range of 0 to 5 volts and a decimal value of 0 to 255 (so 256 possibilities). A simple calculation shows that when we divide 5 volts by 256 possibilities, steps of 19.5 mV (0.0195 volts) can be made.

The example above showed the voltage curve over time of a turbo pressure sensor. The voltage curve of a temperature sensor and accelerator pedal position sensor behave in the same way, only over a different time span: warming up the coolant naturally takes longer than spooling up the turbo.
Earlier in this paragraph there is an image showing a category of analog signals. This includes, among others, the temperature sensor and accelerator pedal position sensor. The analog voltage is converted in the A/D converter into an 8‑bit unit of information. Many processors with multiple input pins have only one A/D converter. Several analog signals are combined into one signal by means of multiplexing.
In this example we see an A/D converter with eight inputs. A voltage of 2 volts is present on pin 0. Pins E1 through E7 can be supplied with voltages simultaneously. By means of multiplexing, these are converted one by one into a digital message.
The voltage of 2 volts is converted into a binary value. With the following formula we can convert the analog voltage into a decimal value, and then convert it into a binary value:
2v / 5v * 255d = 102d
Here we divide the input voltage (2v) by the maximum voltage (5v) and multiply this by the maximum decimal value (255).
By means of a calculation or by using a handy trick, we can convert the decimal number of 255d into the binary value of 01100110.
See the page: binary, decimal, hexadecimal.
The following table shows the decimal, binary and hexadecimal value corresponding to various voltages.
When reading live data, it may occur that the decimal, binary or hexadecimal value of the sensor signal is displayed.
- A voltage signal of <0.5 volts (025d) is regarded as a short to ground;
- If the signal rises above 4.5 volts (220d), the computer interprets this as a short to positive.
Conversion of pulse generator signals to a digital message:
The signals from pulse generators, including the inductive crankshaft position sensor, are essentially on-off signals that are created after the teeth of the pulse wheel have passed the sensor. The AC voltage from the sensor must first be converted into a square-wave voltage before the signal is supplied to the processor.
In the image we see a sinusoidal alternating voltage on the left-hand side of the interface. In the interface electronics, this AC voltage is converted into a square-wave voltage. This square-wave voltage is then read by the timer/counter block: when the pulse goes high, the counter starts counting and stops counting when the pulse goes high again. The number of counts is a measure of the period time and thus the frequency of the signal.
In the image below we see a signal from the inductive crankshaft sensor with red dots on the upper edges. The red dots are set to a voltage to make the block voltage rise (logical 1) or fall (logical 0). The explanation continues below this image.
However, the sensor voltage is never completely pure. There will always be a small fluctuation visible in the voltage curve. In that case, the interface electronics may incorrectly indicate this as a logical 0, while it should actually be a 1.
The oscilloscope image below was recorded while carrying out the BMW-Megasquirt project. The scope image shows the digitization (yellow) of the inductive crankshaft signal (red). In the image it is clearly visible that pulses are missing in the yellow block signal, while at that moment no missing tooth is passing by in the crankshaft signal.
To ensure that small fluctuations in the voltage curve do not cause an incorrect interpretation by the ECU, a so-called hysteresis is built in. The hysteresis is the voltage difference between the rising and falling edges of the voltage curve. In the image below, we can see that the red dots of the rising edges are at a higher voltage than the red dots of the falling edges. This way we can be sure that small fluctuations in the signal have no effect on the digital conversion.
In the first paragraph where we started talking about the conversion of the pulse signal to the digital signal, it was already mentioned that the frequency of the signal is determined on the basis of the time between two rising edges of the block signal. In these examples, it can clearly be deduced that the hysteresis does affect the width of the block signal, but does not affect the time between the rising edges, and therefore also does not affect the frequency of the signal.
With a properly set hysteresis, the sinusoidal signal is correctly converted into a usable block voltage, with only the multiple logical ones at the positions where the missing tooth passes by.
Note, during the setup of the MegaSquirt ECU, settings were changed, including triggering on the rising and falling edge. As a result, when the missing tooth passes by, in the first example the voltage is 0 volts and in the oscilloscope image below the voltage is 5 volts.
Output signals:
The output signals consist of digital on/off pulses with a voltage range between 0 and 5 volts (TTL level) with a very low current. However, actuators require control with higher voltage levels and currents.
The on/off signals can be pulse-width modulated (PWM), where the pulse width can vary at a constant frequency.
The following image shows a TTL-level block voltage as a function of time. The duty cycle of this PWM signal is 50%.
Drivers are needed to control actuators. With the digital output signal, the required current can be achieved using a driver. In the next paragraph we will discuss the drivers.
We find drivers in every ECU and in some actuators such as DIS ignition coils. A driver is also called a final stage or power transistor. The driver makes it possible to convert output signals at TTL level: 0 to 5 volts, with a low current of 1 mA from the ECU, to voltages up to 14 volts and currents up to approx. 10 A.
A driver can contain multiple interconnected transistors. Such a transistor is called a “Darlington transistor“. The following images show the following circuits:
- Diagram of a Darlington circuit with two transistors for the ignition coil control (source: BU941ZR datasheet).
- Two transistors each with a Darlington circuit (BU941ZR)
- Driver ICs with Darlington circuits and additional electronics for, among other things, temperature protection and feedback to the microprocessor.
On the page: actuator control methods the control of passive, active and intelligent actuators by means of a (power) transistor or FET is discussed in more detail.