WM8782 I2S on Rpi 4 for knock sensor data processing

Hello,

I would like to share what I am working on and possibly get some help on area's I am not very familiar with.

Introduction:

A few years back I was doubting to change out my Yamaha FZ1 Fazer motorcycle for some other type, however I failed to find a suitable replacement. Then I stumbled upon a really cheap turbocharger on a local marketplace and since I always wanted to do something with a turbo I decided to convert my FZ1.

I bought the turbo and started on the project, I crafted spagetti exhaust headers from stainless steel to fit the turbo just below my radiator and close to the engine block. Then I crafted an aluminum plenum for the inlet side, changed out the OEM ECU and OEM dash to fit an EFIgnition 46 and KOSO dash. Fitted an extra fuel pump, oil return pump, water cooled- inter cooler, wiring loom, etc, etc, etc..

Wonder well thing started on the first attempt and did some ECU parameter tuning (ignition + fuel) to get it running atmospheric. I found that the turbo kicks in really early (0.7 bar @ 5000 rpm) to I was concerned about engine knock which will destroy aluminum pistons and cylinder head in seconds. So I decided to do research on measuring engine knock. One thing to reduce the chance of engine knock it to lower the compression ration of the engine. So I stripper the engine, added a 1.5mm aluminum plate to the base of the cylinder block and rebuild the engine. The other thing the reduce the engine knock it to run a very rich mixture, normally an engine runs on about 13-16:1 air/fuel ratio, on turbo engines 10-13:1 is more common. The there is ignition advance, which can cause the mixture to burn to early and push back on the rising piston (not good!) So, the only way to see where you are going is to measure stuff. I have a wideband- and a narrow band lamda sensor to measure the air/fual ratio, I have an exhaust temperature sensor, now I just need to add the knock sensor to complete things and hopefully keep my engine in one piece during ECU tuning.

Engine knock (or detonation) is uncontrolled burning of the air/fuel mixture, it's more of an explosion then anything else (read) This is caused by lean mixtures and/or high gas temperatures within the cylinder. If knock occurs this can be measured with a knock sensor which is a piezo microphone bolted to the engine block. Each engine layout has a specific knock frequency (calculator) , for me this will be around 7 KHZ. Now I once bought this nice arduino engine knock shield , but this knock shield has a band pass filter that need to be configured for the correct frequency to work... since I do not know this frequency exactly , relying on this shield to work is doubtful for me, so I want to do FFT on the signal coming from the knock sensor, visualize it and make it audible (headphones)

For this I bought a Stereo ADC Board WM8782 I2S 24bit 192kHz from Audiophonics, and connect this to a Raspberry Pi4 over I2S.

Following the excellent post of DRONE7 I have the I2S ADC converter up and running now with a knock sensor (KS4-P) connected:

P_20241128_134809.jpg
P_20241128_134752.jpg


The WM8782 is configured to do 44.1KHz sampling @ 16bit/128fps , on higher sampling frequency's or other bit resolutions the audible sound was horrible (a lot of noise) I managed to improve the sound quality a bit using the twisted pair layout (as described in the WM8782 evaluation board document from Cirrus) , so on the current settings I can make out a clear 'tap' on the knock sensor, I have noticed the sound quality improving when I clamp the sensor , I assume the voltage of the piezo rises during clamping which improves the signal/noise ratio. Further improvement would be to add an electromagnetic shielding case around the WM8782, since I am going to use it on a motorcycle which has an electromagnetic unfriendly environment (ignition sparking).

Next items to develop/investigate... Raspberry Pi software to read the audio from I2S (which is/was now done with arecord) and process it.

Kind regards,

Dirk