View previous topic :: View next topic |
Author |
Message |
PRamod
Joined: 04 Jan 2011 Posts: 2
|
sine to square conversion using pic16f877 adc program |
Posted: Tue Jan 04, 2011 11:05 pm |
|
|
I am doing a project where I need to find the frequency of a waveform generated by a spark plug. I am using pic 16f877a & ccs compiler for programming. As a beginning I am trying to assume that the waveform to be measured is a sine. And convert it into an adc and make it square, & find the frequency. I am beginner in this field and am not able to program it. |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Tue Jan 04, 2011 11:15 pm |
|
|
Are you trying to find the repetition rate of the spark plug (engine RPM related) or are you trying find the frequency of the typical ringing that happens when a plug fires ? Typically (it has been a while since I looked at one on a scope), there is a very short pulse when the plug fires followed by some ringing. Over the years they have modified the plug wires (resistance etc) to help cut down on the ringing, but a spark plug firing is definitely not a sine wave - especially with the newer electronic ignition systems.
Found a couple of typical waveforms to look at you might find helpful ...
http://diagnosticnews.com/tech/anatomy-of-a-waveform/
http://www.omitec.com/en/support/waveforms/
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
|
mbradley
Joined: 11 Jul 2009 Posts: 118 Location: California, USA
|
|
Posted: Wed Jan 05, 2011 12:01 am |
|
|
Be very carefull, as you know, high voltage, lots of pain.
As stated above, what did you want to know? if the former, the repetition rate that it fires, I would suggest tapping of the trigger, or in this case, the primary wire.
Basicaly it will be ground, or 12v (depending) and change states when triggered.
If you have access to a scope, look at the primary wire first, see what the signal looks like, this gives you a starting point of what you need to read into the pic. you might not even need the adc portion. _________________ Michael Bradley
www.mculabs.com
Open Drivers and Projects |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Wed Jan 05, 2011 12:41 pm |
|
|
Yeah, I should have mentioned that part - open circuit voltage on a plug wire (disconnected from the plug) can be in the neighborhood of 70,000 volts. You will NOT enjoy the "stimulation" you get. Looking at the typical waveform, the initial spike is the voltage it takes to ionize the spark gap. The following "step" is the discharge through the plug once it is ionized. Do be careful with spark plugs - they bite
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19554
|
|
Posted: Wed Jan 05, 2011 12:54 pm |
|
|
If you look at the trigger used for things like old tachometers, they just used a single turn of wire _round_ the plug lead. No connection to the plug lead itself, and even then, had quite careful input protection to the circuitry. This give a pulse when the current (as the spark forms) flows. Easier/nicer....
Best Wishes |
|
|
mbradley
Joined: 11 Jul 2009 Posts: 118 Location: California, USA
|
|
Posted: Wed Jan 05, 2011 1:06 pm |
|
|
Not to go off topic, but when I was a kid, I was using an ignition coil to do a home made tesla coil, and I used a cap/diode multiplier, and when testing, it was off, I picked up a cap, that was tiny, the size of a dime, .01uF but 20,000volt, I went to spread the leads, and zap, sat my but down instantly! _________________ Michael Bradley
www.mculabs.com
Open Drivers and Projects |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Wed Jan 05, 2011 1:41 pm |
|
|
Hey - you want to go back a ways, when I was in elementary school (back in the '50s), one of the books in the library was "the boys first book of electricity" or some title like that (there were 3 in the series). I remember seeing the project in the first one though where they used an old Model T ignition coil (with the vibrating points for continuous spark) to power a do-it-yourself X-Ray machine made with an old radio tube wrapped with foil and connected to the spark generator. How to X-ray your hand and all sorts of clever things using film. Eeeeeeeeek !!!!!
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
|
mbradley
Joined: 11 Jul 2009 Posts: 118 Location: California, USA
|
|
Posted: Wed Jan 05, 2011 2:10 pm |
|
|
LOL!!!!! Too funy you mention this, I recall seing stuff like that in the early 70's (50's/60's books)
Just last week, I was trying to find info on those very things! I was explaining to my assistant, that if you put a spark gap in a vacume, tada, x-rays! _________________ Michael Bradley
www.mculabs.com
Open Drivers and Projects |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1911
|
|
Posted: Wed Jan 05, 2011 2:15 pm |
|
|
A couple of the "old timers" at my last job actually remembered the shoe x-ray fluoroscopes in department stores. It was a special unit off in the corner of the shoe department. You stuck your foot in and on the screen you could see how well your shoe fit.
I had never heard of these things before. Lucky there wasn't a similar one for men to see how well their underwear fit. |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Wed Jan 05, 2011 4:00 pm |
|
|
Check out these links - talk about glow in the dark !!
http://www.contrapositivediary.com/?p=463
http://www.duntemann.com/march2008.htm
Maybe that is why the older engineers seem smarter - we eliminated the foolish ones with 400+ volts on everything we worked with. This 5 (or 3.3) volt logic these days doesn't "bite". You only had to get hit once with the 400+ volts inside a TV chassis for the plates to know that was probably not a good thing to do
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
|
Kenny
Joined: 07 Sep 2003 Posts: 173 Location: Australia
|
|
Posted: Wed Jan 05, 2011 4:15 pm |
|
|
LOL.
I remember those shoe x-ray machines - it was fun to watch as you wiggled your toes! Would have been in the late 1940's or early 1950s.
Those timing lights that are used to set engine timing have a inductive pickup clamp that goes around an ignition lead. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Wed Jan 05, 2011 5:37 pm |
|
|
I really enjoy this O.T. talk!
Referring to the original question, it's not compeletely clear what you mean with the "waveform generated by a spark plug". The oscillation usually seen in the ignition coil voltage at the spark discharge end, see the link provided by gpsmikey, is mainly caused by coil self resonance, I think. The respective frequency in the kHz range is already at the edge of PIC16 ADC sampling speed capabilities. |
|
|
PRamod
Joined: 04 Jan 2011 Posts: 2
|
sparkplug,dwell and sensor |
Posted: Thu Jan 06, 2011 7:19 am |
|
|
Actually we have 3 objectives
1.We want to monitor the frequency of the signal which controls the timing of spark plug. Do anyone know from where to tap this anonymous signal and shape and V,I ranges? As it need not be sine wave we think about an external comparator(op-amp) to generate square.
2. And then we have to find the dwell angle. Is it vary in current generation bikes (we have to do the work in BIKES). And whether the pulse width of previously generated square wave will give the dwell angle?
3.We need a sensor to monitor the exhaust CO content from vehicle. We find many of them in web. But could not find a particular one which may suit.
If anyone know about sensors pls reply.
Thank very much @gpsmikey,@mbradley,@FvM,@Ttelmah
plsss reply .... |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Thu Jan 06, 2011 9:36 am |
|
|
Quote: | And whether the pulse width of previously generated square wave will give the dwell angle? |
Basically yes. All information can be get from a single digital signal.
Quote: | we have to do the work in BIKES | Is it magneto or battery ignition? |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Thu Jan 06, 2011 9:46 am |
|
|
I presume you are looking for the timing of the spark (in degrees advance). To find that, you need to have a 0 degree reference signal. On engines with electronic spark timing, they have a magnetic pickup that senses a mark on the crankshaft at that 0 degree reference. Timing is then calculated from a number of parameters like engine RPM, load, temperature etc. Some (not sure how many) engines also have a "knock detector" (sound pickup) mounted on the block to detect detonation and allow the spark timing control logic to back off on the timing just enough to keep the engine from detonating. I'm not sure just what all parameters are used in the calculation. I do know that one of the processors I used to work with (68332) was designed just for the automotive industry for this sort of task.
As for the dwell angle, I'm not sure that is available in the spark information - you may have to be looking at the primary side of the coil, however, dwell only really applies to an older ignition system using points (dwell is the time they are closed and was used as a more accurate way to set the point gap with the engine running you could adjust the points through a little window in the side of the distributor cap). With the newer electronic systems, most of the triggers for the firing are magnetic or optical I believe and are typically not adjustable. Look up "variable reluctance pickup" - I think that is what most of them are these days, but I'm not sure on that (hey, I'm so old I still remember 6 volt electrical systems in the cars !! )
I don't have any information on CO sensors - have not played with them at all other than to have to pass the emissions test for my license :-)
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
|
|