Newbie making an ignition timer


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    Join Date
    Jul 2006
    Posts
    36

    Default 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

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Maybe I am missing something, but when you mount the sensor could that be made adjustable?

    2.5 volt input will need to use comparator on chip.

    Why not just use a LM324? 4 channels. One could be used as a comparator out put to another channel via RC network for the delay. Out put from here to a IGBT for speed and power to the coil.

    Get all of this working and then tie into a PIC for auto retard/advance control for different loads on the engine.

    ???
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jun 2005
    Location
    West Australia
    Posts
    116


    Did you find this post helpful? Yes | No

    Thumbs up 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

  4. #4
    Join Date
    Jul 2006
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    The engine that I am currently working on for this project is a simple, one cylinder Briggs and Stratton based generator. SO, it is a constant RPM motor at 3600RPM. Therefore, I don't think I need anything really in the way of lookup tables, etc. It is statically timed now, so that's all I need for electronic control. I just want to be able to adjust the delay manually. I'll handle idle control mechanically.

    The reason for using software instead of physically moving the position of the sensor is really just one of flexibility. When I get it working on this, then it will work on ANY motor with a static timing by simply mounting the Hall effect sensor on the leading edge of the magneto.

    As for Hydrogen: Compared to fossil fuels it's heaven BECAUSE it burns so fast and in such a wide range of ratios (07%-74% Air to fuel.) In an internal combustion engine, that fact makes it more efficient because it doesn't need time to "get going" like petrol. It should be ignited at almost top dead center and will have done it's work and completed combustion before the valve opens. Additionally, and this is huge, we don't need to throttle the AIR intake. It always runs "lean," wide open air intake! We simply meter the amount of fuel. That fact itself has great consequences on efficiency. Furthermore, since there is no time for heat to transfer to the surrounding cylinder head, etc BEFORE TDC, the engine runs very cool, for zero Oxides of Nitrogen emmissions - the exhaust is cleaner than the air that went in to it (the stuff we breathe.)

    I'm sure I could make a solid state ignition circuit to replace the magneto, but I would like to do it with software to reduce hassles with positioning the sensor.

    As you can see, I Love talking about this stuff. Don't EVEN get me started about what Hydrogen can do mixed WITH fossil fuels. Gas, diesel, veggie oil, propane, turpines, all run in a standard engine with Hydrogen injection. It's true.

  5. #5
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    967


    Did you find this post helpful? Yes | No

    Default

    I am glad to hear experts talk. I do not have much knowledge about engines except how the IC engine works; but 2 stroke/4 stroke is going a little deep for me. However, I like to hear you folks talk about alternate fuels and TDC and BDC concepts. I had to work on a CNG timing kit a while back, though this was totally in hardware; no microcontroller.

    From your concept Chris, I think Bill has suggested right. You need to use the PICs interrupt capability to get it to respond to the magneto pulses reliably. If you sense in a loop (Polling) you may miss pulses now and then and lead to major knocks in the engine (perhaps, since you are talking H2)

    As for catching the 2.5V on signal, it will be a bit out of spec for the PIC if it drifts up / down. I suggest you to level shift the signal if you can before giving it to the PIC.

    Off hand I do not have any snippets / links to offer, but I know every bit / byte matters.

    Cheers
    Jerson

  6. #6
    Join Date
    Jul 2006
    Posts
    36


    Did you find this post helpful? Yes | No

    Default My first code

    Thanks for the encouragement. Here's my first attempt at making something other than just thinking about it. I realize there is a lot wrong with this. Just please be gentle with me. I know I don't have a clue what I'm doing, but I want to try. Assume a 16f877 for now.
    (And how do I put it in a scrollable window like I see in other posts?)

    DEFINE ADC_BITS 8 'Number of bits in ADCIN result
    DEFINE ADC_CLOCK 3 'ADC clock source (rc = 3) ***WHAT IS THIS?
    Define CLOCK_FREQUENCY = 20
    DEFINE ADC_SAMPLEUS 50 'ADC sampling time in microseconds
    DEFINE OSC 20 'Oscillator speed in MHz

    TRISA = %11111111 ' Set PORTA to all input
    TRISB = %00000000 'Set Port B to all outputs
    ADCON1 = 2 ' PORTA is analog '****Is this necessary?

    sensor var porta.0
    coil var portb.0
    delay var byte 'Set variable "delay" as one byte

    ON INTERRUPT GOTO spark: ' When hall effect is sensed, go make a spark
    INTCON = %10010000 ' Enable RB0 interrupt ***I don't know what value goes here to make it listen to porta.0..???**

    loop:
    ADCIN 0, delay ' Read channel 0 to the variable "delay"
    ADCON ?? 'Convert it to decimal???
    delay = delay * 2 'A multiplier to make the ADC input result in
    'something meaningful in microseconds(2-510us)
    coil=0
    goto loop:

    spark:
    DISABLE ' Disable interrupts in handler

    pauseus delay ' This delay retards the spark
    while dwell=1 coil=1 ' This turns on current to the coil while the
    ' hall effect is sensed
    RESUME ' Return to main program
    ENABLE ' Enable interrupts after handler
    Goto loop: 'I don't know why I put this here - not needed right?
    end


    I'm embarrased to even post this considering the expertise here, but I want to learn and most importantly, I want it to work.
    Thanks,

  7. #7
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by wjsmarine View Post
    I have to ask - how are you making the hydrogen?
    The next gas station is at Cape Canaveral in Florida!

    * * *

    Hi,

    How do you produce hydrogen?
    Where do you get hydrocarbon fossil fuels to produce hydrogen?
    Or where do you get the energy to produce hydrogen? (Electrolysis).
    Are these methods cost effective and sustainable for the environment?

    Although hydrogen has a higher specific energy, the volumetric energetic
    storage is still roughly five times lower than petrol, even when liquified.

    Best regards,

    Luciano
    Last edited by Luciano; - 8th April 2007 at 10:35.

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. High Resolution Timer & Speed Calculator
    By WOZZY-2010 in forum Code Examples
    Replies: 4
    Last Post: - 7th February 2010, 16:45
  3. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  4. Timer interrupt frequency
    By Samoele in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th January 2009, 23:49
  5. timer interupt help 16f73
    By EDWARD in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd July 2005, 08:41

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts