Technical Article

Igniting the Spark Using the Microcontroller039s Angular Timer to Implement Capacitor Discharge Ignition

November 29, 2016 by Ashutosh Tiwari

This article discusses how angular timer of a microcontroller can help implement capacitor discharge ignition in an internal combustion engine.

Challenges in Designing CDI Systems in Internal Combustion Engines

The capacitor discharge ignition (CDI) system in an internal combustion engine can be implemented on single profile ignition pickup (PIP) systems using standard peripherals on an 8-bit microcontroller, however, there are challenges associated with such designs.

In an internal combustion engine, the air and fuel chemical mixture are burnt and extreme heat is generated expanding the exhaust gases, which force the cylinder piston to move, causing the camshaft to rotate and create kinetic energy. This kinetic energy is coupled to the vehicle’s wheels by gear trains to convert the angular motion into linear motion.

A four-stroke cycle engine that uses four distinct piston strokes – intake, compression, power, and exhaust – to complete one operating cycle as shown in Figure 1.


Four stroke engine with engine parts
Figure 1: Four stroke engine with engine parts


The top dead center (TDC) is the highest position of the piston near the spark plug and the bottom dead center (BDC) is the lowest position near the camshaft. After the spark plug fires into the power stroke, the air-fuel mixture needs time to completely burn; this burning process is progressive in nature in that the mixture at the top burns first and quickly moves towards the bottom.

Therefore, in order to burn the air-fuel mixture completely and produce the maximum pressure wave, the spark plug should be precisely fired moments before the piston reaches the TDC and at the proper angle, which is determined by the engine piston speed. There are other factors, such as temperature and throttle position that also determine the spark-firing angle. To fire the spark correctly and accurately, a separate module known as the ignition control mechanism is used.


IDI and CDI Ignition Systems

There are two types of ignition systems: inductive discharge ignition (IDI) or transistor controlled ignition (TCI); and CDI. The CDI system uses a high-voltage capacitor discharge current output to fire the spark plug (see Figure 2). It can be implemented using core independent peripherals (CIPs) found on Microchip PIC microcontrollers. These peripherals include the angular timer (AT), the signal measurement timer (SMT), the maths accelerator, and the configurable logic cell (CLC).


Basic capacitor discharge ignition (CDI) system
Figure 2: Basic capacitor discharge ignition (CDI) system


Types of CDI Systems

There are two types of CDI systems: alternating and direct current capacitor discharge ignition, or AC-CDI and DC-CDI.


AC-CDI Systems

In an AC-CDI system, an alternator or stator (magneto) generates enough power for all electronic systems including the CDI. The capacitor is charged through the rectified output of the magneto AC supply, which is 200V-400V DC. When the engine is cold (not running), a kick-start is required to rotate both the engine and the magneto. This does not generate sufficient power from the magneto to charge the capacitor completely for a high-voltage spark as part of the capacitor function. For very low RPM, the firing angle is always constant. Hence, analog firing is used to fire at negative PIP output from the magneto-flywheel pulser coil without calculating the RPM.


DC-CDI Systems

In a DC-CDI system, a constant 12V DC power is always available from the battery. It requires an additional DC-DC converter to raise the 12V DC to 200-400V DC. This additional circuitry makes the CDI module slightly larger than an AC-CDI system. When the engine is not running, it can be started easily at a precisely calculated firing angle, as the input DC supply is always available.

To create the high-voltage spark in the spark plug, a high-voltage capacitor with a high-charge capacity is charged using either the output of the DC-DC converter (DC-CDI) or using the output of the magneto, an AC alternator (AC-CDI) as part of capacitor function. The capacitor is charged to a high-voltage supply, usually 200 to 400V.


Designing CDI Systems

The capacitor is connected to an ignition coil or step-up pulse transformer, which produces a very high voltage, in the range of 40kV or more.

The switch connects the capacitor to the primary of the ignition coil. The switch is fired when the microcontroller gives a pulse at the gate of the switch. The sudden rush of current in the primary of the coil produces a very high voltage in the secondary, which generates the spark to ignite the air-fuel mixture. Thus, the microcontroller controls the firing angle of the switch for generating the spark.

A silicon-controlled rectifier (SCR) is most commonly used as a high-power switch in CDI. It is highly durable due to the higher operating voltages and current ranges with moderate frequency response. The disadvantage of the SCR is, as a one-sided switch, it can only be ON. It will automatically go to OFF when the input is less than the lower operating threshold.

An IGBT and MOSFET are used in modern CDI designs due to their ability to switch ON and OFF, as well as having a better frequency response at higher operating ranges.

The pulser coil – or pick-up and timing coil – is responsible for providing the timing signal to the ignition control system.

A magnet is mounted on a flywheel, which is mounted on the magneto shaft. When the flywheel rotates, the magnet passes near the pulser coil producing a timing pulse. There is one pulse per pole. Hence, for each magnet there are two outputs, one positive pulse followed by a negative pulse, generating one alternating pulse pair. For a single PIP system, there is only one pair. For multi-pulse systems, there are multiple pulse pairs, based on the number of magnets on the flywheel. The alternating pulses are at a fixed angle with respect to the TDC piston position in the engine for each rotation. The period of the pulses triggers the rotation of the engine.

Based on the number of alternating pulses from the pick-up, per engine rotation, the pulser coil system can be either a single or multiple PIP system.

In a single PIP system, the pulser coil provides one positive pulse followed by a negative reference pulse. The angle between the pulses and the angle between the negative pulse and the TDC are fixed. The firing of the spark should be at a specific angle based on the engine operating temperature, the throttle position, and the RPM. This angle is usually between the positive and negative pulses.

The negative pulse is a reference point for firing the spark at very low RPM. The firing angle changes to an angle between the pulses for higher RPM.

In a multiple PIP system, the pulser coil provides more than one alternating pulse. The second negative pulse is the reference point before the TDC. This is the minimum firing angle at which the spark should be generated for engine speeds below a lower speed threshold.

The first positive and negative pulses can be used for calculating the engine RPM. The second positive pulse can be a reference point for deciding the firing angle for higher speeds.

The pulser coil generates the timing signals that contain positive and negative pulses. These pulses are in the range of ±3 to ±90V, depending on the magnetic field strength of the magnet mounted on the flywheel.

A signal conditioning circuit inverts the negative pulse and limits the pulses to 0 to 5V. It is also used to filter spurious noise. The signal conditioning circuit will provide two positive outputs, one corresponding to positive pulses and another for negative pulses. The output of the signal conditioning circuit is connected to the microcontroller.


The Microcontroller's Functions in Digital CDI Systems

In a digital CDI system, the microcontroller has two major functions:

  1. Deciding the advance-firing angle by reading input from the sensors, such as the pulser coil, thermistor, and throttle position, then producing the firing pulse:
  2. Setting the duty cycle of pulse-width modulation (PWM) for the DC-DC converter.

The advance angle required for getting optimum performance from the engine is mainly dependent on the RPM. Hence, the system must be aware of the current RPM, temperature, and throttle position. Look-up tables called maps are stored in the program memory of the microcontroller, giving the appropriate advance angles with respect to the RPM.

Multiple maps are stored based on different throttle positions and for different temperature ranges. Once the controller calculates the RPM, it can then look up the appropriate advance angle from the map.

Peripherals on PIC MCUs, such as capture compare or PWM (CCP) and ADC, together with the interrupt pin INT can be used to determine the firing angle control in CDI.

The output for the positive PIP signal of the signal conditioning circuit is given to the capture module. The capture module measures the time between two positive pulses, which is the period of the pulser coil output. The period of the pulses gives the RPM of the engine.

An analog-digital converter (ADC) can be used to determine the engine temperature and the throttle position if it is analog; the throttle position input can be either analog or digital. In the case of a digital throttle, the position for the wide-open throttle (WOT) is one state and the partially open throttle (POT) is another. There are distinct firing maps for different throttle positions and different temperature ranges. Figure 3 shows the conventional method for CDI implementation.


The conventional method for CDI implementation.
Figure 3: The conventional method for CDI implementation.


The conventional method of RPM calculation uses a 16-bit timer along with capture peripheral. For lower RPM values, less than 60 (corresponding to 1Hz frequency), the 16-bit timer will overflow if the timer clock frequency is 1MHz. The timer overflow bit should be taken into account for RPM calculations.


PIC16F161X 8-Bit Peripherals

The PIC16F161X 8bit microcontroller has a core independent peripheral (CIP) as PIC microcontroller in which this CIP is called the angular timer (AT), which can be used in internal combustion engines to fire the spark at the exact firing angle with very little CPU intervention. As shown in Figure 4, the periodic pulse input to the AT can be selected from either the internal core independent peripherals or the external pin.


AT block diagram in single-pulse mode
Figure 4: AT block diagram in single-pulse mode


The CIPs of PIC microcontrollers, such as CLC, AT, SMT and maths accelerator, are used for the firing angle control in CDI.

For the RPM calculation, a 24bit SMT is used. The SMT is configured in windowed measurement mode with the window input set to AT period pulse. Whenever the AT gives a period pulse, the SMT captures the timer value into a register, resets its timer count and restarts counting. The timer capture into the register generates a captured period interrupt.

The maths accelerator peripheral, also called a PID module, is used to calculate the firing angle for the current RPM.


CDI Systems Improve with the Use of CIPs

CDI systems can be implemented using PIC microcontroller particularly PIC16F microcontrollers either through the conventional method or by using CIPs, such as AT, CLC, SMT, maths accelerator and complementary waveform generator (CWG). However, using the CIPs greatly improve the overall performance and implementation of CDI.

The AT successfully divides the input signal to angular division without CPU intervention, which helps to boost performance by removing the need for firing angle conversion from degree to equivalent time. These angular divisions are also very accurate and constant throughout the input signal range.

The performance of the CDI system can be greatly enhanced using the AT, with significant CPU bandwidth remaining for other calculations. In addition, with the use of the maths accelerator, the calculations are now more accurate and faster. The SMT with its inherent high-bit resolution helps in tracking low engine RPM and taking necessary action, without the need for large computations.

A similar implementation technique can be extended to other systems, such as inductive discharge ignition, that use the same CIPs.


This article originally appeared in the Bodo’s Power Systems magazine.


About the Authors

Ashutosh Tiwari works as the Senior Application Engineer - II at Microchip Technology, Bangalore Area, India where he is responsible for designing and writing the firmware application for 8, 16 and 32 bit PIC MCU's for various applications like CDI/ TCI, lighting and motor control and more. He specializes in programming, especially in C and C++. He has already accomplished 10 projects and 3 publications throughout his career. He acquired his Bachelor's Degree in Electrical, Electronics and Communications Engineering at Shree Hanuman Vyayam Prasarak Mandal's College of Engineering & Technology (HVPM COET) located in Amravati, India.

Shailendra Vengurlekar works as the Manager of Automotive Applications at Microchip Technology, India since May 2005. He is specialized in electronics, microcontrollers, and embedded systems.

Namrata Dalvi works at Microchip Technology, India as the Senior Application Engineer since August 2012. He specializes in the field of circuit design, concept development and control, as well as simulation. He earned his Bachelor's Degree in Electronics and Telecommunication Engineering at the University of Pune located in India.