Knock Detection with variable sensitivity over RPM

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

Moderators: jsmcortina, muythaibxr

Locked
Trev16v
Master MS/Extra'er
Posts: 420
Joined: Tue Apr 08, 2008 1:30 pm
Location: Oxfordshire, UK

Re: Knock Detection with variable sensitivity over RPM

Post by Trev16v »

dougie2 wrote: And re. your discovered Filter error.... there isn't any.

Ralf,

dfabrio has himself mentioned that some people have had no success with the active filter, and you will see also that poliux could not get any signals through his active filter either. The reason for this is because the active filter produces far too much attentuation, because the amplifiers aren't really doing anything, and so it's working as a (very poor) passive filter. With the modification I have done, the amplifiers are now working properly and it's an active filter again.

In the original schematic, both operational amplifiers have their non-inverting (+) inputs tied directly to 0V. For this reason, the amplifiers won't really be doing anything, and this means that the AC signal is really just passing through the passive components around the amplifiers. To work properly, the amplifiers must have a virtual ground instead. These are the most basic operational amplifier principles.

You can download PSpice student version for free, and I can also send you my design files if you like. You can simulate both the original circuit, and then the modified circuit afterwards; you'll then see how the filter works properly.

To be truthful, even in the original circuit, the bandpass filter does still work (giving a broad bandpass region roughly around 6kHz), but with a LOT of attenuation (about -40dB). This is because the amplifiers aren't working as they should, and so the filter is working almost purely as a passive filter. In fact, U1B is doing absolutely nothing at all. If you were to somehow disconnect only U1B, you'll see that it makes no difference :)

So, the truth is that the original circuit will probably work okay if your knock sensor produces a large enough signal. This is why it works for you. But, for other people, such as myself and poliux, the filter is far too 'deaf' because it attenuates too much. With the correction to the circuit, both amplifiers (U1A and U1B) and working, and the filter is working as a proper *active* filter again; this means that the attenuation at 6kHz is -3dB rather than -40dB and therefore the active filter should work for everyone.

Aside from that, the 'two' errors that I introduced from the original schematic: I corrected one error after you pointed it out (misplaced output connection, which was purely a markup error); what this second error is I don't know.

The original author, various other people, and myself have identified that the active filter has a problem and does not work for some people, and I have presented here a way to solve it. I enjoy working on problems with people and totally welcome any suggestions anyone has or criticism of ideas I have put forward; indeed, you pointed out some small errors in my diagram for which I am grateful. If somebody gives a firm technical argument against what I have done then brilliant - I'll learn from it. But I would be really grateful if you would not discredit what I have done, or suggest I have spoiled the thread, just because of an unrelated schematic mark-up error that I have since corrected.

Regards

Trevor
Golf MK2 G60 Syncro with 16VG60 on MSNS-E

MSDroid :: MegaSquirt tuning on Android

Image
dfabro
MS/Extra Newbie
Posts: 15
Joined: Sat Apr 19, 2008 5:05 pm
Location: Brazil

Re: Knock Detection with variable sensitivity over RPM

Post by dfabro »

Hello, everyone
Sorry to delay, but I am involved with other projects lately.
I am happy with the knock circuit discussion, the knowledge level is great in the forum, this is the idea :D
dougie2 also talked about the things right, congratulations.
I talked to Trev, and he sent me the modified circuit, and i will mount it soon for tests.
Next week, I will report the results.
poliux
MS/Extra Newbie
Posts: 4
Joined: Fri Sep 05, 2008 2:16 am

Re: Knock Detection with variable sensitivity over RPM

Post by poliux »

Thanx for all info Trev16v, ill try to build both updated cirquits soon, yours an Ralf's :D
dougie2
MS/Extra Newbie
Posts: 10
Joined: Mon Oct 13, 2008 11:14 pm

Re: Knock Detection with variable sensitivity over RPM

Post by dougie2 »

... back from some business trips...

trev isn't totally wrong, but we need to consider what kind of input signal we have here. For sine wave input signals the schematic indeed would need a reference voltage which should be different to zero. In case of a piezo knock sensor the input signal is expected to be more like short pulses.
I would need some time evaluating the exact behaviour befor I could say "doesn't work". The tests I did on the workbench were quite okay. Even slightest tics on the sensor were reliable detected. Therefore: the draft from dfabro isn't that bad...

But at this point the effort is hardly justified, as the whole problem maybe easier could be tackled unsing a 2 Euro microprocessor. But I would need the sensor output signal of a knocking engine..... might be hard to obtain....
Trev16v
Master MS/Extra'er
Posts: 420
Joined: Tue Apr 08, 2008 1:30 pm
Location: Oxfordshire, UK

Re: Knock Detection with variable sensitivity over RPM

Post by Trev16v »

dougie2 wrote:... back from some business trips...

trev isn't totally wrong, but we need to consider what kind of input signal we have here. For sine wave input signals the schematic indeed would need a reference voltage which should be different to zero. In case of a piezo knock sensor the input signal is expected to be more like short pulses.
I would need some time evaluating the exact behaviour befor I could say "doesn't work". The tests I did on the workbench were quite okay. Even slightest tics on the sensor were reliable detected. Therefore: the draft from dfabro isn't that bad...

But at this point the effort is hardly justified, as the whole problem maybe easier could be tackled unsing a 2 Euro microprocessor. But I would need the sensor output signal of a knocking engine..... might be hard to obtain....
1:

Engine knocking manifests itself in the form of audible sines in the range 5kHz to 8kHz (typically, with specific frequency depending on bore size) that last for a very short duration. This is as explained by dfabro in his first post(s).

Therefore to reliably detect engine knock, our aim is to isolate and detect sine signals in the range 5kHz to 8kHz, and that is why we have a bandpass filter.

Simple voltage transients from the piezo sensor are not indicators of engine knock.

2:

The kind of signal being processed is completely irrelevant to the fact that U1B simply can NOT work whatsoever, and U1A is working improperly, without a virtual ground.
Golf MK2 G60 Syncro with 16VG60 on MSNS-E

MSDroid :: MegaSquirt tuning on Android

Image
Trev16v
Master MS/Extra'er
Posts: 420
Joined: Tue Apr 08, 2008 1:30 pm
Location: Oxfordshire, UK

Re: Knock Detection with variable sensitivity over RPM

Post by Trev16v »

Over the weekend I managed to make a large number of audio recordings of engine knock, using a little three-transistor amplifier that I put together. It amplifies the knock sensor signal and allows the audio to be recorded via the laptop microphone input and also monitored via headphones when driving.

The car in use was my friend's VW Polo with a 1.4L 16V engine. This car already has its own knock sensor, so the ECU will always try to retard timing and prevent knock; and the engine is in very good state of tune. But despite this, it was still very easy to make this engine knock, by attempting to drive slowly up a hill in 5th gear or pull away from total standstill in a high gear. Fortunately he didn't mind abusing his Polo for me, as it was for a good educational cause... :D

We performed Fast Fourier Transform analysis on the recordings and we found that the knocking occurs at a very narrow frequency. On one particular sample, the knock happens at a peak of 6.4kHz. Overall, on this 16V 1.4 engine, the knocking manifested itself at sines of between 6.3kHz and 7.3kHz, depending upon the engine revolutions and temperature.

The sines assocated with engine knock tend to occur only around, say, 5 to 10dB above the 'noise floor' of the engine and hence the design and correct operation of the bandpass filter very is important.

I think it would be an advantage to have a bandpass filter of much, much higher Q, because the filter in the present design uses a separate LPF and HPF which results in a very broad bandbass.

I'll work on a design for a very high Q BPF for the 6 to 7kHz range. I have a number of dsPIC projects on the bench so I do a DSP-based FIR filter also.

If anyone would like our .WAV files to have a listen to what the knock sounds like, or would like my design for the knock sensor headphone / laptop amplifier, please send me a PM.

Trev
Golf MK2 G60 Syncro with 16VG60 on MSNS-E

MSDroid :: MegaSquirt tuning on Android

Image
510rob
Experienced MS/Extra'er
Posts: 159
Joined: Wed Jan 05, 2005 2:24 am
Location: Vancouver
Contact:

Re: Knock Detection with variable sensitivity over RPM

Post by 510rob »

if you make the filter too narrow with too high Q, you'll dumb down the transient response. I don't know how fast the knock system really has to react to knock in the practical world, but if the filtering is too aggressive, the pulse response time might be too sluggish, defeating the purpose of the knock detection circuit in the first place.
Trev16v
Master MS/Extra'er
Posts: 420
Joined: Tue Apr 08, 2008 1:30 pm
Location: Oxfordshire, UK

Re: Knock Detection with variable sensitivity over RPM

Post by Trev16v »

510rob wrote:if you make the filter too narrow with too high Q, you'll dumb down the transient response. I don't know how fast the knock system really has to react to knock in the practical world, but if the filtering is too aggressive, the pulse response time might be too sluggish, defeating the purpose of the knock detection circuit in the first place.
Very good point and thanks for raising this.

Just to get an idea as to how long a 'ping' tends to last for a single spark event, and over how many spark events it lasts it total, I can quote the following figures from one particular 'ping' we captured.

1. The 6.5 kHz 'burst' occurred, at each spark event, for very approximately 20ms (give or take).

2. Three such 'pings' occurred before, I presume, the ECU stepped in and prevented it any further. The bursts occurred (i.e. spark events) 36ms apart (you can tell the RPM from this! :-) ).

So when you look in the audio recording, it's like a 20ms 6.5kHz tone burst, 16ms silence, 20ms burst, 16ms silence, etc.

I realise this is just one particular example from just one engine, but hopefully it gives us a useful idea.

510rob, given the above, I'd appreciate your further thoughts on this. I would assume - but I'll be sure to model it and check for sure - that the sort of transient response penalty is going to be something in the order of hundreds of ns with a high-Q BPF, so hopefully it won't be an issue.
Golf MK2 G60 Syncro with 16VG60 on MSNS-E

MSDroid :: MegaSquirt tuning on Android

Image
dougie2
MS/Extra Newbie
Posts: 10
Joined: Mon Oct 13, 2008 11:14 pm

Re: Knock Detection with variable sensitivity over RPM

Post by dougie2 »

...I believe the transient signal is the one which triggers the original circuit, but I guess by analyzing both the transient and the 6KHz Sigal would be the right to evaluate. The filter needs to be either broadband to capture different engine types with different resonant frequencies, or self adapting to the engine noise. Maybe even both.

I was thinking of a circuit which adapts automatically to the noise and therefore detects knocking reliably, rather than having a difficult to adjust RPM2DC Signal.

Could you send the WAV File to my mailbox, that I can evaluate the magnitude in signal difference between noise and signal? If the differece is clear enough I could stick to an analog type of schema...
Trev16v
Master MS/Extra'er
Posts: 420
Joined: Tue Apr 08, 2008 1:30 pm
Location: Oxfordshire, UK

Re: Knock Detection with variable sensitivity over RPM

Post by Trev16v »

dougie2 wrote:...I believe the transient signal is the one which triggers the original circuit, but I guess by analyzing both the transient and the 6KHz Sigal would be the right to evaluate. The filter needs to be either broadband to capture different engine types with different resonant frequencies, or self adapting to the engine noise. Maybe even both.

I was thinking of a circuit which adapts automatically to the noise and therefore detects knocking reliably, rather than having a difficult to adjust RPM2DC Signal.

Could you send the WAV File to my mailbox, that I can evaluate the magnitude in signal difference between noise and signal? If the differece is clear enough I could stick to an analog type of schema...
I'm a little confused about the concept of having 'the 6kHz signal' and 'a transient component'; could you clarify what you mean by this?

On your other point, I totally agree: From studying the .WAV recordings, it became apparent that trying to do this with a preset RPM-to-V 'ramp' could be a total nightmare to ever get completely right; and instead it could possibly be better replaced with a simple circuit that just provides an average of the noise level.

In actual fact, the magnitude of the knock does not really seem to be proportional to RPM. :(

So for this reason I am thinking that it may be better to simply have very high-Q filter that is tuned to the knock frequency for the specific engine, and then put a rectifier and integrator circuit on the output of that filter. In other words, a very selective tone detector. Then, we compare the output of this integrator with the moving average of noise (or a fixed voltage; whichever works best). Given that engine 'knock' manifests itself as a 'burst' of tone that lasts for many milliseconds, I believe this could be another approach.

I've had a few requests for the .WAV samples - I'll email these later tonight once I have had a little bit of time to chop out all of the interesting bits. (The total .WAV recording is a little too large to mail! :) )

Trev
Golf MK2 G60 Syncro with 16VG60 on MSNS-E

MSDroid :: MegaSquirt tuning on Android

Image
Trev16v
Master MS/Extra'er
Posts: 420
Joined: Tue Apr 08, 2008 1:30 pm
Location: Oxfordshire, UK

Re: Knock Detection with variable sensitivity over RPM

Post by Trev16v »

Right I'll need a day or two to get the .WAV files out to those who requested them as I'm on a slow connection at the moment. But I promise I'll get them out as soon as I can.

I have recently been in contact with user 'shauer' (Steve) and we had a discussion regarding PSPICE and various BPF tologies. Steve sent to me his PSPICE simulation for an Akerberg Mossberg type of bandpass filter which uses three operational amplifiers, and it is able to produce a very nice, narrow (high Q) filter. Really impressive.

What I then did was to grab a small section of my knock recordings and I used a utility I found on the web to convert this to a .CSV file. I got the utility from here: http://www.eng.yale.edu/ee-labs/morse/a ... ptions.htm.

I then used the .CSV file to read into the VPWL_FILE type voltage source object, and used this as the signal source in PSPICE.

I then performed transient analysis over a duration of one second (roughly the length of the .WAV snippet I used) and it was quite fascinating how the output of the filter was simulated, in the time domain, in response to this real recording.

So basically PSPICE is a really cool way to evaluate these various filter designs, using samples of real audio. I've never really used PSPICE very much before, and I'm impressed by how powerful this piece of free software is.

Trev
Golf MK2 G60 Syncro with 16VG60 on MSNS-E

MSDroid :: MegaSquirt tuning on Android

Image
dougie2
MS/Extra Newbie
Posts: 10
Joined: Mon Oct 13, 2008 11:14 pm

Re: Knock Detection with variable sensitivity over RPM

Post by dougie2 »

...any news about the WAV File? Maybe it's easier zipping it and uploading it to a suitable web space...? As long I haven't got any proper signal I can work on I can't continue improving the design...
dougie2
MS/Extra Newbie
Posts: 10
Joined: Mon Oct 13, 2008 11:14 pm

Re: Knock Detection with variable sensitivity over RPM

Post by dougie2 »

...well, this is exactly what I expected to happen... nothing! :roll:

We'll record our own knock sensor signal around christmas latest and post the files here and we'll directly work on an A-Series Engine. In between we also received an industry quality Knock Sensor Amplifier/Filter/Analyzer for getting most reliable results. Let's see what we can obtain from this.

BR
Ralf
Rstmania
Helpful MS/Extra'er
Posts: 39
Joined: Sun Jul 06, 2008 3:25 pm

Re: Knock Detection with variable sensitivity over RPM

Post by Rstmania »

I need the list of components by the order on the PCB? R1............20 ? U1,2,3? Q1,2,3,4? D1...4? C1....12? I cant read from the circuit diagrams.. Please help...

Gurkan
242ATL
Experienced MS/Extra'er
Posts: 191
Joined: Thu Feb 16, 2006 4:21 pm
Location: Central New Jersey

Re: Knock Detection with variable sensitivity over RPM

Post by 242ATL »

Awesome discussion guys.
KaPower
Master MS/Extra'er
Posts: 501
Joined: Wed Dec 22, 2004 9:43 pm
Location: Bonney Lake, Wa

Re: Knock Detection with variable sensitivity over RPM

Post by KaPower »

Hey guy's, lets keep this project rolling! Knock feedback is something MS is severely lacking.
Rstmania
Helpful MS/Extra'er
Posts: 39
Joined: Sun Jul 06, 2008 3:25 pm

Re: Knock Detection with variable sensitivity over RPM

Post by Rstmania »

I am thinking to locate knock sensor out of MS box. Can I use IAC outs for JS3 and JS10?
wes kiser
Super MS/Extra'er
Posts: 1402
Joined: Tue Jan 03, 2006 2:49 pm
Location: Charlotte, NC

Re: Knock Detection with variable sensitivity over RPM

Post by wes kiser »

Trev16v wrote:
dougie2 wrote:...I believe the transient signal is the one which triggers the original circuit, but I guess by analyzing both the transient and the 6KHz Sigal would be the right to evaluate. The filter needs to be either broadband to capture different engine types with different resonant frequencies, or self adapting to the engine noise. Maybe even both.

I was thinking of a circuit which adapts automatically to the noise and therefore detects knocking reliably, rather than having a difficult to adjust RPM2DC Signal.

Could you send the WAV File to my mailbox, that I can evaluate the magnitude in signal difference between noise and signal? If the differece is clear enough I could stick to an analog type of schema...
I'm a little confused about the concept of having 'the 6kHz signal' and 'a transient component'; could you clarify what you mean by this?

On your other point, I totally agree: From studying the .WAV recordings, it became apparent that trying to do this with a preset RPM-to-V 'ramp' could be a total nightmare to ever get completely right; and instead it could possibly be better replaced with a simple circuit that just provides an average of the noise level.

In actual fact, the magnitude of the knock does not really seem to be proportional to RPM. :(

So for this reason I am thinking that it may be better to simply have very high-Q filter that is tuned to the knock frequency for the specific engine, and then put a rectifier and integrator circuit on the output of that filter. In other words, a very selective tone detector. Then, we compare the output of this integrator with the moving average of noise (or a fixed voltage; whichever works best). Given that engine 'knock' manifests itself as a 'burst' of tone that lasts for many milliseconds, I believe this could be another approach.

I've had a few requests for the .WAV samples - I'll email these later tonight once I have had a little bit of time to chop out all of the interesting bits. (The total .WAV recording is a little too large to mail! :) )

Trev
That is the "proper" way to handle it (spikes in the desired frequency range of a greater amplitude than average engine noise).

Have any of you guys simply hooked an o-scope with an FFT function up to a knock sensor of a knocking engine? You get relatively large spikes (generally at least several times the average noise level) in the "calculated" (based on bore size) frequency range. There is no correlation to rpm, although "windowing" this with the tach signal provides an additional means to filter out false knock (this can be done in the tuning software though).

I would really like to see a user configurable relatively effective knock detection circuit available for us to use.
86 Rx-7, swapped to 2.3 ford turbo (BW EFR 6758), ms3/ms3x sequential fuel /waste spark, ls2 coils
88 Tbird 2.3t, Microsquirt Module (PIMP), TFI ignition
dougie2
MS/Extra Newbie
Posts: 10
Joined: Mon Oct 13, 2008 11:14 pm

Re: Knock Detection with variable sensitivity over RPM

Post by dougie2 »

Hi guys,

sorry, but sometimes things take longer because of other ongoing projects.

As promised, we now have the first recordings of a standard KnockSensor, mounted on an Rover A+ Series Mini Engine. Because of current weather conditions in Germany I'm not very enthusiastic doing extended test drives and force the engine to knock. But we will continue the work soon! For those who would like to see/hear the Signal coming from the sensor, get the attached WAV File. We will take similar files for simulation of the sensor signal, when further developing the detector circuit.

http://www.mini-cooper-clubman.de/download/test4.zip

Have phun!

BR
Ralf
vinister
Experienced MS/Extra'er
Posts: 159
Joined: Sat Jul 19, 2008 11:04 pm

Re: Knock Detection with variable sensitivity over RPM

Post by vinister »

I can't believe this project has been stalled since October!

Is there anything I can do to help? I have an engine with 3 knock sensors that runs beautifully, a breadboard, and lots of op-amps and other components. I built one of the first circuits on this thread and it worked well on the breadboard with an audio signal feeding it.

I agree that we should be comparing the knock to an average of the noise, instead of to ground. This should make it much more reliable at detecting sudden knock events on an otherwise smooth motor.

This would be a HUGE addition to the power of MS. Most of us have our fueling dialed in to a tee, but are at a loss for tuning our ignition. I'm sure we could all get more power and efficiency from our motors, not to mention longer life, once we get proper knock feedback.

Thanks, please let me know how I can help!
Locked