Homebrew EFI -- the ECU
Update 2008: The MicroSquirt looks like it fulfills all my requirements. This page is only here for hysterical porpoises.
The simplest way to build the ECU would be to use an
existing design such as the Bowling & Grippo
or the MegaSquirtAVR.
On the other hand, part of the fun of this project is
to hack together something out of nothing, so I'm
considering designing my own ECU.
Designing New Hardware
The injectors I'm
using are low impedance types, which need some kind
of current control device. I can't help thinking that
the simplest way to drive them is going to be to use a
Drive Controller which is designed for this very task
and available in an 8-pin DIP package.
Eventually, I'd like to get rid of the standard
'black box' CDI units and bring ignition advance
under software control. Before I do this, I'll
have to learn a bit more about CDIs. Due to the
high voltages involved, I'll build the
into a separate box, driven from optoisolated
outputs from the ECU.
One or more idiot lights on the dashboard can reveal
operating mode and any error conditions. If the
microcontroller can source 20mA, LEDs won't even
The engine has to switch the fuel pump and the
O2 sensor heater on and off. I'd like it to
take control of the starter motor too, I think,
locking it out once the motor is running.
Either darlington drivers or MOSFETS would be
useful for this.
Designing New Software
This stuff is based on my original notes, and will
slowly be replaced by the newer, more organized stuff
- The environment on a motorbike is even tougher than
that in a car engine bay, with cold rain, hot oil and
warm beer frequently sloshing around. Also, the electronics
must be protected from impact and vibration, especially
on an off-roader. Locking the circuit inside a sealed,
die-cast aluminium box seems to be the way to go here.
Cable entry would need to be via waterproof cable glands.
The Alumnimium box would also provide an effective heat-sink.
(as long as it wasn't mounted too close to the exhaust pipe).
Foam inserts (rather than solid screw mounts) could protect
the board from vibration, although having a bunch of TO-220
components bolted to the case might stop this working.
Maybe bending their legs into an S shape would be sufficient.
- Size is at a premium too. On a car-oriented design,
you've got a lot of spare volume under the hood. For
a bike, you're much more restricted: 6" x 4" x 2" would
be about the limit on the XLV. The MegaSquirt is
6.25" x 4.25" x 1.75" so that's at least the right ballpark.
Jaycar sell nice sealed boxes 115 x 90 x 55
(4" x 3.5" x 2.1") which might be a goer if it can all
be made to fit.
- The CPU should do as much as possible, thus minimizing
interface components. It's easier to fit more code in
the box than more parts. However, a one-chip solution is
far preferable to a two-chip solution, because tracks
eat up board space. This indicates a CPU with onboard
RAM, ROM, ADCs and PWM. Fortunately, modern microcontrollers
come with an amazing amount of that kind of thing.
- Use MOSFETs and SCRs where appropriate to minimize
heat dissipation. TO220 and TO126 devices fit more easily
- It should also control the ignition (CDI) timing and
(solid state) fuel pump relay, and maybe even an electronic
cooling fan for bikes which have one. If a flyback is
needed to produce the CDI voltages, the CPU can control that
as well. A bypass valve may be needed to raise cold idle.
K-bikes apparently send the starter motor signal via the
ECU to stop it spinning when the engine is turning, which
is a thought.
- Also has to switch on O2 sensor heaters. Should be
in the order of 2A each
- Communication to the user should be via a single
'idiot' light LED on the dash. Green for go, Orange for
trouble, Red for failure. Flashing patterns can indicate
what the problem is. More idiot lights on the board can
help with side-of-the-road diagnosis too. And now Jaycar
sell RGB LEDs! More lights, more lights!
For existing ECUs, see the Homebrew EFI Links page
- Should use existing crank sensors where possible.
Generator phase may provide extra information here if
needed ... check frequency per RPM (bike generators
are often mounted on the end of the crank). On the
other hand, the current CDI system uses these sensors,
and apparently CDI phase is more critical than EFI
- Lambda / O2 / EGO sensor(s) -- apparently vary
between 0 and 1 volt, impedance in the order of
1 Mohm. So it'll need some kind of shielding
(or at least noise rejection) and
Hi-Z buffering. It'd want to be a heated one,
so that's 4-wire.
- Manifold vacuum, TPS, CHT -- use
commercially available sensors and interfaces to avoid
- Killswitch should immediately stop ignition,
fuel pump, everything stone dead. It should not
just signal the controller, it should operate an
override relay or something in case of disaster.
- Starter button feeds into the ECU so that it
can refuse to run the starter w/ the engine going.
Maybe the button could be used to communicate with the ECU
when the engine _is_ running? Eg: to change maps.
- Power/Economy switch? Wheel speed? Accelerometer?
for an ignition lock? The possibilities are endless :-)
homepage / motorcycles / Homebrew EFI