Don't copy Speeduino, it was 'designed' by someone with no knowledge of electronics, software or ECUs and it is truly awful. You could possibly use a teensy or similar for knock sensing but not a Mega, the ADC is far too slow, you would have to couple it with a TPIC or similar.
Creating a knock window is relatively simple, depending on complexity of you cam and crank inputs, if you had a single tooth cam and assuming one knock sensor and four cylinders then the time period between inputs is 180 degrees, so 1 degree is timerCount/180. Say, for example my trigger is at 10 degs BTDC and I want a window 20degs ATDC to 70degs ATDC then my window is from 30 degrees after my trigger to 90 degrees after my trigger. So I set up an output compare for inputTriggerTime+ (timerCount/60), then in that interrupt routine I schedule another interrupt for inputTriggerTime+ (timerCount/2). Configure the input capture and output compare so they are on the same timer so input and output is synchronised.
I don't have a specific knock sensor that I use, if the vehicle has a knock sensor then you can usually monitor the knock count on the stock ECU, if it doesn't have a knock sensor then adding one is not a straightforward task, you need to pick a spot where it will pick up knock well but isn't subject to unwanted resonances, even when we tested on a vibration table we would spurious results if the surface wasn't level enough, if the sensor was spaced too far off the table surface, if the adapters weren't flat enough, if it wasn't torqued correctly...
I used the TPIC8108 on ECUs years ago, I've played with the SPC572L but the ECUs that I've been involved with designing have had big BGA chips like the Mamba so not very DIY friendly and they all use timing processors with angular timers.
__________________
1984 Suzuki SJ413K pick up, 1.6 16V Baleno engine 2000 Suzuki Vitara 1.6 8V, many mods 2004 Suzuki Ignis 1.5VVT 4Grip 2006 Suzuki Jimny 1.3VVT JLX+ and many more.
That is very old, it possible to adjust the filter bandwidths but you really need to window the signal to avoid noise outside the knock window and then to perform a proper integral over a the time period to scale the output, so you need a processor. That circuit was designed to be used with the Jaycar ignition, in the modern world its much simpler to implement the whole thing in a processor, even an SPC572L, which is the most basic of engine management processors can perform knock sensing with zero processor overhead. A knock window is created in the the timing processor and auto triggers a 200ks/s ADC which auto samples until the knock window closes. The results from the ADC are sent by DMA to a hardware filter and at the end of the knock window the result is sent by DMA to RAM or an interrupt raised.
Had a quick look at the SPC572L it looks to be far superior to any old ecu processors I’ve played with as in 8 bit and 16 bit.
looking at speeduino code and the way timers are set based on cam and crank inputs I can just about get my head around how a knock sampling window would work but not how to code it.
direct memory access is something that the evo boys used to create “live tuning” on the stock evo 7/8/9 ecus but again no idea where to start on the coding.
I guess the question is how much time and effort is it worth when there is a product out there like plex knock monitor for about 1000 euro.
Do you have a knock monitor that you personally use?
That is very old, it possible to adjust the filter bandwidths but you really need to window the signal to avoid noise outside the knock window and then to perform a proper integral over a the time period to scale the output, so you need a processor. That circuit was designed to be used with the Jaycar ignition, in the modern world its much simpler to implement the whole thing in a processor, even an SPC572L, which is the most basic of engine management processors can perform knock sensing with zero processor overhead. A knock window is created in the the timing processor and auto triggers a 200ks/s ADC which auto samples until the knock window closes. The results from the ADC are sent by DMA to a hardware filter and at the end of the knock window the result is sent by DMA to RAM or an interrupt raised.
__________________
1984 Suzuki SJ413K pick up, 1.6 16V Baleno engine 2000 Suzuki Vitara 1.6 8V, many mods 2004 Suzuki Ignis 1.5VVT 4Grip 2006 Suzuki Jimny 1.3VVT JLX+ and many more.
Only seeing this now after all the years on the site, is it possible to a 5 volt trigger out and some way of setting bore size for the right frequencies ?