EFI / ECU CORVAIR AIRCRAFT ENGINE

The following page details the development of my Electronic Fuel Injection (EFI) Engine Control Unit (ECU) for my Experimental Aircraft Corvair Engine. This project was the result of my work getting my Corvair engine running with a MegaSquirt EFI ECU, with the goal of having an ECU tailored specifically to an experimental aircraft engine.

I'll admit, I'm not nearly the first person to develop an EFI ECU system; there are several from the DIY level to a fully developed professional package. But my goal here is to develop a system that is simple, reliable, and specific to aircraft engines. Aircraft engines are different than automobile engines in that they may start by hand propping, they run at near full throttle the majority of the time, and they don't require firmware subroutines that deal with transmissions, emissions, and a dozen other ancillary items.

The main comment I want to make is the importance of having a balanced design of the system. There are three areas of focus for an EFI ECU system: (1) The engine hardware, (2) the controller, and (3) the firmware. Several times I've seen where the builder spent a large amount of time working on the engine components (milling heads to develop port injection, working out really great looking fuel rails, custom intake manifolds) only to then just slap on a controller pulled from a car. The firmware running on the controller is equally, if not more important, than the hardware on the engine.

The First Firmware Iteration
The Controller
Setting Up the Test Engine
Grounding and Battery Lesson
The Second Firmware Iteration
Trigger Wheel Experiments


2010

The Firmware, First Iteration

Sometime while I was getting the Corvair running with a MegaSquirt controller, it became evident that I didn't have the level of control, nor the level of comfort, over the firmware running in the MegaSquirt. On their earlier revisions, they had made the source code available as "open source", but then they stopped on later revisions. I had the opportunity to review the source, and it was massive (it had every option for any engine incorporated). I wished to fix a bug and add some features and determined it would simple be easier to start from scratch.

The MegaSquirt is a nice breakout board for a Freescale microcontroller and has the necessary circuits for sensors, injector control, and ignition control. So I downloaded the free version of CodeWarrior from Freescale. After a few months, I had the basis for a future firmware.

This firmware was loaded onto the MegaSquirt module and bench tested, and appeared to operate as expected. In other words, this setup was not connected to an operating engine, but rather to an external simulator for the inputs, and the memory values were observed with a software debugger, and outputs checked by oscilloscope.

So at this point, I was confident that a complete firmware replacement for the MegaSquirt was within my ability.

2011

The Controller, Iteration 1

There were a few things I wanted to try with the controller and a few features I wanted to add (such as cylinder head and exhaust gas temperatures) and it was apparent that I was limited by the MegaSquirt controller. So I set out to start from scratch with a controller as well.

Since I had already written the code around a Freescale microcontroller, I researched Freescale prototyping boards and found the Adapt series from Technological Arts. Below is a picture of the Adapt9X12XS:

EFI ECU Corvair Aircraft Engine

March 2013

As a teaching aid, I reviewed the individual input and output circuits from several EFI boards. They all seem to be almost identical. But this made since they are all very basic circuits. Most inputs have a resistor to limit current flow, and a capacitor to filter noise. Some have a pull-up resistor, the voltage input is a voltage-divider, and everything else is based on a specific chips manufacturer's recommendations.

I was then able to layout the circuits I needed. The basic schematics are shown below:

EFI ECU Corvair Aircraft Engine

I also layed out the circuts on a prototyping board:

EFI ECU Corvair Aircraft Engine

December 2013

After two days of soldering, I had the prototype ready for testing. I only included one injector and one ignition circuit. With that excercise complete, I think next time I'll just order a printed circuit board.

EFI ECU Corvair Aircraft Engine

EFI ECU Corvair Aircraft Engine

The proto board connects to the break out board:

EFI ECU Corvair Aircraft Engine

Now, for future reference I have listed the details of the Harley throttle body I am using. In essence, the Harley throttle body is a port injection setup on the motorcycle since the output flanges bolt directly to the cylinder heads. I'm using it as a throttle body type system. And the main reason I'm using it is that in a single assembly, I have everything I need... a throttle plate, injectors, fuel connection, and all of the normal sensors.

One could surely do the same thing with any motorcycle throttle body, but this one was also readily available on Ebay.

EFI ECU Corvair Aircraft Engine

Here are the specifics for the throttle body accessories. Since I would need to build connectors for everything, I've listed all of the connector details, all of which can be found at Mouser.com:

INJECTOR

Harley Davidson 27709-06A. 25 degree pattern type. 3.91 grams/s (31.03 lbs/hr) at 3.0 bar (43.5 psi).

Requires Delphi connector 15419715. GT 150. Push to seat.

MANIFOLD AIR PRESSURE (MAP) SENSOR

Harley Davidson 32316-99. Delphi 28004403. Pinout: A-Ground, B-Signal, C-Voltage (from left to right with locking tab down).

Requires Delphi connector 12129946. Metri-Pack 150. Push to seat.

MANIFOLD AIR TEMPERATURE (MAT) SENSOR

Harley Davidson 27381-06.

Requires Delphi connector 12162215. Metri-Pack 150.2. Pull to seat.

THROTTLE POSITION (TP) SENSOR

Harley Davidson 27659-06.

Requires Delphi connector 12065287. Metri-Pack 150.2. Pull to seat.

IDLE AIR VALVE

Harley Davidson 27658-06

Requires Delphi connector 12162188. Metri-Pack 150.2. Pull to seat.

OIL TEMPERATURE SENSOR

Common make

Requires Delphi connector 12162194. Metri-Pack 150.2. Pull to seat.


January 2014

I had a nice test engine mount for my Corvair engine when I was in Illinois, and I even moved that stand to Oregon when we moved in 2010. But is was very large and in the way, and so I got rid of it and just stored the Corvair engine in the corner of my shed. Yep, I kind of which I kept it.

So I built a new one. It's simple, obviously made from plywood and 2x4's, and just a little embarrassing.

The Corvair engine and the Harley throttle body setup is exactly the same from my original MegaSquirt setup (read about this on its dedicated page). This setup is know to run and shall be used here for testing my new ECU and firmware.

EFI ECU Corvair Aircraft Engine


Lesson About Grounding and a Good Battery

So I wired up my new controller and started testing the individual parts. I checked to see if it would connect to my laptop... good. I check to see if it read the sensors... good. I calibrated the sensors so that values were correct... good. I wrote a test program that would open and close the injectors a couple of times a second... good. I did the same thing with the ignition... good.

Then, I wrote a subroutine to fire the ignition several hundred times a second, just like you would expect at a high RPM... PROBLEMS! The spark on the plugs were good, but after a half a second or so, the spark would speed up out of control. Additionally, my injectors would randomly trigger at the same time. This would not happen if I slowed down the frequency of the spark, so I figured I was electrically saturating some circuit.

My first guess was that I was asking too much from the ground system of my prototype ECU. So I rewired it to relocate the EGBT (coil ignitor) off board with its own ground. These EGBT's are not cheap, and so I was a little agrivated when that one ran out of control and failed (it actually smoked with a little white cloud). I rewired grounds, added capacitors... I knew I was saturating the grounding system and it was screwing up the EGBT's of the coil and injectors, but I was at a loss.

In a fit of frustration, I removed my ECU and stuck the MegaSquirt module back on!

I guess I thought I would check the firmware on the MegaSquirt, and figure out my controller later. Now it came time to try to start the engine!

Deep breath, throw switch, "clunk" of the starter engaged, and it won't turn through a compression. Well, maybe my grounds are loose. I checked, found a few not tight, tightened, and tried again... still not working! OK, so maybe my shop battery is too small (but it worked several years ago). So I pulled the battery from my truck... still not working! So I jumpered the two batteries together... nope!

What it the world?! Two batteries and still not working?!! OK, put the truck battery on charge and come back later. Later, I flipped the starter, and THERE IT GOES!!! I didn't have the ECU on, I was just checking the starter, so it wasn't running... but at least it would turn over, and very quickly at this point! I took both batteries to AutoZone, had them checked, and both were bad!

With the new battery, I had no starter problem... and come to think of it, I probably wouldn't have had any ECU problems!

Lesson learned: Don't use old batteries.


I strapped the stand to my truck. I plugged in the MegaSquirt module with my new firmware to my laptop to datalog the test. Once I had some initial fuel settings corrected, it ran!

Yep, my software works.

EFI ECU Corvair Aircraft Engine

If you watch the video below, you'll notice that although it does run, it's running really rich and misses a few times. I stop it by turning off the fuel pump, and in that last second, it smooths out and picks up a bit of RPM. By choice, the top speed of that run was about 1500 RPM.

--- Click HERE for a WMV Video of the engine running. ---

I did some other engine and software adjustments, and because I was working next to a spinning propellor, for safety I built a plywood flywheel.

EFI ECU Corvair Aircraft Engine

The Firmware, Second Itteration

Now I was at a crossroads. I had a running Corvair on a MegaSquirt controller with my own software. What I ultimately want is a running VW (for my Thatcher) on my own controller with my own software. My plan is to use this Corvair on my "next" airplane build, and so if I have a custom ECU that works on either the Corvair or the VW, then my time isn't wasted.

I didn't see a need at this point to continue testing using the MegaSquirt controller or continue developing it's software. Basically, the MegaSquirt doesn't suit my needs, and so it comes off the stand and goes back into the drawer. What I have at this point is confirmation that my software will operate.

Speaking of software, the Integrated Development Environment (IDE) for the MegaSquirt and the Freescale breakout board that I had was a bit frustrating. The CodeWarrior IDE was fantastic, but it only ran on Windows, and I needed special hardware to upload firmware on my Freescale board.

It's been a few years since I made the decision to continue on with the Freescale controller, and in that time the Arduino breakout boards have become very popular. Because of their popularity, they are available everywhere (as opposed to my Freescale board which is available only from a single company located in Canada). Also, they come equipped with a USB port, a serial bootloader, and the IDE works on Windows, Mac, and Linux. So I decided to port the project over to an Arduino Mega 2560.

That soldering a "sea of holes" proto board like I did on the first itteration is just too much work. It was easier to develop a PCB and have a few prototypes fabricated. So after a weekend of board design, and a week waiting for the board to be built, I have a PCB

EFI ECU Corvair Aircraft Engine

OK, this is cool. I have an Arduino Fuel Injection Engine Control Computer! Now I just have to solder components and convert the software for the new board.

Arduino has a simplified IDE, and for the most part they have libraries available for typical microcontroller functions. This is great for learning, but I was about to develop a very complicated program, and I didn't want to get half way into it and find that their libraries limited me in some fashion. The price of simplicity is that lack of options. So I set up the Eclipse IDE to develop programs for the Atmel AVR Mega 2560 (which is the microcontroller on the Arduino board). In essence, I'm using the Arduino board only as a breakout board and do not plan on using any Arduino specific software.

After a few days, I had started from scratch, incorporated a few major changes to the way my ECU firmware is setup, and had rewritten my entire ECU code for an Atmel Mega 2560 microcontroller.


Trigger Wheel Experiments

The trigger on the current Corvair setup is a simple tooth located at top dead center for each cylinder. There are three crankshaft triggers for this six cylinder engine. The ECU has no idea which cylinder it is creating a spark for, this is taken care of by the distributor cap.

My future plan is to use coil packs, and so the ECU will have to be synchronized and know which cylinder it firing. Typically, this is done with missing tooth wheel or some other method to sychronized the ECU with TDC of cylinder #1. The downside is that the engine must spin about a full revolution before this can happen. This is great if you have a starter, but on an airplane I want to be able to hand prop if necessary.

When you hand prop an engine, you need to be able to start based on less than a 1/4 turn of the crank. So I need to have RPM and current cylinder information in 1/4 of a turn or less.

My solution is a set of teeth. For my VW, I plan on using three teeth for cylinder #1 and #3, and four teeth for #2 and #4. With three teeth, I can see the first tooth, calculate the RPM on the second tooth, verify RPM on the third, and trigger based on a missing fourth. Three teeth will indicate the #1/#3, and four will indicate the #2/#4 coil to be fired.

As a test, I built a crazy missing tooth wheel from a saw blade and mounted a test rig with a hall effect sensor. I wrote up a routine to count teeth, perform calculations, and indicate spark. This was successful.

EFI ECU Corvair Aircraft Engine

Additionally, I wrote a subroutine to spark only above a certain RPM. If one is hand propping an engine, you don't want an accidental spark if you move the propellor in position (I'm sure to also have a switch on the panel to set "switch off" or "contact" as you would normally expect in an airplane). So, now I have the routines I need to gather RPM and current cylinder in less than 1/4 turn.

I could find no other wheel that used this exact type of encoding. So, if I get this working, and in several years we find this method being used on other engines, I just want to say that it was my idea (insert smiley face here).