Category Archives: Programming

Computer and micro controller programming in a variety of different languages utilising many frameworks including Kohana, jQuery and CodeIgnitor

High Speed ADCs and Interfacing with Texas Instruments ADS8321

I needed a high speed ADC for sampling in cylinder pressure for my ECU, and settled on trying a few from Texas Instruments. I am using an optical encoder on the engine which provides 720 pulses per revolution . If I took a sample every pulse, then at 6000 RPM (100 Hz) then I would be looking at about 720 * 100 Hz = 72,000 Samples per Second (SPS) or 72kHz ( although I realise now that I could take a sample on each edge, resulting in 1440 samples per revolution, or 144,000 SPS). That’s pretty high speed, considering most ADCs built into microcontrollers take a few microseconds to perform their conversion which results in a sampling rate of perhaps up to 50,000 SPS max for the Arduino for example. DSP chips or higher end micros probably have better performance, but for the sake of learning, I fancied trying to use an external ADC anyway.

8 MSOP breakout


Continue reading

Getting High Tech

Just a quick one on what I’ve been up to the last few days. I now have the engine set up inside so that I don’t have to keep pushing it outside or waiting for the rain to stop. I’ve also set up an optical encoder, in-cylinder pressure sensor, and AVL IndiSet high speed data acquisition unit to capture data on a 0.25 degree crank angle resolution.

Extended exhaust manifold for indoor running

Continue reading

Adding a load

More progress made today, I connected up the alternator to the engine to begin testing it under load. This was pretty successful, and the ECU all performed as expected, with only a few tweaks to the PID controller parameters to improve the AFR control. I restricted the range of fuelling down to as restricted as possible to prevent the system setting wildly large or small fuelling amounts under certain conditions. I finally managed to get the PID to maintain the AFR slightly rich within a few percent under steady state conditions.

Belt drive to alternator

Continue reading

Arduino Controlled Electronic Ignition

Success! I have started and run the engine on my own electronic ignition. The problem was in the end quite simple, it turns out that the missing tooth wheel on the crank was aligned differently to what I expected. I thought that the missing tooth occurred 240 degrees after TDC, but in fact it appears to be aligned almost exactly at TDC. This meant that my spark was happening around Bottom Dead Centre, which is no use at all!

Continue reading

Updates and Ignition problems

From my couple of brief tests, I’ve identified a few problems which are preventing the engine from starting up and running for more than a few seconds.

  • The ignition timing at very low speeds < 500 RPM is very erratic, and not at all on time.
  • Under heavy acceleration the ignition timing is erratic, for example when pull starting the engine
  • There are some occasional misfires
  • The ignition timing is generally not massively stable – sometimes varying as much as 10 degrees(!) Continue reading

First Test

Today was the first test of the engine with the control unit and it worked! Albeit only for a short time and a bit roughly (only had about 10 minutes to test). Initially I just needed to check that the ECU was triggering the ignition and fuel injection, and find a roughly suitable ignition angle.

Continue reading

Fuel injection map and closed loop lambda feedback

I have now managed to successfully map my engine simulator for the fuel injection timings across all loads and engine speeds. I have set up a two dimensional array, of speed and throttle position, and inside each element is the time in microseconds (us) that the fuel injector should be open for. I’ve also added closed loop lambda feedback.
Continue reading

Ignition Timing, Engine and Fuel Map

I have now implemented more accurate ignition timing control which is based on degrees before top dead centre rather than a fixed time period.

I’ve also implemented a simple fuel map with the ability to store new values, display the map and save the map over serial from the Arduino.

Continue reading