I'm pretty sure we've all experienced this at some point: We're piecing together our project within our own minds and have finally arrived at a decision as to which direction we wish to go. So we start doing some research on the Internet only to find that our idea cannot be realized because no aftermarket solution yet exists. We're now stuck with a bit of a problem... Do we compromise our design? Unfortunately, that does seem to be the most common solution to the problem.
However, every now and again we're not willing to do that and so we begin to look into ways in which we can solve our own problem and implement our own solution.
For me, this has been the lack of a FULLY electronic ignition system for my motorcycle, a 1977 CJ360. After countless hours of searching forums and putting Google to work, I've only found a few offerings. Some systems use rotating disc and laser to simulate the points while others maintain the points as a signalling system to a transistor which then triggers the coils. Unfortunately, both of these systems maintain the mechanical advancer. This is good enough for some, but to me, good enough just isn't.
And so I began to do research of another sort. Mechanics, electronics, and computers have almost always fascinated me. I truly love systems of increasing complexity. I adore how simple gears, switched circuits, and single lines of code can be combined in new ways to achieve new goals. I set out to learn a bit more about electronics and how different components are used and how they interact. With a good deal of help from some more electronically minded friends and some adaptations to existing (similar) circuits I was able to find on the web, I've been able to piece together a rough diagram on how I want my electronic ignition to work.
The thing is, I'm no electronic engineer. I'm not always sure how to recreate, within electronic circuitry, the tasks I wish to complete. I am, however, a computer programmer and I began to look for software solutions to my problem. After discarding much of my existing programming knowledge as unsuitable for the task I began to look to lower-level solutions to the issue. Enter the PIC Microcontroller. This simple device is an extremely low-level computer processor. It (or variations of it) run nearly every single robot in existence and can be found in multiple places within existing automotive applications. I'm hoping I've made a good decision with this one. So now that I've selected the brain of my ignition, it's time to take a look at the components.
Picking the components (to me) is really more of a thought process rather than any sort of real step. I like to glance over the big picture like looking upon the cover of a jigsaw puzzle box. Once I've gotten a general idea of how the pieces are meant to look after they're assembled, this seems to give me a better idea as to which pieces I need. First up, the microcontroller I've selected (the venerable 16F84A) runs between 2.5V and 6V and the outputs are the same voltage as the inputs. This presents me with two initial problems to solve:
1.) My bike runs on 12V and so I can't power the microcontroller directly from the bike without some modifications.
2.) As the outputs of the PIC are going to be less than 6V, I can't run anything directly from the outputs of the microcontroller.
Fortunately, both of these "problems" are so common within electronics, it's not even funny. Enter solution to problem #1:
5VDC Solid State Voltage Regulator
This is a diagram I've made of a solid state voltage regulator. The 7805 voltage regulator is happy to accept up to 30V and will step it down to a smooth and steady 5V. The downside is that the 7805 kicks out a fair amount of heat and will definitely need a heat sink when I get it all together.
So what about problem #2? This one turns out to be pretty simple as well. Instead of triggering the 12V directly from the microcontroller, the PIC can switch a 5V relay. The relay then operates as an electronic switch that can handle much higher voltages and currents:
5VDC Relay
OK... so there's part of the problem moved over into the solution pile. Or at least, so I thought. As it turns out, the high voltage that's released by the coil isn't unidirectional. That is, when the coil fires, not all of the power goes through the HT lead and to the plug. It turns out a significant portion of this returns through the points and condensers. Most of you probably know about this already if for no other reason than you've seen the points sparking during operation. So the next step in being able to electronically fire the coils is to ensure that backlash of high voltage isn't going to come back through and cook all the silicon. I readily admit that this is the circuit I'm still trying to get my head around. I found a diagram online and a friend said it should do the trick. I'm going to take it on faith that this will fit my bill. If it doesn't, I'll go back to the drawing board and try something else:
Solid State Electronic Condensor
The TIP162 in the diagram above needs a heat sink as well. The backlash coming from the coils generates a lot of heat when you have that much voltage to dump.
So where are we now? We have a voltage regulator that gets a steady 5V to our microcontroller which, in turn, provides a 5V output to each of our relays. Each relay triggers each coil, but first passes through an electronic condenser. Sounds good.
One very important part we're missing though: We need an input signal to the 16F84A to let it know when to trigger each coil. As it turns out, timing something electronically is also a fairly common task. I'm making use of something called a Hall Effect Sensor. What this does is it transmits a small digital voltage spike every time a magnet comes within proximity. By installing a magnet at TDC on the end of my crank shaft and then placing the HES in a position so that the magnet will pass by it on every rotation, I need only count the number of clock cycles on the PIC to determine the RPM.
Hall Effect Sensor
Once I know the RPM, calculating out time and degrees will be relatively simple. For instance... I know my PIC is operating at 4Mhz because that's not only it's default speed, but I plan to attach a quartz crystal to its oscillator pins to ensure it's fairly accurate (within +- 20 microseconds of error for every full second that passes). As I mentioned earlier, the PIC is a pretty simple device and so it carries out commands at a rate of one command per cycle. Or, if you prefer, four million instructions per second. As an example, lets say that I'm currently counting 16,000 processor cycles between the pulses I'm receiving from the HES. First step, divide 4,000,000 by 16,000 to get my rotations per second. This leaves me with 250. Multiply by 60 to convert seconds to minutes and we see the engine is turning at 15,000 RPM.
For argument's sake, let's say I want my engine running at 38° of advance at this RPM and so I now need to calculate how many processor cycles passes in 322° (360° is a full circle, minus 38° of advance I want for the next firing of the coil). Well, we already know that 360° of rotation is taking 16,000 cycles, so simple division tells us that a single degree of rotation is taking about 44.5 cycles. Multiply this by 322° and we know the next time to trigger the coil is is 14,311 processor cycles. So after counting to 14,311 our microcontroller will open the relay for the left coil. I'm running 180° firing and so count another 8,000 cycles and then open the relay for the right coil. Recalculate RPMs the next time the HES triggers and then do it all again.
But I digress... that's more of the software side I have yet to implement. All of this math, however, did get my mind wandering off to other uses for the PIC. I've come up with a couple of other features I plan to include.
First up, I'm going to implement an electronic redline. At 12,000 RPM (and above) the PIC will no longer trigger the coils to fire. No spark means no power and so the engine can't/won't exceed 12,000 RPM.
Next, I've been wanting to run an external oil pump and so I plan to install one and control it from the PIC. At 6,000 RPM one of the outputs from the microcontroller will signal another 5V relay to switch on the oil pump. At less than 6,000 it will switch off again. I may adjust this limit later, but I only want the pump on in the higher RPM bands so that it's not sucking too much power. The charging system isn't great on my old CJ and the oil pump is expected to draw about 40 Watts, a full third of what my alternator is capable of putting out. Gotta keep those RPMs high for full power output.
Third, will be shifting lights. At 9,000 RPM, I'll trigger an LED to light up to indicate that it's time to shift when I'm going balls to the wall.
The Full Monty
The best part (at least I think so) is that this device should work with any two or four cylinder motorcycle as the ignition curve is fully programmable.
Thoughts? Suggestions? Concerns?
This is a first for me and I'm hoping to get some idea as to your guys opinions. Any technical additions would be extremely welcome.
However, every now and again we're not willing to do that and so we begin to look into ways in which we can solve our own problem and implement our own solution.
For me, this has been the lack of a FULLY electronic ignition system for my motorcycle, a 1977 CJ360. After countless hours of searching forums and putting Google to work, I've only found a few offerings. Some systems use rotating disc and laser to simulate the points while others maintain the points as a signalling system to a transistor which then triggers the coils. Unfortunately, both of these systems maintain the mechanical advancer. This is good enough for some, but to me, good enough just isn't.
And so I began to do research of another sort. Mechanics, electronics, and computers have almost always fascinated me. I truly love systems of increasing complexity. I adore how simple gears, switched circuits, and single lines of code can be combined in new ways to achieve new goals. I set out to learn a bit more about electronics and how different components are used and how they interact. With a good deal of help from some more electronically minded friends and some adaptations to existing (similar) circuits I was able to find on the web, I've been able to piece together a rough diagram on how I want my electronic ignition to work.
The thing is, I'm no electronic engineer. I'm not always sure how to recreate, within electronic circuitry, the tasks I wish to complete. I am, however, a computer programmer and I began to look for software solutions to my problem. After discarding much of my existing programming knowledge as unsuitable for the task I began to look to lower-level solutions to the issue. Enter the PIC Microcontroller. This simple device is an extremely low-level computer processor. It (or variations of it) run nearly every single robot in existence and can be found in multiple places within existing automotive applications. I'm hoping I've made a good decision with this one. So now that I've selected the brain of my ignition, it's time to take a look at the components.
Picking the components (to me) is really more of a thought process rather than any sort of real step. I like to glance over the big picture like looking upon the cover of a jigsaw puzzle box. Once I've gotten a general idea of how the pieces are meant to look after they're assembled, this seems to give me a better idea as to which pieces I need. First up, the microcontroller I've selected (the venerable 16F84A) runs between 2.5V and 6V and the outputs are the same voltage as the inputs. This presents me with two initial problems to solve:
1.) My bike runs on 12V and so I can't power the microcontroller directly from the bike without some modifications.
2.) As the outputs of the PIC are going to be less than 6V, I can't run anything directly from the outputs of the microcontroller.
Fortunately, both of these "problems" are so common within electronics, it's not even funny. Enter solution to problem #1:
This is a diagram I've made of a solid state voltage regulator. The 7805 voltage regulator is happy to accept up to 30V and will step it down to a smooth and steady 5V. The downside is that the 7805 kicks out a fair amount of heat and will definitely need a heat sink when I get it all together.
So what about problem #2? This one turns out to be pretty simple as well. Instead of triggering the 12V directly from the microcontroller, the PIC can switch a 5V relay. The relay then operates as an electronic switch that can handle much higher voltages and currents:
OK... so there's part of the problem moved over into the solution pile. Or at least, so I thought. As it turns out, the high voltage that's released by the coil isn't unidirectional. That is, when the coil fires, not all of the power goes through the HT lead and to the plug. It turns out a significant portion of this returns through the points and condensers. Most of you probably know about this already if for no other reason than you've seen the points sparking during operation. So the next step in being able to electronically fire the coils is to ensure that backlash of high voltage isn't going to come back through and cook all the silicon. I readily admit that this is the circuit I'm still trying to get my head around. I found a diagram online and a friend said it should do the trick. I'm going to take it on faith that this will fit my bill. If it doesn't, I'll go back to the drawing board and try something else:
The TIP162 in the diagram above needs a heat sink as well. The backlash coming from the coils generates a lot of heat when you have that much voltage to dump.
So where are we now? We have a voltage regulator that gets a steady 5V to our microcontroller which, in turn, provides a 5V output to each of our relays. Each relay triggers each coil, but first passes through an electronic condenser. Sounds good.
One very important part we're missing though: We need an input signal to the 16F84A to let it know when to trigger each coil. As it turns out, timing something electronically is also a fairly common task. I'm making use of something called a Hall Effect Sensor. What this does is it transmits a small digital voltage spike every time a magnet comes within proximity. By installing a magnet at TDC on the end of my crank shaft and then placing the HES in a position so that the magnet will pass by it on every rotation, I need only count the number of clock cycles on the PIC to determine the RPM.
Once I know the RPM, calculating out time and degrees will be relatively simple. For instance... I know my PIC is operating at 4Mhz because that's not only it's default speed, but I plan to attach a quartz crystal to its oscillator pins to ensure it's fairly accurate (within +- 20 microseconds of error for every full second that passes). As I mentioned earlier, the PIC is a pretty simple device and so it carries out commands at a rate of one command per cycle. Or, if you prefer, four million instructions per second. As an example, lets say that I'm currently counting 16,000 processor cycles between the pulses I'm receiving from the HES. First step, divide 4,000,000 by 16,000 to get my rotations per second. This leaves me with 250. Multiply by 60 to convert seconds to minutes and we see the engine is turning at 15,000 RPM.
For argument's sake, let's say I want my engine running at 38° of advance at this RPM and so I now need to calculate how many processor cycles passes in 322° (360° is a full circle, minus 38° of advance I want for the next firing of the coil). Well, we already know that 360° of rotation is taking 16,000 cycles, so simple division tells us that a single degree of rotation is taking about 44.5 cycles. Multiply this by 322° and we know the next time to trigger the coil is is 14,311 processor cycles. So after counting to 14,311 our microcontroller will open the relay for the left coil. I'm running 180° firing and so count another 8,000 cycles and then open the relay for the right coil. Recalculate RPMs the next time the HES triggers and then do it all again.
But I digress... that's more of the software side I have yet to implement. All of this math, however, did get my mind wandering off to other uses for the PIC. I've come up with a couple of other features I plan to include.
First up, I'm going to implement an electronic redline. At 12,000 RPM (and above) the PIC will no longer trigger the coils to fire. No spark means no power and so the engine can't/won't exceed 12,000 RPM.
Next, I've been wanting to run an external oil pump and so I plan to install one and control it from the PIC. At 6,000 RPM one of the outputs from the microcontroller will signal another 5V relay to switch on the oil pump. At less than 6,000 it will switch off again. I may adjust this limit later, but I only want the pump on in the higher RPM bands so that it's not sucking too much power. The charging system isn't great on my old CJ and the oil pump is expected to draw about 40 Watts, a full third of what my alternator is capable of putting out. Gotta keep those RPMs high for full power output.
Third, will be shifting lights. At 9,000 RPM, I'll trigger an LED to light up to indicate that it's time to shift when I'm going balls to the wall.
The best part (at least I think so) is that this device should work with any two or four cylinder motorcycle as the ignition curve is fully programmable.
Thoughts? Suggestions? Concerns?
This is a first for me and I'm hoping to get some idea as to your guys opinions. Any technical additions would be extremely welcome.