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.
The code pretty much worked first time for the fuel injection with a couple of minor tweaks. The PID feedback for the lambda control needed some tweaking, and is still not brilliant with a bit of hunting/oscillation, but I think this is partly down to the lambda sensor and partly because at the moment I can’t load the engine to keep the RPM a bit more stable.
I found that the engine needed a little more fuel to get it started than it needs when running, so the strategy is to set the fuel injector open time to around 2.5 ms before starting, and quickly adjust it down to about 1.8 ms with fully closed throttle and no load. At this point it idles reasonably smoothly.
That was pretty much it, I tinkered around with timings and things for a while, but can’t really do much more until I’m able to load the engine. So will get the alternator connected up and attach the light bulb load to it and see how well my ECU fairs. I made a quick video explaining some of the components and showing the engine running and then ran out of space on my phone so will make a better video later.
I’ve also made the source code to the project public so that anybody can have a go. Bear in mind, that this could potentially destroy your engine (although unlikely) so don’t blame me if anything goes wrong! View/download/fork it here: