NGen - a low cost, programmable and extendable four channel engine speed simulator.

Angular signals

In a gasoline or diesel combustion engine, several signals like injection or ignition have to be created on certain angular positions related to the crankshaft and camshaft rotation.
For a normal 4-stroke engine, one complete engine cycle needs two crankshaft rotations which equals one camshaft rotation.
So every angular position within one engine cycle can be expressed as a crankshaft angle between 0 and 720.

To determine the crankshaft position, usually a crankshaft wheel with 60-2 teeth is used where a hall sensor is utilized to create a rectangular 5V signal that has the same shape as the unrolled wheel.

A typical 720 crankshaft signal (red) with the according camshaft signal (blue):

The two missing teeth define a gap which is used as marker for the absolute 0 position (e.g. the 1st falling edge after the gap).
Since a full engine cycle has 720, the position defined by the gap can be either 0 or 360.
To distinguish this, the information from a camshaft wheel is used.

Note how the camshaft is low during the one gap and high during the other. A simpler camshaft signal with just one 360 low and one 360 high segment ("half moon") would be enough of course to distinguish between 0 and 360.  The depicted multisegment camshaft can be used however to speed up synchronization and as fallback signal if the crankshaft sensor fails.

Since every engine control unit in a modern car uses the crankshaft and camshaft information, a simulation of these signals is needed to allow development of software for automotive applications. Of course there are commercial simulators available - but these are usually based on Simulink models running on hardware worth several thousand dollars.
The main idea of NGen is to provide automotive developers with a small and cheap, yet flexible and extendable simulation box for angular (and other) signals.


CPU selection

The NXP LPC1768 was chosen due to its performance and features, but also due to good availability of demo/core boards.
It's a bit overpowered for this project regarding pin count (100 pin device) and ROM, but the emphasis was on having an extendable platform and not on saving a few Euros.
The LPC1768 is a 32bit Cortex-M3 ARM CPU with 100MHz clock (programmable via PLL), 512kb ROM, 64kb RAM and contains dedicated peripherals for USB, CAN, I2C, SPI and ADC.
It also features some other interesting peripherals like a quadrature encoder interface, a 32bit timer peripheral (up to full core clock) with four timers, fast I/O and a DMA controller.
Last but not least, there are core boards available for $20 / 20 (including postage&packaging) which can be easily integrated into own projects:


Back to main page