Knock Detection with analog filters

A forum for discussing the MegaSquirt related (but non-B&G) board development, assembly, installation, and testing.

Moderators: jsmcortina, muythaibxr

a73camaro
Experienced MS/Extra'er
Posts: 231
Joined: Fri Oct 08, 2004 6:44 am
Location: Dillon, CO

Knock Detection with analog filters

Post by a73camaro »

There is another post that has been going on for a couple of years now and it has moved into the direction of digital filters. That is getting beyond my DIY ability. So I would like to revisit knock detection via analog circuitry.

This is going on a Subaru with a 2.5L engine (overbored to 100.00 mm). The calculated frequency that the engine will knock at is 5.7 kHz. To prove this I used the laptop to capture the signal leaving the knock detector microphone.

Here is the spectrum for my engine with no knock
Image

I added some more timing to induce a brief series of knocks. Here is the spectrum for my engine with detonation. There is activity at the predicted frequency as well as higher frequencies.
Image

My idea is to use more filtering - a Chebyshev 4-pole bandpass filter ranging from 5.0 to 6.4 kHz. There is a program from TI that will derive the components for the filter. Here is the filter - I will be using single ended op amps.
Image

and here is the frequency response of that filter
Image

I integrated this filter to the circuit from this topic http://www.msextra.com/forums/viewtopic ... 67&t=28192
Image

I applied the filter to my spectrum analyzer program to see what filtering would to the signal, this is no knock
Image

And here is knock
Image


So with analog filtering I will be able to determine a knock and with a steeper filter there is no need for variable sensitivity that is RPM dependent.

* I added my filter to dfabro circuit
MSII v3.0, Extra 3.0.3s
a73camaro
Experienced MS/Extra'er
Posts: 231
Joined: Fri Oct 08, 2004 6:44 am
Location: Dillon, CO

Re: Knock Detection with analog filters

Post by a73camaro »

Last edited by a73camaro on Mon Jun 28, 2010 6:28 pm, edited 2 times in total.
MSII v3.0, Extra 3.0.3s
HOODEY
Helpful MS/Extra'er
Posts: 115
Joined: Sat Feb 21, 2009 5:18 pm

Re: Knock Detection with analog filters

Post by HOODEY »

Good to hear someone is looking at an audio solution. I have done the same using a biquad band pass filter.Its a pitty I can't remember
any (fft) from my dsp classes back in the day.
Poolside
Helpful MS/Extra'er
Posts: 85
Joined: Sun Aug 22, 2004 6:01 pm
Location: Long Beach CA

Re: Knock Detection with analog filters

Post by Poolside »

a73camaro wrote:I applied the filter to my spectrum analyzer program to see what filtering would to the signal, this is no knock

Image
Nice!

I have a question about the 'no knock' signal above. What's the source of the increasing amplitude over time?

- Jim

.
elaw
Super MS/Extra'er
Posts: 2926
Joined: Fri Oct 16, 2009 6:20 am
Location: Wilmington, MA

Re: Knock Detection with analog filters

Post by elaw »

If the spectrogram corresponds to the .wav files he linked above, it's probably due to increasing engine speed.
Eric Law
1990 Audi 80 quattro with AAN turbo engine: happily running on MS3+MS3X
2012 Audi A4 quattro, desperately in need of tweaking

Be alert! America needs more lerts.
a73camaro
Experienced MS/Extra'er
Posts: 231
Joined: Fri Oct 08, 2004 6:44 am
Location: Dillon, CO

Re: Knock Detection with analog filters

Post by a73camaro »

That is correct about the rising amplitude. I ran the engine to redline to see what it would look like. If you look at the spectrogram you will see lines that are pointing uphill until 11.9 seconds then they start to point downhill.

Also the .wav files correspond to the spectrogram plots.
MSII v3.0, Extra 3.0.3s
Poolside
Helpful MS/Extra'er
Posts: 85
Joined: Sun Aug 22, 2004 6:01 pm
Location: Long Beach CA

Re: Knock Detection with analog filters

Post by Poolside »

Ahh. I didn't see any file extension so I didn't click the links.

What I was looking on the graph is a possible difficulty in differentiating combustion noise from knock noise at high RPM. Maybe some RPM based sensitivity adjustment?
a73camaro
Experienced MS/Extra'er
Posts: 231
Joined: Fri Oct 08, 2004 6:44 am
Location: Dillon, CO

Re: Knock Detection with analog filters

Post by a73camaro »

If the noise floor is at the same level as an engine knock, then there is no point to look for it. MS has an RPM window to look for a knock signal.
MSII v3.0, Extra 3.0.3s
Poolside
Helpful MS/Extra'er
Posts: 85
Joined: Sun Aug 22, 2004 6:01 pm
Location: Long Beach CA

Re: Knock Detection with analog filters

Post by Poolside »

Yes that's true, if like you say, the noise floor is at the same level as an engine knock. But I was getting at something else.

I was thinking that it's reasonable to test if the engine knock noise level is above the total noise floor, even at high RPM. For if that's the case, then an RPM-based sensitivity adjustment might solve that. And allow for a reliable knock indicator at all RPMs and load levels.

If a simple RPM sensitivity doesn't work, then the rate of change of the 6.4kHz level might serve as the indicator. There are few other ways too.
a73camaro
Experienced MS/Extra'er
Posts: 231
Joined: Fri Oct 08, 2004 6:44 am
Location: Dillon, CO

Re: Knock Detection with analog filters

Post by a73camaro »

Another thought is to use a narrow bandpass filter. Simpler circuit, repeat of components, steep attenuation outside the frequency of interest. Since I know where my frequencies are, I can look at just a small section. Any thoughts on this?

Here is a two pole narrow bandpass filter with a Q of 5.
Image

*Replace the earth symbol with 2.5 V
MSII v3.0, Extra 3.0.3s
Poolside
Helpful MS/Extra'er
Posts: 85
Joined: Sun Aug 22, 2004 6:01 pm
Location: Long Beach CA

Re: Knock Detection with analog filters

Post by Poolside »

Well, you know a higher Q is more selective. The question is, how much of the knock noise is right at 5.7kHz?

I understand the center frequency is based on cylinder diameter, but when the piston is near the top of it's stroke the combustion chamber isn't a simple cylinder primitive. That ought to affect the center frequency, or harmonics, to some extent.

I don't know whether a lower or higher Q will work better, but it looks like you've got the tools to find out. Which SA program do you have there?

Moving to a higher frequency would be a worthwhile experiment. Perhaps knock has some higher frequency content that isn't present at simple high RPM operation. Or maybe a multiple bandpass filter with a summed result.

I took a look at the TI filter builder, pretty neat. Is the SA program open source or shareware?

- Jim
HOODEY
Helpful MS/Extra'er
Posts: 115
Joined: Sat Feb 21, 2009 5:18 pm

Re: Knock Detection with analog filters

Post by HOODEY »

If you are lookig for a high Q then BIQuad is the way to go.

P.s I use you knock recordings on my device and I was able to pic up knock quite easily.
elaw
Super MS/Extra'er
Posts: 2926
Joined: Fri Oct 16, 2009 6:20 am
Location: Wilmington, MA

Re: Knock Detection with analog filters

Post by elaw »

I'm curious... have any of you guys ever thought of doing a relative-signal-strength approach? As in separately measuring in-band signal amplitude and out-of-band (or overall) signal amplitude, and then using the difference between the two to decide whether knock is occuring?

Seems like that might be a good way to separate the knock signal from the noise, and thus avoid RPM-dependent issues.
Eric Law
1990 Audi 80 quattro with AAN turbo engine: happily running on MS3+MS3X
2012 Audi A4 quattro, desperately in need of tweaking

Be alert! America needs more lerts.
420aRaf
Helpful MS/Extra'er
Posts: 59
Joined: Thu Feb 19, 2009 4:33 pm
Location: Staunton, VA

Re: Knock Detection with analog filters

Post by 420aRaf »

Image

My main concern was the amplitude of the wave as well. How is the amplitude and false triggering noise being accounted for?
-Rafiel
Poolside
Helpful MS/Extra'er
Posts: 85
Joined: Sun Aug 22, 2004 6:01 pm
Location: Long Beach CA

Re: Knock Detection with analog filters

Post by Poolside »

420aRaf wrote:My main concern was the amplitude of the wave as well. How is the amplitude and false triggering noise being accounted for?
Do you have a recording of high RPM knock under load? I mean, it's obvious that knock is the majority noise component at low RPM. By the way, was that recording at high load or low load? It's reasonable to imagine the same might be true at high RPM. Do you have any way to create and record high load, high RPM knock?

Which SA program are you using?

.
420aRaf
Helpful MS/Extra'er
Posts: 59
Joined: Thu Feb 19, 2009 4:33 pm
Location: Staunton, VA

Re: Knock Detection with analog filters

Post by 420aRaf »

Logged? Not yet. Testing on my N/A I-4 is different from my turbocharged I-4 as the strength of the signal will increase with load and it becomes harder to determine what knock is, unless your accounting for amplitude and windowing. The picture was an example under high rpm, not sure what load though.
Last edited by 420aRaf on Thu May 27, 2010 6:52 pm, edited 1 time in total.
-Rafiel
Poolside
Helpful MS/Extra'er
Posts: 85
Joined: Sun Aug 22, 2004 6:01 pm
Location: Long Beach CA

Re: Knock Detection with analog filters

Post by Poolside »

What SA program are you using?
a73camaro
Experienced MS/Extra'er
Posts: 231
Joined: Fri Oct 08, 2004 6:44 am
Location: Dillon, CO

Re: Knock Detection with analog filters

Post by a73camaro »

Here is a link for downloading the SA that I am using. http://www.electronics-lab.com/download ... index.html

Some more information after poking at my recorded files. These screen shots are generated using a different program.

Low RPMs no knock
Image

Max RPMs no knock
Image

Small knock
Image

Big knock
Image

So if I am looking for engine knock at low RPMs, it should be pretty easy to find it at 5900 Hz. At max RPMs it may tricky to pick out a light knock. It appears that a narrow bandpass filter should fit the bill. Anything wrong with using a narrow bandpass filter in this application?
MSII v3.0, Extra 3.0.3s
Big Thurs
Helpful MS/Extra'er
Posts: 62
Joined: Thu Jul 15, 2004 11:17 am
Location: Eatonton, GA

Re: Knock Detection with analog filters

Post by Big Thurs »

Excellent work. I am no expert with designing opamp circuits, an I have great difficulty with filter design.
I'm really glad to seethat someone is still working on knock detection with cheap analog circuits.
91 MR2 Turbo on V3 MSNE-e HR11d
a73camaro
Experienced MS/Extra'er
Posts: 231
Joined: Fri Oct 08, 2004 6:44 am
Location: Dillon, CO

Re: Knock Detection with analog filters

Post by a73camaro »

So I got the parts from Digikey. I will be using the second design, the notch filter. I'll be posting my results as soon as I get some free time.
MSII v3.0, Extra 3.0.3s
Post Reply