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.
I have now managed to run the engine with electronic fuel injection (EFI) and electronic ignition, both controlled from my ECU. I’ve also managed to run in closed loop lambda control to maintain the correct air to fuel ratio.
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!
Having thought I’d almost nailed my ignition timing problems, I tried testing at higher engine speeds (up to 6000 RPM) only to find that the ignition timing began to become erratic again.
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
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.
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.
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.
For my Stellaris Launchpad engine simulator, I wished to add a calculation of the Air to Fuel Ratio (AFR) or lambda/equivalence ratio for the current engine conditions. I did this crudely by using the throttle position, engine speed (this->s) and current fuel pulse width (this->F) as factors in calculating the AFR:
this->AFR = (0.32666 * this->s * this->throttle)/(this->F);
The ECU which I am developing is an embedded real time system which is designed to control a single cylinder spark ignition fuel injected gasoline engine. There are a number of ways to approach developing this type of system, and a mixture of these are likely used in industry
- Develop code on the embedded device and continuously test on the engine
- Develop code all in one go on the embedded device and perform a final test on the engine (you would have to be pretty confident in your code for this to be worthwhile)
- Create an engine simulator in software on a PC and write your ECU software on the PC to control it, then program the ECU to an embedded device to test on a real engine
- Develop model based code in software like Matlab Simulink, build an engine simulator and ECU separately in the software, then program it to a ‘target’ to run on an embedded device
- Develop an engine simulator on an embedded device and develop the ECU on an embedded device to control it
I’m going with the last option. Continue reading