Will this actually work? Let’s inspect the ATmega328P to see if it is capable of supporting EFI theoretically.

Update: Proof of concept: accuracy and speed tests successful!

Is the CPU Fast enough?

Short answer: Yes

The first question has to be: is the ATmega328P processor (running 16mhz) fast enough to handle the job?  So let’s figure out what the NanoEFI system needs at it’s most basic level, then see what the 328P offers.

Scale of operation required:

Design Constants
R = 1 Rotation
L = 12000 RPM Rev Limit

Time per rotation at 12,000RPM
R per second: 12000/60 = 200 RPS
Time per R: 1/200 = 0.005s

So in following the math, we find that (at our target redline of 12,000RPM) each revolution will occur at intervals of 0.005 seconds. That is 5 milliseconds.

That’s pretty fast, but it’s still not nearly on the scale in which we have to operate.  In order for an EFI system to work, events have to be timed down to the degree level.  So let’s figure out

Time per degree of rotation at 12,000RPM
Time per degree: 0.005/360 = 0.00013s

That’s 130 microseconds.

Comparing this data with the Arduino Mini 328 Pro Capabilities:

The ATmega328P processes 1 instruction per cycle.  Meaning that 16mhz = 16mips.

Time per instruction: 1/16000000 = 0.0000000625s

So this thing operates on the scale of nanoseconds.  With fine tuning of the fueling needing to be accurate to 130us in order to have 1° of accuracy, it looks like we’re on the right track.  Let’s take it a step further.

Now armed with these two numbers, we can see how many instructions can processed for every degree of rotation at redline engine speed.

  1. 0.00013 / 0.0000000625 = 2080 instructions executed per degree of rotation

Alright! So it looks like the 16Mhz 328P CPU is fast enough for the job.  Of course, this doesn’t take into account time required to access timer and ADC peripherals, make calculations, and handle all helper routines, etc.  But it’s a solid start.


Are there enough timers?

Short answer: Yes

At first glance, it appears 2 timers will be required at a minimum.  The Arduino Mini has 3 timers.  A timer (with hardware interrupt) will be needed for determining RPM.  And a separate 16-bit timer will be needed for scheduling our calculated firing events and the associated ISR.

We’ll still have an extra timer left over, useful for for sending serial information every few seconds while in diagnostic mode.  Although it may be discovered soon that the third timer will be needed for an aspect of the EFI process that I’m not currently anticipating.

First timer: Tachometer – Timer0 in hardware interrupt mode

One to use in hardware interrupt mode to acquire our tachometer signal, as well as to provide the reference point for our firing event schedules.  I believe Timer 0 tied to Pin 2 will fit the bill nicely.

Second timer: Event Scheduler – Timer1 (16-bit)

To schedule the beginning of firing events, Timer 1 should be much more than sufficient.


Is it cost efficient?

Short answer: Yes, definitely

This is where the 328P shines.  The pricing works well, at $9.95 for an Arduino Mini board from Sparkfun for easy development, or ~$3 for the ATmega328P chip from Mouser if purchased individually. 

So far so good!

thumbs_up1

A proof of concept build will follow shortly to verify that this theory checks out.

3 thoughts on “Theory: EFI is possible on the Arduino Mini 328 (ATmega328P)

  1. Hello,
    I would love to be included in the initial trials, we are a group of high school students that are building a EFI controlled Honda GXH50 for the Shell Eco Marathon competition that will be held in April of 2017. We have manufacturing / design ability and a willingness to learn and share. Any help in this would be greatly appreciated.
    Kelly Neal
    NCCC Engineering
    New Castle, IN

  2. One thing you should really do is to make sure the Arduino Mini 328 will survive in the face of the ignition spark EMI/RFI. That’s critical. The board should have more than enough computing power. I am personally doing single cylinder electronic valve control and EFI in a PIC16F1822. The actual EFI control is essentially a table lookup with modifications for engine temperature etc.. And Don’t forget that low cost EFI has a lot to do with fuel pump/fuel pressure regulator and the actual injector costs. What are your planes for these?

  3. Hi,

    I have been interested with this, I am planning of having an EFI motorcycle.
    I would like to ask if it can handle 16k Rpm. I will be applying it to an Suzuki FXR 150 based motorcycle.
    It is a raider 150 here in the philippines.

Leave a Reply