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
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 »

boost junkie wrote:Does the 0-5v signal work with the MS1 or MS2 code for knock retard?
Hello.
I just tried to MS1, never did a MS2. The 0-5V signal is a analog output of the knock circuit, proportional to the detonation level , aiming to be examined by a DATALOG. You must select an entry 0-5V of MS to record this signal.
Gokart
Master MS/Extra'er
Posts: 667
Joined: Thu Aug 03, 2006 2:38 am
Contact:

Re: Knock Detection with variable sensitivity over RPM

Post by Gokart »

I tried your circuit on MS2. It works.
(4G63T - MSIIextra) (4G13 - MS3-beta testing)
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 »

Are pcb's available?
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 »

...good work @ dfabro!!

We took the opportunity of developing a rather small version of the circuit, using surface mounted device (SMD) components.
With this the PCB only needs 50x35mm of space, which would fit even into small housings of a MS.

More info here:

http://www.umsforum.mini-cooper-clubman ... 23930038/0


Image


Image
Zaphod
Master MS/Extra'er
Posts: 390
Joined: Thu Aug 14, 2008 11:38 pm
Location: Germany

Re: Knock Detection with variable sensitivity over RPM

Post by Zaphod »

Where can I buy this build device?
--------------------------------
fun is not a straight line

Image

Sven
http://www.mx-5club-sachsen.de
http://miata.cardomain.com/id/svenmx5
NB-1998-1,6-Garrett T25 HGP Turbo Stage I
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 a lot :D :D :D :D I'll try to build the passive one :RTFM:

You mentioned, that tach signal has to be a square shaped, I've no osciloscope for the moment..so it has to be filtered somehow from tacho signal, that comes out of pin x2 (that's the designated rpm pin from motorolla 908hc)?
GT3turbo
MS/Extra Newbie
Posts: 9
Joined: Thu Aug 07, 2008 10:32 am

Re: Knock Detection with variable sensitivity over RPM

Post by GT3turbo »

When will these be avaliable?

Thanks
Adrian
Big Thurs
Helpful MS/Extra'er
Posts: 62
Joined: Thu Jul 15, 2004 11:17 am
Location: Eatonton, GA

Re: Knock Detection with variable sensitivity over RPM

Post by Big Thurs »

I've been working on a layout for the passive design using an lm358 (dual) op-amp instead of an lm324 (quad). I would like for someone to doublecheck my schem in Eagle and get some input on arranging the board (single layer for simplicity). Personally, I think we can make this circuit perfboard friendly with the right layout.

*Updated the layout 10/19/08
91 MR2 Turbo on V3 MSNE-e HR11d
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 »

poliux wrote:Thanx a lot :D :D :D :D I'll try to build the passive one :RTFM:

You mentioned, that tach signal has to be a square shaped, I've no osciloscope for the moment..so it has to be filtered somehow from tacho signal, that comes out of pin x2 (that's the designated rpm pin from motorolla 908hc)?
Poliux,
This output must send a pulse on a chosen output for each tach event. There is NO error checking, so you must make sure that the chosen pin is not already being used for something else.
All tach outputs pin is driven at 50% Duty (square shaped).
I use the X4, but is indifferent.
A hug for you.
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 »

Big Thurs wrote:I've been working on a layout for the passive design using an lm358 (dual) op-amp instead of an lm324 (quad). I would like for someone to doublecheck my schem in Eagle and get some input on arranging the board (single layer for simplicity). Personally, I think we can make this circuit perfboard friendly with the right layout.

*Updated the layout 10/19/08
Hi
OK.
Really, with the LM324 two op-amp will be not use.
The LM358 is good choice.
All help is valid.
thanks.
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 »

dougie2 wrote:...good work @ dfabro!!

We took the opportunity of developing a rather small version of the circuit, using surface mounted device (SMD) components.
With this the PCB only needs 50x35mm of space, which would fit even into small housings of a MS.
Hello
That show. Great work.
you can send me a circuit to test. Here we have dynamometers, the spectrum analyzer, etc..
I want talk to you,
PM for you
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 help sorting out all problems dfabro!!! :D :D :D
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 »

I have now finished the circuit and last night I briefly attempted to test it.

My question is, are you totally sure that you're providing it with a 50% duty tacho input? Because for me, with a 50% duty square input, the frequency-to-voltage converter does not function properly. And I can see why:-

The frequency-to-voltage circuit is using the 555 in monostable operation, or 'one-shot' mode. The converter works by producing a relatively stable voltage at the 33μF capacitor that is proportional to the frequency of one-shot pulses coming out of pin pin 3 via R11. Those one-shot output pulses must always be the same width. Now, when the 555 timer is used in 'one-shot' mode, the width of the negative-going trigger pulse at pin 2 input pulse MUST be shorter than the width of the output one-shot pulses at pin 3 (the width of which is determined by C10 and the 10K potentiometer). Therefore I would have thought that the tacho input should actually be a train of short negative-going pulses, and not a 50% duty square wave. If you use a 50% square input, then although you might be able to apparently calibrate it (e.g. 1.5V at 1500RPM, etc), you will actually find that the output behaves strangely and doesn't change in linear proportion to RPM. This is the problem I had.

Therefore I think that the 50% tacho input from X2 should actually be fed in through a very small series capacitor, maybe 1nF or so. Or it could be achieved using a software adjustment. Either method would provide the 555 with a series of very short trigger pulses. I shall try this when I work on it next.
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 »

I think that the problem with the active version of the filter design is that you're running them from a single rail, but without using any intermediate ground reference. The operational amplifier is used in negative feedback configuration. Its input is an AC signal around the 0V reference point, and the amplifier's V- pin is also at 0V. Yes, the op-amp is a rail-to-rail device (meaning that the common mode input range extends down to V-), but it still won't work. In this configuration, the operational amplifier would need a split voltage supply (e.g. +5V and -5V) for it to work properly. I'm a little uncertain as to how your active filter worked properly in your original prototype.

Also, the first 555 frequency-to-voltage circuit must not have a 50% duty square tacho signal going directly into it. You must couple the 50% duty tacho signal through a 100nF capacitor first. This is so that the 555 only sees very, very short input tacho pulses. This 555 is being in one-shot mode, and when you use a 555 in a one-shot circuit, the input trigger pulses must be shorter than the output pulse. If you don't do this, then your tacho-to-voltage calibration may seem to be correct, but try seeing what happens to Vref as you gradually increase from 1,500rpm to 7000rpm. You'd expect the voltage to increase in proportion, but it won't; you may actually see the voltage rise up and then actually start to fall again.
Last edited by Trev16v on Sun Nov 02, 2008 6:24 am, edited 2 times in total.
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 »

Trev 16V is right! I identified the same problem when checking the circuit.

In our PCB visible above, there's already a coupling capacitor and a protection diode included which triggers the NE555 correctly.
Also we changed the values of some component which might have caused failiure of the circuit at some time.

More info:

http://www.mini-cooper-clubman.de/html/ ... ensor.html (German)

http://www.umsforum.mini-cooper-clubman ... 1223930038 (English)

With this amendment the circuit is working fine.
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 »

I have also now made my own changes to make the circuit work:

1. 100nF series capacitor for the tacho input.

2. A 2.5V bias reference voltage is created using two 560R resistors in series across the 5V supply. The 2.5V is used in place of the 'ground' reference for both operational amplifiers. This enables the active LPF and HPF to work as they were originally intended. Both of the filter circuits have been simulated in PSpice using this configuration and they work great.

The revised schematic:

http://www.introspectiv.eclipse.co.uk/m ... _sch_1.JPG

Image of knock circuit installed into my MS:

http://www.introspectiv.eclipse.co.uk/m ... %20009.jpg

And, in case it helps anyone, here's where you go to set the tacho output pin. It took me a while before I discovered it!

http://www.introspectiv.eclipse.co.uk/m ... lect_1.JPG
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 »

Sorry to say that but his isn't correct either....

1. First of all your 100nF capacitor to Pin2 of U3 needs special attention! If the incoming tacho signal gets low, it generates a negative trigger signal at U3. The capacitor then gets charged to +5V. When then the tacho signal switches to 5V it boosts the voltage at the trigger input of the NE555 to 10V !! You need to put in a protection diode which limits the voltage at pin 2 to somewhat 5,7V, otherwise the NE555 might die.

2. The timing constant at U3 using the potetiometer and C10 is critical for the NE555 to discharge. At high revs the internal transistor of the NE555 has to discharge the 2,2uF quite often, which results in a high current. Better using a 470nF capacitor and a 10k or 50k potentiometer

3. Both buffer capacitors connected to pin 5 of the NE555s need to be 100nF enspecially in noisy environment

4. 100nF capcitors and a 100uF electrolytic capacitor need to be installed across the supply voltage. In general it's not recommended using th bipolar version of the NE555 here... the cmos version e.g. TLC555 would work much better...

5. Your output will not work as intended. The voltage at the cathode of the LED will switch between 5V and 5V minus the forward voltage of the diode. In case of a red LED (Vf about 1,2V) it would only switch between 5V (high signal) and 3,8V (Low Signal). The 1k output resistor needs to be connected to the collector of Q1...

Please consider that a lot of people are relying on the information provided here. So a lot of frustration would be caused when people try to make things work which cannot work.

BR
Ralf
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 »

Hi Ralf,
dougie2 wrote: 1. First of all your 100nF capacitor to Pin2 of U3 needs special attention! If the incoming tacho signal gets low, it generates a negative trigger signal at U3. The capacitor then gets charged to +5V. When then the tacho signal switches to 5V it boosts the voltage at the trigger input of the NE555 to 10V !! You need to put in a protection diode which limits the voltage at pin 2 to somewhat 5,7V, otherwise the NE555 might die.
There is such a protection diode on my board already. This was an omission I made from the schematic in error; the schematic in the link above has been corrected. Thank you for pointing it out. (I know only the foolish would leave these things down to the IC's internal ESD protection diode!)
2. The timing constant at U3 using the potetiometer and C10 is critical for the NE555 to discharge. At high revs the internal transistor of the NE555 has to discharge the 2,2uF quite often, which results in a high current. Better using a 470nF capacitor and a 10k or 50k potentiometer
I only changed the value of the potentiometer to 2K2 because I personally found that the ideal setting for me was somewhere around 1K5, and the 2K2 potentiometer made it easier to adjust. It's also a very bad thing for there to be no other series resistor in line with the potentiometer, for obvious reasons, and if I were drawing the schematic from scratch I'd have added that too. If I were doing this from scratch myself then it would have been different, but please remember that the capacitor value, lack of potentiometer series resistor, etc. are just as they were when presented by the OP. Really, I'm just trying to indicate on the schematic what changes I made to make the circuit *work*. But I agree it would be good to draw another shematic that incorporates all of these suggestions.
3. Both buffer capacitors connected to pin 5 of the NE555s need to be 100nF enspecially in noisy environment
3. Again, these values are from the OP's schematic.
4. 100nF capcitors and a 100uF electrolytic capacitor need to be installed across the supply voltage. In general it's not recommended using th bipolar version of the NE555 here... the cmos version e.g. TLC555 would work much better...
4. All three ICs on my board have tant and ceramic capacitors put directly across the power supply pins, on the bottom side of the board. And I am using CMOS 555 devices.
5. Your output will not work as intended. The voltage at the cathode of the LED will switch between 5V and 5V minus the forward voltage of the diode. In case of a red LED (Vf about 1,2V) it would only switch between 5V (high signal) and 3,8V (Low Signal). The 1k output resistor needs to be connected to the collector of Q1...
5. This is a mistake in my schematic for which I apologise - it was late last night and I did it in a hurry. It has now been amended in the link above. If you look closely enough at the photograph of my board, you can see the output clearly goes to the collector of Q1!


I do thank you for pointing out the two errors in my marked-up schematic (missing protection diode and output connection point) and it has now been amended.

Please consider that a lot of people are relying on the information provided here. So a lot of frustration would be caused when people try to make things work which cannot work.
Okay - I'm a bit suprised and upset about the last comment which suggests I could be posting something that cannot be made to work. Is this directed at the original poster and contributor of the design, or is it directed towards me? Because from my point of view, I have started out with a design that had fundamental design issues (such as trying to run those two filters from a single-rail supply as they were, and so forth) that simply could not be made to work at all. Indeed a lot of frustration WAS caused to me when I realised I had constructed something that simply could not work. So I went about applying a few changes, and I was rather pleased to have been able to make the HPF / LPF filters and 555 circuit work after all with a few very simple changes to my stripboard layout, and I didn't have to completely junk the design after all. So, I thought it would be helpful to present the findings to everyone else.

My aim was not to present an absolutely perfect schematic; I was merely just tring to show the important changes I made that made it actually work.

Trev

PS. Out of interest, what design change did you implement for the filters?
Last edited by Trev16v on Sun Nov 02, 2008 5:50 am, edited 1 time in total.
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 »

Okay, so now you have really upset me, and I really wonder why I have even bothered at all. Over on your Mini forum, you had to post this:
Based on the well known theory that too many cooks are spoiling the broth, now the quite good original article get's changed for the worse....

Please simply stick to our proposal which should work fine and reliable.

http://www.msextra.com/viewtopic.php?f= ... a9c0da825f...

BR
Ralf
Well, thank you very much indeed for this.

It seems that you're accusing me of 'being a cook' who has 'turned things for the worst' by 'posting something that cannot work'?

So you advise people to use your proposal instead. Okay, so I've had a look at your circuit diagram on the German forum: http://lh6.ggpht.com/miniestate.de/SPg- ... V1_1_A.jpg and I see that not only are some of the points you raised above are not addressed in your schematic but, most amazingly of all, you still have both of your operational amplifiers connected just like in the original schematic! In this configuration they may still pass something though (so, therefore, hitting the knock sensor may well trigger the circuit), but do you realise that they simply can NOT work as a 6kHz bandpass filter as originally intended? To make the filters work properly, or for that matter to use any inverting operational amplifier on a single-rail supply where the input signal is AC around 0V, you HAVE to use a 'virtual ground', just as I have done using my two 510R resistors. It seems that you have totally overlooked this very simple fact. I have made this change, and I have verified correct operation of the BPF using both PSpice and on the bench using a signal generator and oscilloscope. Your own schematic still contains the fundamental op-amp design error that the original schematic contained, and I therefore recommend that you learn a little more about how to use operational amplifiers, and read this tutorial: http://www.swarthmore.edu/NatSci/echeev ... upply.html


As I have said, I have taken the original contributor's design, and I have made a few simple changes that (1) made the 555 circuit work properly, and (2) made the low-pass and high-pass filters work properly. And I have taken the time to present my changes on here, because I have a genuine desire to contribute information that other people will find useful. I have genuine belief that my marked-up schematic will give good results, and importantly I KNOW that the filter in my schematic really does work as a functioning 6kHz bandpass filter, after having verified it fully using simulations and real bench tests; as opposed to just claiming 'it should work' or claiming it works 'just because hitting the sensor lights the LED'.

I really hate having to pass words like this over a forum because, for me, this is just a hobby and I have simply presented my findings here because I like to contribute back whatever I can. I am very grateful to the OP for presenting the design in the first place and I thought it would be helpful for others to see the improvements I made. But with the greatest of respect, I ask that before being so quick to totally rip apart my own efforts and so audaciously accusing me of 'turning things for the worst' just because I made a little mark-up error in my schematic (for which I am grateful to you for pointing out so quickly), please would you take a little time to consider that I have addressed and corrected a simple design error with the filter that you have apparently completely overlooked. Thank you.

Trevor
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 »

C'mon Trevor, keep cool. 8)

I mailed to dfabro already two weeks ago discussing the small flaw of the NE555 Monoflop. But despite this, the cicuit is working fine.
Even the original schematic from defabro worked, however with a small nonlinearity re the RPM to DC part.
On the opposite, Your schematic had two design errors, which weren't present before. And re. your discovered Filter error.... there isn't any.
The circuit from defabro works fine, even with single supply voltage.

BR
Ralf
Locked