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.
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.
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.