DIY Electronic Ignition, Take Two

It’s been over a year since I threw together a proof-of-concept electronic ignition for my friend’s 1966 Honda CB77.  Not content with the original, overly generic design; I’ve been working on something a tad more bespoke.


The image on the left is, of course, the factory points setup for the CB77. On the right is the PCB I made to replace it, populated with two copies of my earlier design – albeit in somewhat different form.

Also, in addition to the Hall-effect triggered IGBTs, there are a number of components added for testing purposes, as well as not-yet implemented features that (testing has revealed) are in desperate need of revision. The light blue kynar is there just to break-out some test points.

Here are some more images, before and after population:

As is my custom, after I laid out the major components I auto-routed the board – cleaning up traces as I saw fit (read: as much as I had patience for). There will likely be a lot more tidying before I consider it a finished product.

The primary components and functionality remain unchanged from my original design, with the Hall latches and IGBTs only translated to their surface-mount brethren. I went to great lengths to preserve reasonable isolation around anything subjected to high voltage DC, and even greater lengths to provide adequate heat-sinking for the IGBTs (via the ‘winged’ copper pours), all in a relatively aesthetic package (one that, ironically, is designed to tuck up under the points cover – completely unseen). Incidentally, I’m now quite professional at writing scripts for eagle in polar coordinates.

While the original points setup required only two wires, this design requires four. The two coil wires (just as in the points setup), with an added power and ground. Now, while the addition of the power wire was unavoidable, I fought a bit with whether or not to ground through the housing. In the end, I decided that one more wire was manageable, and would provide a more robust DC return, while also helping to preserve isolation (as grounding through the housing would require additional ground pours, encroaching on the IGBT heat-sinks).

For testing purposes, I’ve mounted this board to its parent housing, which I’ve in-turn mounted to a test fixture I cobbled together.


I’m almost ashamed to say it, but a lot more effort went into building that than really shows. Regardless, it’s been invaluable in testing and evaluating the board’s functionality.

Triggering is managed by a pair of magnets (with opposite outward-facing poles) embedded in a wooden disc, mounted in the collet of a spindle motor. The spindle motor is powered by a 48V 600W supply, with variable RPM managed via PWM.

The results:

The blue trace is taken from the gate of the right-side IGBT, with the yellow taken from the ‘negative’ terminal of the corresponding coil (with respect to ground). 191.5Hz works out to 11,490 RPM. Plenty.

And then there’s the other end of the spectrum:

This is roughly 525 RPM, and it’s where the limitations of my benchtop supply become painfully apparent. It’s a 0-15V 3A supply, here set to 14.6V. Current draw was sufficient to load it down to around 10 Volts – with the loading of the second coil causing some stepping in the blue waveform. Despite all this, and the pitiful 30V counter-EMF on the coils, the plugs kept firing away happily, with sharp blue sparks.

Unfortunately, despite this hugely successful outcome, there’s still a lot more testing left to do. With an appropriate trigger wheel, I’m extremely confident I could bolt this into any CB77, do some minor tuning, and be on my way. But for how long? That’s another question entirely.

While I feel I’ve provided adequate heat-sinking, and while the IGBTs remained at room temperature throughout all stages of testing; it is an air cooled motor with almost zero airflow under the points cover. Without some real-world testing and abuse, there’s really no telling what conditions will be faced. The good news is that there’s some precedent, with the max operating temp of the Hall latches and IGBTs exceeding that of the FR4 PCB, of which many other ignition conversion PCBs are made.

As for what’s next, I need to revise or eliminate the aforementioned non-functional features, further clean up the board routing, have a proper trigger wheel machined to mount on the original points cam, and do some real-world testing (volunteers?).

Once the design is finished and tested, I will be releasing everything I have – completely open source (as is everything I’ll ever post to this blog). If anyone is interested in the eagle files prior to that, just hit me up and I’ll happily share (but don’t expect a lot of sense, cleanliness, or support).

Adding an AUX Port to a Car Stereo

Like most people, I can’t stand the music that’s played on my local radio stations. Unfortunately for me, my car’s stereo is an FM/CD unit from the 90’s – and thus has no AUX input. Seeing as I haven’t owned a CD in over 10 years, I had to come up with another solution.

Now, a ‘normal’ person would just go out and buy an aftermarket head-unit with some kind of auxiliary/MP3 input, but I’m a dirt-poor university student with a soldering iron, so I had something else in mind.

The first thing I did was completely tear down the stereo, expecting to have to power it up on the bench and poke around with an oscilloscope probe.


As soon as I had the mainboard out I was greeted with a rather pleasant surprise – the factory had silkscreened the outputs of the RF can, making this mod incredibly simple.


The “L OUT” and “R OUT” traces feed into what I presume are DC blocking capacitors for the amplifier inputs – a perfect place to inject the AUX audio.

So I cut the traces and inserted a 5-Pin 3.5mm Stereo Jack according to this schematic:


This ‘switching’ stereo jack allows the radio to work as it normally would when nothing is plugged into the AUX port.

Modified, the PCB looks like this:


After that I had to find a place to physically mount the jack. The front panel had absolutely no unused space, so I decided to sacrifice the “DISC IN” LED (what a useless thing anyway).


Perfect! Except now the LCD panel PCB won’t fit…


I had no qualms with simply cutting away the section of the PCB that held the light, but that large trace was part of the switch matrix, so I had to run a bypass wire on the back of the PCB.


I temporarily tacked a bypass wire in place, as I wanted to be sure the wire would clear the CD mechanism when reassembled (hence the sketchy soldering).

After reassembling the unit and testing it, everything – including the mod – worked perfectly.

My morning commute just got a little bit more tolerable.

$30 2MHz Sweep Mode Function Generator

A function generator is one of those basic pieces of equipment that every bench should have. Unfortunately, they’re not always affordable, and when all you need are basic functions, it’s sometimes more palatable to simply slap something together with a 555 or a microcontroller to generate basic trigger signals – which is how I’ve gotten by until now.

Lately I’ve been playing around with a lot of designs that involve sampling various types of signals, and the aforementioned ‘poor mans sig-gen’ solutions were just no longer viable. While I would have certainly loved to drop $300+ on something from, say, the Siglent SDG1000 series; my needs and budget couldn’t even come close to justifying it. Instead I decided to look for something broken that I could repair, which is where most of the equipment I own comes from.

Unfortunately, even when in very rough condition, name-brand equipment still sells for more than I would care to spend on a ‘basic needs’ function generator. After a few weeks of desperate searching, I finally came across a “Global Specialties 2003 Synthesized Function Generator” listed as “not working” for $30 on ebay. While I wasn’t too sure of the brand, it seemed worth a go (especially for the price).



As you can see in one of the pictures, the unit was failing to display anything properly, and the seller couldn’t verify any output.   Once it arrived, I wasted no time in opening it up, and the cause of the display problem became immediately apparent (or so I thought).


Now, I don’t know if that was someone’s botched repair, or if that was the solder job from the factory, but either way it’s fucking shameful.

After temporarily bypassing the horribly-soldered flat cable with some kynar, I was greeted with the not-so-fun discovery that the cable wasn’t the sole problem.  Half of the display was just plain dead.


At this point things weren’t looking too good for a quick fix.  The display was some obscure piece from the mid 90’s, and the only exact-replacement I could find was $70.  My next thought was to try and identify the type of protocol it was using, and maybe find a cheaper compatible display.   It only took a few minutes of pin counting and tracing before I started to get the feeling that it was an HD44780 compatible display, and I just happened to have one lying around.



It took a bit of messing around to fabricate an appropriate mount and permanent cable solution, but all in all I have $33 invested in this thing, and it does everything I need.  Also, while the specs list the max frequency at 1.6MHz, I was able to push it to 2MHz (albeit not very cleanly – but good enough for basic triggering).  The interface is also a god-awful nightmare, and if it proves worthwhile I may try and devise an alternative.

DIY Electronic Ignition Conversion

Recently, a friend of mine acquired a 1966 Honda CB77, and I offered my help in the rebuilding process.  Part of this process includes updating the electrical system, and modernizing where it won’t affect the aesthetic of the bike.

The first modernization on the list is converting from electromechanical points to a fully electronic ignition.  Unfortunately, while there are a few commercially available kits, they all run well into the hundreds of dollars.  Fortunately, there really isn’t much to a basic electronic ignition conversion, and it’s a fairly trivial DIY endeavor.

My approach is very similar to others (especially the ubiquitous PAMCO conversion), in that it’s based around an ignition IGBT triggered via a Hall effect latch.

Before I get too much into discussing the design, it’s perhaps best to review the principles behind a conventional ignition system.  (Caution: physics ahead).

So, the obvious purpose of the ignition system is to make a spark – but this is easier said than done.  The spark needs to jump a gap (the plug gap) in an atmosphere of compressed air and fuel, reliably, and at a precise time.  Why is this so difficult?  Well, the dielectric strength (effectively the maximum potential applied to a material before conduction occurs) of air/fuel under 10:1 compression is on the order of 15 *million* volts per meter.  With a typical plug gap of around 1 millimeter, the potential required to have any spark at all is around 15,000 volts!  If we want a potent, reliable spark, it’s best to up that value by about a factor of two.  (These values are all within ‘cosmological accuracy’, but ballpark figures are all we need here).

Alright, so we need roughly 30,000 volts from a 12 volt system.  How?  Well, more physics of course!

Physics gives us a neat trick for not only generating such high potentials, but also for doing  it at a precise time we can control by fairly simple means.  The phenomenon is called counter-EMF, where Ec = -L (dI/dt).  This says that the potential across an inductor caused by a change in current is proportional to the current’s rate of change.  So all we need to do is rapidly change the current flow through an inductor, and we’ll have some high voltage across that inductor.

Now, it’d be nice to say that’s all we need to do, but there are some caveats that require a little more engineering cleverness.  The first problem is that 30,000 volts is almost impossible to control directly, as most insulators become conductive long before this (which is the whole point).  Second, high inductance coils require longer times to fully ‘energize’ (due to the same phenomenon) – this ‘energize’ time in an ignition system is usually called “dwell”.  So how do we deal with these issues?  Simple, instead of a single inductor, we use a transformer – two (or more) inductors sharing a common core.  In this case, our transformer is called an ‘ignition coil’.

So now we have something of a plan.  We take a transformer of say, 1:100 turns ratio; we use counter EMF trickery to apply 300 volts to the primary side, giving us 30,000 volts on the secondary side; then we use a spark plug with a tuned gap between the terminals of that secondary side, giving the 30,000 volts something to jump across and make a spark.  Perfect!  Now we just need to generate that counter-EMF at a precise time (which, ultimately, is what this is all about).

Until the adaptation of solid state devices in automotive ignitions, the current control through the primary of the ignition coil (and subsequently all aspects of ignition timing) was handled by points – a set of contacts acting as a switch between the negative terminal of the coil and system ground.  As the engine rotates, a mechanical cam opens and closes these two contacts at “precise” times with respect to the engine rotation. ( I put “precise” in quotes because anyone who has experience with points will tell you what a pain in the ass they are to keep properly adjusted.)  The timing is such that the points make contact at the beginning of the dwell period, allowing current to flow and ‘energize’ the primary of the ignition coil.  Then, when the piston is at TDC, the points cam separates the contacts, causing a sudden change in current through the primary (a high dI/dt).  This produces the aforementioned 300 volts of counter-EMF across the primary of the ignition coil, which produces 30,000 volts across the plug gap, and we have a spark – right when we wanted it.

Phew.  That was far more painful to write than to read, I assure you.

So, here we are, with a marginally functional set of points that do the job but require more maintenance than a modern human cares to invest.  Luckily, solid state devices exist that can handle switching of large currents (fully saturated ignition primaries can draw upwards of 5 amps), while incorporating internal clamping protection against high-voltage damage.  The most common of these that I’ve found is the 14C40L series of ignition IGBTs manufactured by International Rectifier.  Even at under $4 a pop, they are still the most expensive component of this project (even more expensive than the professionally fabbed PCBs).

On to the design:


So, how does it work?

The A1250 Hall latch can be in one of two states, and remains in that state until switched.  When ‘on’, its ouput is dumped to ground.  When ‘off’, the output is pulled high by the 10k resistor connected to VCC (I believe this particular Hall latch has an internal pull-up, but I feel it’s more robust in this configuration).  This normally-high line is connected to the gate of the IGBT through a 2k resistor (to prevent ringing on the gate).  The IGBT is an N-channel device, so the drain is connected to the ignition coil’s ‘negative’ terminal, and the source connected to ground.  C1 is simply there for decoupling, and D1 prevents reverse bias between the source and drain (this is redundant to the internal clamping circuit of the IGBT).

So, when the north pole of a magnet passes by the Hall latch, the output is pulled high, along with the gate of the IGBT.  This allows current to pass through the coil, energizing it.  When the south pole of a magnet then passes the Hall latch, the output goes low, pulling the gate of the IGBT low, causing a sudden cessation of current through the ignition coil primary, which leads to all the aforementioned physics voodoo, giving us a precisely timed spark.

So that’s all fine in theory, but does it actually work? Yes, it does.

Here is the PCB I laid out:


I know it’s not pretty, but it’s only intended as a proof-of-concept prototype and I wanted it made as quickly and cheaply as possible.  At $1.15 for 3 boards (fuck yeah, OSH Park), the only cheaper components of the build are the 1206 discreets.

Here it is, built:


Don’t ask about the Jolly Roger, it was my first order from OSH Park and I wanted to test their silkscreen capabilities.  And because I sort of want to be a pirate.

I’ve tested this thing with a couple of magnets stuck on a bolt and it certainly seems to function as intended, at extremely low cycle rates at least.  Solid state devices and magnetic fields being what they are, I have no doubts that it will scale up to higher frequencies just fine.  After all, even 15,000 RPM is only 125Hz.  Using a transistor in place of the Hall effect latch, and triggering with a 555 timer, I was able to get reliable operation well into the KHz.

The next step is to build a trigger wheel to hold the magnets and attach to the original points cam (to take advantage of the inbuilt mechanical timing advance).  My brother is a killer machinist who doesn’t seem to mind doing me favors, so I’ll probably lean on him for the final part.  Prototyping will probably be done in a very hack manner with PVC or somesuch, and you can expect updates in future posts.

Eventually I’d like to design around a microcontroller, so that all the advance (and even custom advance curves) can be handled electronically.  Right now I just wanted to make something cheap and functional, because these mechanical points simply have to go.

Oh, and speaking of cheap, final cost for a pair of these:  $11.72

Sure beats $200.

Other motorbike stuff to come:  Solid state PMA voltage regulator/rectifier, Neutral-disengagement-triggered headlight switch, Mechanical-to-digital speedometer & tachometer conversions, and probably more stuff that I haven’t even thought of yet.

A Damned-Near-Free Arduino Uno

Recently I needed an Adruino Uno for a project I’m working on.  I already have an Arduino Mega2560, but the Atmega2560 is a far more costly chip to embed, and my project requires access to multiple timers, which is more easily facilitated by the Uno.

There are a number of Uno clones on ebay for less than $15, but I didn’t want to wait and I had the majority of the parts lying around already.  The best part?  The whole project (save for a few passives) didn’t cost me a penny.

How?  Well, for starters, Atmel is fantastic about giving away samples, and in this case I imposed upon them for an Atmega328P-PU.

Here’s what it looked like when I first got it up and running:


Now, before I go on, I have to say that there are two things I don’t want to hear about:  How shitty my camera is, and how Ben-Heck the solder job is on that .1uF capacitor.  I scabbed it off an old PSU board and I couldn’t be bothered to clean the old solder off before using it here.

So while that picture looks like a huge goddamn mess (and it is, really); the majority of what’s shown is just to illustrate that it’s a functioning Arduino Uno (a blinking LED is hard to show in a still image).

A keen observer will notice that I’m using a pre-built CP2102 based USB-to-UART interface.  I had this module on hand from when I hacked my Hantek DSO, so it doesn’t violate my “free” statement.  However, to be honest, it does feel a little bit like I’m cheating, so once the USB-to-UART chip I ordered as a free sample arrives, I’ll post an update using it instead of what I have here.

Now, even with this pre-built interface, things weren’t entirely straight forward.  This particular interface required some slight modding, as the Arduino IDE resets via the CP2102’s DTR pin and not the already-broken-out reset pin.  This required some really fine solder work (.20mm), which I had to do with a crusty old Hakko clone.

This is what it looks like:


The nasty snotgob of hot glue is just there to keep the wire from getting yanked off.  And no, I didn’t cook the board, the brown stuff is just residue from the liquid flux.

Okay, so what about this goddamn Arduino Uno?

First things first, the barebones schematic:


Barebones indeed.  As I said, the majority of the stuff in the first picture was just for the LCD and other various playings around; this is all it takes to get the micro up and running.  Note that in the above schematic, TXD and RXD are labeled as they connect to the USB-to-UART interface, not to the chip pinout.  SCK, MISO, MOSI, and RESET are labelled for convenience when hooking up the DAPA cable, no special provisions need be made.

Once the bare minimum is breadboarded, the next step is making up a DAPA cable for bootloading the chip via AVRDUDE.


I used one of half a dozen old printer cables I had lying around (free) to make mine.  Now, you’ll find guides all over the internets using different resistor values, and sometimes no resistors at all.  The first schematic I found when I made mine used the above values, and it works for me, so it’s the one I’m reproducing here.

After the cable is made, it’s a simple matter to connect it up to the barebones Arduino Uno.  One thing to keep in mind, the DAPA cable does not supply power to the micro, so an external supply is required.

Next with WinAVR installed, and the bootloader hex handy, these next two lines run at the command prompt take care of the fuse setting and installation of the bootloader:

avrdude -P lpt1 -c dapa -p m328p -v -e -U efuse:w:0x05:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m

avrdude -P lpt1 -c dapa -p m328p -v -e -U flash:w:BootLoader328REV3_firmata.hex -U lock:w:0x0F:m

Those commands were successfully run on my WinXP machine; linux, mac, and other flavors of Win will likely require something other than “lpt1”.

And that’s it.  After that, I simply plugged the USB-to-UART interface into my PC’s USB port, started up the Arduino IDE, specified “Arduino Uno” as my board and started uploading code.  I repeated this process on two additional chips (Atmel sent me 3 Atmega328P-PUs) and it worked flawlessly every time.