Newbie making an ignition timer
Hello to everyone,
I am a newbie. A rather OLD newbie....but ambitious. I am working on a project of converting a 4 stroke gasoline engine to Hydrogen ( a personal project - no I'm not in school) and my task is this:
Hydrogen combusts FAST, so I need to change the current magneto ignition to one that I can adjust for a LATER (retarded) ignition spark.
The flywheel has a permanently mounted magnet and the magneto will not be able to be repositioned. SO, I want to:
1) Read an input pin to sense the edge of the magnet on flywheel rotation using an Allegro Hall Effect sensor (Output is 2.5V - will PIC see that as "on?")
2) Read a pot to control the "Delay Amount" so I can adjust and experiment.
3) Either just turn on a pin after the determined delay (to turn on current to an ignition coil,) or PWM the same (I wonder if that is necessary considering the time the magnet will be sensed at, say, 3600RPM.)
I've been scouring the examples and they are either way more complicated than I need and over my head, or too simple. Any thoughts will be appreciated.
My experience with PICs thusfar, so you get an idea of where I'm at:
I have successfully programmed a PIC and created a circuit as a PWM generator and have also made a PIC look at the state of certain pin conditions and change PWM duty cycles appropriately (opening water injectors.)
Now then, I would like to do this on a 12f683 with a 20Mhz crystal, but could do it on another configuration if necessary.
Before I try to recreate the mold, does anyone have any snippets that would get me started? Or perhaps a more proper place to search?
Thanks in advance,
Chris
Engine management information
Hi Chris,
Ambitious project for a newbie... but don't let me deter you. Sounds like you are an old "gas head" like me! I want to do something similar to you (one day) but more important PIC designs keep getting in the way i.e. work oriented or ones that make some income.
I have to ask - how are you making the hydrogen? I've entertained ideas a long time ago of doing something similar but with diesels as a supplementary fuel but the problems are many...
I'm experienced with PICs but still learning as well, my vehicles have all been modified turbo types necessitating engine management changes so I know what you are talking about and your requirements, although hydrogen is a new one for me. When you say it burns fast I gather you mean it is a lower octane - my understanding is low octane fuels are more explosive so need less time to complete the combustion process and make peak cylinder pressure so this being the case then a later or retarded spark event is correct. Sounds like you are also into water injection (something I also want to try) so you are probably also aware that the fine water mist will lift the octane rating (slow the burn) if you wish. What are you using to inject the water or are you using fine mist nozzles?
With programmable engine management it is usual (and more conveniently accessible) to mount a steel plate on the front of the engine's harmonic balance pulley. This plate has a number (one per cylinder) of equally spaced teeth and an additional tooth spaced about 10 deg's prior to number 1 cyl tooth. These rotate to a closely positioned pickup (coil and magnet) which generates a pulse as the engine/plate rotates. A double pulse is generated when the number 1 cylinder goes by and it is up to the management to sync to this and generate timing from this reference.
The engine is timed by statically setting the maximum advance you want (zero delay in your code to fire the coil) and progressively delaying it in order to retard the spark. Sneaky huh?
At the speeds you are going to be running your PIC would need to use a fast crystal (say 20Mhz) with the incoming pulses from your pickup triggering an interrupt (and deriving rpm from that) while also accessing a lookup table to determine the delay (retard). Expanding on this would be relatively easy if you wanted to make a 3D table by introducing another parameter (say boost or throttle position).
With the interrupt stuff I've only just begun using some of this myself and can recommend you do a search for Darrel Taylor's Instant Interrupts on this forum. He's a Guru on this stuff and a nice guy who will help if asked politely.
Let me know if I can help some more in my limited way and I will try. This is an interesting project and one that could be of great benefit to many, good luck!
Bill
Real time and PbP ... take care !!!
[QUOTE=ChrisHelvey;35917]
ON INTERRUPT GOTO spark: ' When hall effect is sensed, go make a spark
Hi, Chris
That single line hurts me as a "BASIC" interrupt ...
This means the program ALWAYS will complete the task ( Statement) it is currently doing ... before entering the interrupt stubb.
You Have to use Assembler interrupts if you want precise and repetitive timing ...
Now, you want to use 12F683 ... why not !!! have a look to what the CAPTURE module of the PIC can do for you ...
generate the detect interruption ... Measure the rotation period ( TMR 1 ) ... and also measure the real computing time ... for example !!!
a second 16 bits timer will be necessary ... if spark has to occur AFTER the hall effect is detected ( TMR1 cleared !!!) ... so you'll have to build it "manually" !!! 12F683 only has one ( 16F877 ... too ) !!!
Alain
The third Thermodynamics Law ....
Quote:
Originally Posted by
ChrisHelvey
OK.
And figuring gas engines are VERY wasteful,
Chris
Hi, Chris
THE one and only question ...
IS our giant waste of time an energy really necessary ???
( being here and there at the speed of light, use electric tools when not really needed, use computers to add 2 and 2 ... ( LOL !!! ) ... and so on ... )
Alain
The FOURTH law of thermodynamics
Although it was asked with humor...it's a great question.
After this, I think they'll shut us down because it's off-topic, but...
It has been suggested by many that the survival of a species or social organization will depend on its ability to most efficiently direct available energy into channels favorable to the preservation of the species.
So, this becomes about USEFUL energy transformation.
And then, in my opinion, we should be able to waste as much as we want as long as we don't trash our environment doing so.
So, is ANYTHING really necessary?
Hmmmm.....
Re: Newbie making an ignition timer
I'm curious if this project ever came to fruition. I'm currently designing an ignition system for a vintage triumph engine for Bonneville Salt Flats. I started out using an AVAGO encoder because it was small and cheap and provided a digital position via SPI. I machined a replacement for the factory "distributor" to mount the encoder. I missed something on the data sheet however. The specs said the encoder was capable of clocking the SPI at 1MHz. Plenty fast enough. However, after fiddling with it I noticed it had a sample rate limitation of 10kHz. You can clock the data out at a bit of 1MHz but you can only sample it at one reading every 100uS. Not fast enough for high RPM. At 8,000 RPM, the device only gives a reading every 4 or 5 degrees (48,000 deg/sec x 100uS = 4.8deg). I wanted to have at least 1 sample for every degree of rotation. So I tried to interpolate between readings. I kept track of 2 successive readings to get the rotational velocity ((current reading-last reading)/(100uS)). When I was within 1 delta reading of the ignition point I used the velocity to extrapolate the actual desired ignition point to fire (turn off) the coil. Nice theory anyway. I couldn't get the code fast enough to make the interpolation within the 80uS remaining after sampling the encoder. So I tried to pick an arbitrary point well enough in advance if the ignition point to give the PIC enough time for the calculations. The problem with that was interpolating the ignition point from a greater distance caused greater error. This was largely because this simple method does not take acceleration into account. I chose to do a steady state interpolation ignoring acceleration figuring that if I was within 4.8 degrees of the desired ignition point, there would be minimal error due to accelleration. However when moving the point of interpolation way in advance there is plenty of time for the rotational velocity to change significantly.
I gave up on the digitizing encoder and switched to a quadrature encoder with an index. The one I plan on using gives 2000 pulses/rev with a zero index. It should be easier to reference the index and count pulses. I'm currently machining the distributor to try it out. If anyone is interested, I can post the results later.
Ed
Re: Newbie making an ignition timer
Oh yeah, I was using a PIC16F1824 at 32 MHz.
Re: Newbie making an ignition timer
Hi enauman,
I would be curious of how you make out with this. I am trying to do something similar with gas model airplane engines. So far I have some code that works,but I think it could be better.
Re: Newbie making an ignition timer
Hi Charlie,
I have a couple of questions for you. What type of encoder are you using? Are you planning on making the advance dynamic or static? Didi you do your coding in PIC basic or assembly? Would you be willing to share your code with me? My interest is purely academic and not commercial.
Ed
Re: Newbie making an ignition timer
Hello Enauman,
No, I never finished this project and it was a simple Magneto type lawn mower engine. The necessary inputs for an engine with dynamically changing loads and speeds would be overwhelming to me AND I found that commercial engine management systems on the market have caught up to the tech and can do just about anything. More expensive, yes, but much less time investment. I am talking about MSD products and their accessories.
In any case, about your code, there was a gentleman on this list who DID successfully create a PIC based ignition system for an airplane (full sized.) It was quite impressive but WAY over my head. Do a search on my threads and I think he posted. I'll see if I can find him.
Good luck with this, I wish you well.
Chris