Electronic Fuel Injection Success!

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:


9 thoughts on “Electronic Fuel Injection Success!

  1. Tommy

    I’m a student, I’m very impressed of your work!
    I want todo something similar for a small engine…
    Could you please send me the schematic of the circuit? (pots, input pins, signal conditioning etc..)
    thank you very much

  2. Kasper

    Awesome project and it seems to be a very interesting way of controlling the engine. But one question from my side how do You connect and interpretate the signal from the lambda sensor?

    1. Scott Snowden Post author


      Thanks! I had the fortune to have available to me a Horiba LD700 lambda sensor and driver/conditioning box which outputs a 0-5V signal – but these cost around £1000.

      There are other ‘Wideband O2’ sensors on the market which do a similar thing but are for aftermarket car modifications rather than combustion analysis, and cost around £200 I believe.

  3. Kirk

    What is function “scott();” in timer_blink.c ?

    void Timer0IntHandler()
    // Clear the timer interrupt

    1. Scott Snowden Post author

      I’m not sure now, I think that it was just a debugging thing which pulsed a pin so that I could look at it on a scope.

    1. Scott Snowden Post author

      You rely on interrupts. You need to set up an interrupt to trigger the ignition. This will take priority over any serial communication and should not affect ignition timing.


Leave a Reply

Your email address will not be published. Required fields are marked *