Knock sensing ideas and circuit designs

From DIY contraptions to sophisticated FreeEMS-specific designs! Plus general hardware development!
mk e
1N4001 - Signed up
Posts: 230
Joined: Mon Aug 17, 2009 3:20 pm

Re: Knock sensing ideas and circuit designs

Post by mk e »

The 5554 function set has a "knock window" where the crank position where knock is expected is specified. The fact that this is a standard function makes me believe it is standard practice to use a knock window approach.

This would mean the the knock sensing circuit would want a timing signal from the CPU right?
User avatar
jharvey
1N4001 - Signed up
Posts: 1607
Joined: Tue Jun 10, 2008 5:17 pm

Re: Knock sensing ideas and circuit designs

Post by jharvey »

That can be handy, but not necessarily required. A known or consistent signal path latency would also work well. As long as you know the delay from when it knocked to when it triggered a knock, that's the big thing. Having it synced with a known clock source may allow for some additional refinement, allowing for triangulation of the knock as well as windowing.

Probably a good thing to bring up, and resolve how we want to clock this puppy. I wonder is it feasible to have that come directly from the brain?
mk e
1N4001 - Signed up
Posts: 230
Joined: Mon Aug 17, 2009 3:20 pm

Re: Knock sensing ideas and circuit designs

Post by mk e »

jharvey wrote: I wonder is it feasible to have that come directly from the brain?
That's no problem on 5554.

The thing about a knock window is that you really don't want to even be listening at anyother time because the only thing you will be hearing is noise.

What signal comes out of a knock sensor? On 5554 I'd be very temped to send the signal straight in and let the CPU deal with it vs trying to send crank anle info out to another board.
User avatar
jharvey
1N4001 - Signed up
Posts: 1607
Joined: Tue Jun 10, 2008 5:17 pm

Re: Knock sensing ideas and circuit designs

Post by jharvey »

The knock chip is really just an amplifier, then filter, then energy detector. The output is an analog signal that increases as a specific frequency is heard. The SPI bus controls what frequency is being listened to, and the gain of what it is listening to. If you crank the gain way up, the analog output will act like a digital detector as it will hit the top rail quickly when any noise is noticed.

I think we will prefer the sensor not be digital sensitive. I think we will want to know how hard it knocked, such that we know how much we need to change the timing.

I don't know the latency, largely because the parameters you program into it will change the latency. I think it's reasonable to expect around .001s, but I don't feel like I can really claim that for sure. I believe a knock would register as an analog bump. I suspect we would want peak detect, so we know how much we need to back off the timing. I'm not sure if that will be hard to accomplish in software, or if it should perhaps be done on the harder side of this. Hmmm, do we want peak detect, perhaps we want an integrator function instead, you know, how much energy is perhaps more important than how loud.
mk e
1N4001 - Signed up
Posts: 230
Joined: Mon Aug 17, 2009 3:20 pm

Re: Knock sensing ideas and circuit designs

Post by mk e »

You can’t get around needing to know the engine crank position if you are looking for anything other than sever knock. If you are handling knock as a standalone you could calculate the time window from rpm signal and the ignition outs of you could measure the rpm from the ignition outs and then calculate the window.

Reading back thought the knock thread it looks like the sensor itself is kicking out 0-2V, probably more under sever knock.

For 5554 I think I would prefer to just send the signal straight in (or in through some kind of protection circuit)to the CPU ADC using a knock window output from the eTPU to turn the input pin on and off. Then in the CPU I can verify the sensor is working and take appropriate action proportional to the signal amplitude or energy or whatever. We can continue this part of the discussion on the 5554 hardware thread.
davebmw
LQFP144 - On Top Of The Game
Posts: 331
Joined: Sun Jul 13, 2008 2:58 pm
Location: South Wales, UK

Re: Knock sensing ideas and circuit designs

Post by davebmw »

I've connected the knock sensors directly to the sound card on my laptop while playing with MS2 and while there is a bit of noise on there the knock signal is clearly visible and I put it down to the sensor bandwidth.
The other regular noises picked up are the valves slamming into the seats, piston slap on a cold engine and a noisy hydraulic lifter.
The random noise could easily be filtered out, but i think that windowing would be the only accurate way to reliably detect a knock event.
Please tell me if I'm talking crap, I know I have been out of the loop for several months but I'm just recalling my previous efforts.
93'BMW 325is M50B25TU, Rebuilt 06/06, JE10.5:1, polish&port. Scorpion BB, K&N CAI, TEJ21 WBO2, '07 M3 Evo 18" 225F, 255R, EBC Kevlar, Bilstien Sprint, Polyflex. Head rebuild Oct'08, OEM+FSE FPR, MS2v3.0_DJB Custom, Extra 2.0.1
User avatar
jharvey
1N4001 - Signed up
Posts: 1607
Joined: Tue Jun 10, 2008 5:17 pm

Re: Knock sensing ideas and circuit designs

Post by jharvey »

The tpic chip offers many of the above noted items. It offers a first line of defence against bad signals, stray voltage, ect. In terms of analog signal flow there is a need to amplify, filter, and energy detect, while maintaining knowledge of what part of the cycle the energy occurred.

The processor already has the engine position, so it make sense to keep track of when the energy occurred in software. As for amplifying, filtering, and energy detection, those can be done either in software or hardware. I plan for the hardware approach, because it frees up resources, and works off existing designs that have already been tested. We certainly will need a hardware interface, and the TPIC is low cost so why not get that interface, and some additional features as well. Although the energy detection offered by the TPIC is good, it doesn't have intimate knowledge of what's going on in the software. So to get windowing and such features, that really needs to be done by the software side of it.

The big questions are, how does the software handle finish this signal path, and what bias resistor will we need for the knock sensor(s).
davebmw
LQFP144 - On Top Of The Game
Posts: 331
Joined: Sun Jul 13, 2008 2:58 pm
Location: South Wales, UK

Re: Knock sensing ideas and circuit designs

Post by davebmw »

For the R1 and R2 values that set the gain of the internal front end amplifier it's a ratio of R1 to R2 so for a gain of x10 R1 = 1K and R2 =10K and the same in reverse for /10 attenuation R1 = 10K and R2 = 1K.

From the signal levels on my laptop (roughly 800mV P-P for the knock) I would suggest x10 would work fine for my BMW sensors, or at least that's where I would start, final tweaking will probably be needed though as that is a rough measurement with basic testing methods to hand.
93'BMW 325is M50B25TU, Rebuilt 06/06, JE10.5:1, polish&port. Scorpion BB, K&N CAI, TEJ21 WBO2, '07 M3 Evo 18" 225F, 255R, EBC Kevlar, Bilstien Sprint, Polyflex. Head rebuild Oct'08, OEM+FSE FPR, MS2v3.0_DJB Custom, Extra 2.0.1
User avatar
jharvey
1N4001 - Signed up
Posts: 1607
Joined: Tue Jun 10, 2008 5:17 pm

Re: Knock sensing ideas and circuit designs

Post by jharvey »

I see the data sheet notes R1 min at 25K, so I guess I'll start with 25K and 2.5K. My gut tells me the higher we go with the 25K the less energy will transfer, therefor the noise floor will raise. However, the most energy you can transfer in a analog system is when your impedances are matched.

Your sound card is likely a hi impedance sound card, so around 1k perhaps as high as 10k. Based on the 25k min, I'm sure you had a huge impedance mismatch. This likely means we would see higher signal levels by increasing the impedance. I should probably go look up knock sensors and see if I can find the impedance of something we can buy. Or I can just try it imperially. It really wouldn't take all that long, find a repetitive signal, then swap out R1 until you find the peak, then adjust R2 until it's the range we are looking for.
davebmw
LQFP144 - On Top Of The Game
Posts: 331
Joined: Sun Jul 13, 2008 2:58 pm
Location: South Wales, UK

Re: Knock sensing ideas and circuit designs

Post by davebmw »

This is audio frequencies we are talking about here and only a specific narrow band within that range, I really don't think we'll need to worry that much about impedance matching. This isn't RF and we are no where near the kind of design considerations required for it.

The Piezo knock sensors in my engine are around the 2M Ohm mark as would any Piezo sensor should be around this area. The op amp built into the TPIC will determine the input impedance in combination with R1. R2 is the negative feedback and controls the gain. having a lower input impedance will tend to snub the low energy noise leaving the real knock signal, which by all accounts is significantly larger than the spurious noise.

PS: the soundcard input impedance on this laptop is 20K Ohms and if the signal from the 2Meg Ohm sensor is detected by the audio quality stereo DAC at 16bits and 44.1Khz then I'm sure there is plenty of signal to have a play with, even with the comparatively low input impedance.
What may be useful is repeating exactly what I did and record a wave file at 0dB attenuation with some knock in it and play this back to the TPIC knock sense circuit, this may provide a basis for a bench mounted experiment where the correct/exact/optimal values for R1/2 could be determined before unleashing onto a real engine.

Oh and to get reasonably accurate amplitude measurements on a sound card you first need to use an oscilloscope and sig gen.
I set the sig gen up on the scope to 10KHz and 500mv P-P. I then fed this into the soundcard and recorded the WAV file played this back to the oscilloscope and tweaked the line in and master volume to get exactly 500mV P-P on the playback. Using this method ensures that you have 0dB attenuation and gain and is a quick and easy way to use the sound card for 2 channel (or more, I can have upto 6 channels) for analogue signal capture.
93'BMW 325is M50B25TU, Rebuilt 06/06, JE10.5:1, polish&port. Scorpion BB, K&N CAI, TEJ21 WBO2, '07 M3 Evo 18" 225F, 255R, EBC Kevlar, Bilstien Sprint, Polyflex. Head rebuild Oct'08, OEM+FSE FPR, MS2v3.0_DJB Custom, Extra 2.0.1
Post Reply