DIY Electronic Fuel Injection

Sonreir

Oregon
DTT SUPPORTER
I know a few of you have been following my DIY Electronic Ignition thread over here, and so I figured I'd get a thread going on my other electronics project, a DIY Fuel Injection System.

I've collected most of the parts I'll need and I'm starting some basic code to get everything running.

Initial goal is multi-port injection (one injector per port), but non-sequential. The injectors will fire once per rotation of the engine, but will not be "correctly" timed to coincide with the opening of the intake valves. I'll save that for version two, perhaps.

The method for fuel metering, to begin with, will be based purely on the engine RPMs and the position of the throttle (more on this in a bit). This is called an N-Alpha system. Based on the engine's current speed and the angle of the throttle plate, we can make reasonable a assumption about how much fuel is needed by the engine. The benefits to this approach are simplicity of programming, but you lose the ability to adapt as the fueling maps (more on this later, too) are fairly static and will need to be recreated for all performance modifications. N-Alpha is usually a poor choice for forced induction, as well.

So... where to start...

I decided to start with the hardware. I've picked up a set of EX650 (Kawasaki Ninja) fuel injected throttle bodies (TBs), a fuel pressure regulator, and a fuel pump. Fuel injectors rely on fuel whose pressure is 15 times (or more) than used by carbs. So in order to make the switch to EFI, we need a fuel pump capable of those pressures and a regulator to ensure the pressure remains steady. If pressures change while the bike is running then the fueling maps will no longer. Steady fuel pressure is a must.

The reason for the choice of the EX650 TBs is as follows:
*Same OD of the body on the exterior side - Air filters from my 360 are a perfect match to the EX650 bodies
*Injectors from the EX650 are good for 160cc/min of fuel (that's good enough to run my bike up to about 16,000 RPM before hitting 85% duty cycle on the injectors)
*The EX650 comes with a throttle position sensor as well as a MAP (manifold absolute pressure) sensor
*Not too many parallel twins these days, so I kind of had a limited selection

The fuel pump is a Delpha FE0088. It's a 12V electric pump that come on the Nissan Pulsar from '83 through to '86. I plan to run it at 40 PSI, but it's good for about twice that. It was originally meant to be run in-tank, but I'll be running it inline. Current draw at my required flow rate and PSI should be just under four amps.

The fuel pressure regulator was an eBay China special. Hopefully it doesn't start spraying fuel all over my legs before going up in flames. It's meant to be a fit for most late model Honda cars, but as long as it holds a steady 40 PSI it can come from a lawn mower.

Now that the hardware is in place, it's time to work on the control system. I'll be using my trusty Arduino to read the sensors as well as control the fuel injection. As for the sensors, I'm primarily concerned with the Throttle Position Sensor (TPS) and the current speed of the engine. However, for tuning purposes, I'll also need to monitor the oxygen (O2) and MAP sensors.

Most of these sensors are analog, meaning an implementation in purely digital code can get a bit cumbersome. Luckily, the Arduino code library has some tricks in order to deal with this. I'll talk about those in a future post. In the mean time, the following voltage outputs can be expected from each of the sensors along with the meaning of those outputs:

(Wideband) O2 Sensor - Voltage differs depending on make and model of the sensor and so I'll be getting back to this in more detail in a future post
TPS - Voltages range for .2V and fully closed to 4.8V at fully open. The range is linear, so 2.5V is 50% throttle.
MAP - MAP sensors come in one bar, two bar, and three bar variants. I'll be using a two bar and the voltage range is from 0V at 1.3 PSI and 5V at 30.2 PSI. This sensor also operates linearly.
RPMS - This is our only digital sensor. I get one pulse every time the cam rotates and so we only need to count the the pulses and multiply by two in order to derive engine RPMs.

In order to get things up and going, the first order of business is to create a basic fueling map which will get the bike running. While I will be aiming at doing fueling with just the RPMs and throttle position, the MAP and O2 sensors will be needed for tuning. I'll be recording and constantly re-tuning the fueling maps based on sensor data. We can record readings from all of our sensors over time and after enough data has been gathered, we change the fueling map to account. Eventually, after we have filled in enough blanks, we can remove the O2 and MAP sensors and run with just the RPM sensor (which is needed for the ignition anyway) and the TPS. There is a pretty decent correlation between throttle position and pressure differential across the throttle body and the O2 sensor will fill in the rest.
 

Attachments

  • stock throttle bodies.jpg
    stock throttle bodies.jpg
    711.7 KB · Views: 628
  • fuel pump.jpg
    fuel pump.jpg
    532.7 KB · Views: 458
  • fuel pressure regulator.jpg
    fuel pressure regulator.jpg
    637.4 KB · Views: 876
I'm still tinkering away with the my fueling maps, but in the mean time, I've prepped the throttle bodies.

Kawasaki (rightfully so?) assumes that most riders of a Ninja 650 are idiots who don't know how to ride without killing themselves and so they've seen fit to insert two throttles into their throttle body. The primary throttle is cable actuated, just like the one you see in a CV carb, except that a sensor is attached to read the angle of the throttle plates. The secondary throttle is controlled electronically and slowly (relatively, anyway) in response to the primary throttle. This keeps the rider from actually opening the throttle too much at once. I'm assuming this is mainly to keep the squids alive, but it's also possible that the ECU doesn't enjoy sudden influxes of air and so the secondary acts to introduce the air in a more controlled manner.

Short and long of it: The secondary throttle is coming off.

Removal was a pretty easy process. A few bolts, a couple of screws, and a circlip later, everything was off. The holes left by the throttle shaft was were then filled in with epoxy and then taped over to keep things a bit smoother and, hopefulle, in place while it all cures.

The tape will come off in 24 hours and then I'll be doing some sanding and possibly another coat of epoxy. Everything must be air tight.
 

Attachments

  • secondary plates removed.jpg
    secondary plates removed.jpg
    773.2 KB · Views: 619
  • shaft hole.jpg
    shaft hole.jpg
    390.2 KB · Views: 367
  • epoxied and taped.jpg
    epoxied and taped.jpg
    768.2 KB · Views: 370
That fuel pressure regulator sure looks familiar. Those injectors
would be good for about 58 h.p. according to my calculations.
Looks like you might have some fairly short pulse width. Your system
is much more technical than my home brewed setup. I'm following
this thread because I will very likely learn some thing. And could you
tell me the venturi size and center to center measurement?

.
 
On the manifold side of the TBs, you're looking at 90mm C-C and 38mm ID. 40mm ID on the air box side.
 
http://www.gofastforless.com/ignition/digital.htm

You've probably seen various programmable digital ignitions ranging from $400 to $600+. Would you believe there is a digital ignition control that is easy to program (No complicated charts or maps) and comes with; a user friendly hand-held programmer, dual calibrations so you can have one setup for street and one for strip and can switch between the two quickly and easily, 4 switchable rev limiters, a high speed rev limiter, 4 rpm switches, an automatic start retard, 4 switchable retards, and a high speed retard, all for under $150. What's the catch? Well, you have to build it yourself.

From who else but Brett ...

~kop
 
Time for some more spreadsheet fun.

I've put together a quick spreadsheet to help calculate pulse widths at idle and at WOT.

To get started, we need to know several things about the characteristics of our engine:
1.) The displacement per cylinder (178cc)
2.) Desired Air/Fuel Ratio (AFR)
3.) The flow rate of the injectors
4.) Maximum RPMs (aka Redline)

In addition, we've made the following assumptions (which will be incorrect, but should also be "close enough" for now):
1.) The Volumetric Efficiency (VE) of the engine at both idle and WOT
2.) The density of air (1.2 grams per liter)
3.) The density of gasoline (739 grams per liter)
4.) Response time of the fuel injectors in µs (1100)

To begin with, we need to layout all of our required information into a series of fields across the top of the spreadsheet. To our already existing data, we'll also add the injector flow rate in cubic centimeters per microsecond. This number is calculated by taking our cc/min value, dividing by 60 and then dividing again by 1,000,000.

Next, setup columns for the Liters of air per minute, CCs of fuel per minute, and then injector pulse width per revolution. For each of these columns, create an additional column so that we can have values at closed throttle and at Wide Open Throttle (WOT). Finally, stick a column on the very left for the RPMs (we'll only worry about idle and redline for now).

OK... so in the first column (RPMs), enter your lower idle RPM value and your redline value. I've used 800 and 11,000 respectively. The next two columns are the volume of air your engine uses with the throttle closed and at WOT. These values can be calculated by dividing the RPM by two (for four stroke engines), multiplying by the displacement of the cylinder, and then multiplying again by the expected VE. Finally, divide this number by 1000 to convert from cubic centimeters over to liters. I've used 10% VE at idle and 90% VE at WOT. Copy these formulas into the next row to get these values at redline.

Next couple of columns are the number of cubic centimeters of fuel needed to match the expected air flow of the engine. The first thing to do is to multiply our quantity of air by the density of air to get the grams per minute of air flow into our engine. Now divide this value by our desired AFR in order to get the grams of fuel needed per minute. Next, divide this number by the density of our fuel (grams per liter) and then multiply by 1000 to convert from liters to cubic centimeters. Copy the formula over for WOT and for redline. To calculate max duty cycle of your injectors, divide the redline WOT value by the flow rate of the injectors. The result of this calculation should not exceed .85 (or 85%). This shown at the top of the spreadsheet.

Our final column assumes sequential port fuel injection (one pulse per valve opening with the pulse timed to occur just before the valve opens). The joy of SPFI is that the pulse width only needs to vary by VE and not so much by engine speed because we're using one pulse of the injector for every rotation of the cam. As engine speeds increase, so does the pulse frequency. This final column is the number of microseconds the injector needs to be open per every rotation of the camshaft. Simply divide the cc/min of fuel needed at idle by the RPM and then divide that number by the injector flow rate in cc/µs. Finally, add in the response time for the fuel injectors. This response time represents the time it takes for the injectors to receive a signal from our controller and perform the mechincal process of opening. Sending a command to the injectors to open for a period less than the response time will result in inaccurate metering of the fuel; don't do it. Repeat the formula for WOT and then copy from the 800 RPM row to the redline row. You can see that the values remain the same for both idle and redline.

So it looks like we have a good starting point for idle as well as a good starting point for WOT... next step is to calculate everything else in between. :p
 

Attachments

  • EFI Map.png
    EFI Map.png
    10.9 KB · Views: 513
That Arduino does a lot of stuff to simplify programming! Looking good! With a blank micro, I have to write the routine and build the hardware to send the output to a PC port (serial, USB, serial).
 
Three lines of code with the Arduino library. ;D

All the stuff will come out of the production version, of course. The analog read is really nice though. It only takes 400 instructions (about 100 µs).
 
Been toying with some additional formulas to help build my initial fueling map. I'm currently operating under the assumption that the engine's volumetric efficiency (when modeled after throttle position) follows a logarithmic curve. That is, the difference in the air flowing into the engine between closed and 1/8 throttle is much greater than the difference between 7/8 and WOT.

Additionally, I'm trying to account for changes in volumetric efficiency due to engine speeds. Valve timing is only "ideal" over a very small range of RPMs and starts to drop off in efficiency the further you get from the ideal value. I've used a parabolic formula for this approximation.

The first attached graph, "VE vs Throttle°" attempted to model the engine's volumetric efficiency as a function of the throttle position (in degrees). It is assumed that the engine is 10% efficient at closed throttle and 90% efficient at wide open throttle (purely based on throttle position). The model used is VE = .276435 log(.287168TPS) where VE is the estimated volumetric efficiency and TPS is the throttle position in degrees.

The second graph models volumetric efficiency based on engine RPMs. I've set the sweet spot for my cam at 7000 RPM (kind of a guess) with about 25% loss in efficiency at idle (purely based on valve timing). I suspect I've been a bit generous when it comes to assuming values for efficiency drop, but my current model is the following function: MV = -.000000005555RPM²+.000077777RPM+.72777 where MV is the modifying percentage for the pulse width and RPM is the current engine speed in rotations per minute.

The resulting "true" VE value for dictating pulse width will be to first use a map to look up the pulse width based on the current throttle position. Then, we'll multiply by the value in the map for the engine RPMs.

If if the throttle is at 45°, VE is 70.7% and pulse width is 3221 µs (excluding injector ramp times). Next we check RPMs (we'll use 3100 for this example) and see that our valve timing modifier value is .9155. 3221 * .9155 = 2948 µs. Finally, add injector ramp time of 1100 µs and the final signal on time is 4048 µs.

Up next is calculating acceleration of the throttle position to know when to boost a little extra fuel (if you crack the throttle fast, you need more fuel than normal, but only for a little while) and also taking into account engine temps. I might try to work out air density modifiers based on altitudes and temperatures, too... we'll see...
 

Attachments

  • tps.png
    tps.png
    4.9 KB · Views: 2,871
  • rpm.png
    rpm.png
    4.7 KB · Views: 2,893
More electronics tinkering last night...

I'm testing a (supposedly) 2 bar GM MAP sensor. I say "supposedly" because I can't seem to get it to read anything over 1 PSIG. It's more than happy to give me values in the in the 0-15.5 PSIA range, but nothing higher. I contacted the eBay seller to see what's up.

In the mean time, here's a quick test video...

http://www.youtube.com/watch?v=V2EKeOOCsR8
 
I'm thinking the output voltage exceeds 5 volts. The max the analog input can read is 5 volts (= 1024, 10 bit a/d). If it does go higher, just use a resistor divider to bring the max down to under 5v.
 
The thing is... I'm only getting 2.8V out of it... So I suspect something else is going on?
 
What is it spec'd at? Do you have a data sheet for it? Maybe 2.8v is full voltage? This might be a dumb question but I had a similar issue at work. I was measuring a 5 volt regulator at only 2.9v. It turns out my meter was on manual range and was only measuring a 2.9 max until I set it to autorange. Now if it is truly 2.8v max, then just scale your software so that 2.8v is max or scale it up in hardware. So there's a few questions for you about the sensor specifications.
 
The A/D converter built into the Arduino has a range of values from 0 to 1023 and I was getting a value of 514 when measuring the ambient pressure in my office. That's about 14.6 PSIA and almost exactly what I'd expect to see from a 2 bar MAP sensor.

None of my research so far has indicated that a MAP sensor should use anything other than 5V for Vcc, so I'm still leaning toward something being wrong with the sensor... The weird thing is, if it were a 1 bar MAP sensor, I should be seeing about 4.8V from it at atmospheric pressure... So my sensor is acting like a 2 bar variant, but is only sensing vacuum and not much in the way of pressure...
 
Ok I see. What does it read at vacuum? -2.8v? Maybe -2.8 to 2.8v? Anyway, carry on and good work so far.

Btw, I've been busy laying out PCBs. Fun stuff! I'd rather have etched PCBs than hand wiring.
 
The voltage is linear as the unit starts to read vacuum. 0V is absolute vacuum at 2.5V is 14.7 PSIA.
 
eyhonda said:
Btw, I've been busy laying out PCBs. Fun stuff! I'd rather have etched PCBs than hand wiring.

I am so damn tempted to get a home etching unit. Maybe I can get a mini C&C mill and just mill my own boards. :D
 
Nah, just etch it like the pros. I read you can etch using a laser printer. The toner is etch resistant. Just iron it on the copper board. For only $5 a square, I'll have a board house do it. And that's for 3 boards! You can etch down to 6 mil traces and clearances. That would be tough and expensive for a mini mill.

http://oshpark.com/

Download KiCad. It's a full design suite. Schematic to Gerber files. It's too addicting. For a $15 pcb, it's not worth even an hour to hand wire boards now. It would take a tech at $10 an hour to wire a board in a day. Even then, it would have a wiring problem and it's a nightmare to troubleshoot.
 
Back
Top Bottom