Knock Sensor Solution: TPIC8101

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

Moderators: jsmcortina, muythaibxr

Spilly
Helpful MS/Extra'er
Posts: 44
Joined: Fri Jan 11, 2013 2:00 pm

Knock Sensor Solution: TPIC8101

Post by Spilly »

I am an electrical and computer engineering student (summer/third semester) and I have been developing a knock sensor interface that does not need to be disabled at high RPM's. I started this project do to the lack sophisticated aftermarket knock detection systems easily available to the average car geek.

A knock sensor is a piezo sensor, very similar to a microphone type piezo, which mounts directly to the engine block just below the cylinder head.

The knock sensor is used as an input to a feedback loop that adjusts the ignition advance of a four stroke internal combustion spark ignited engine. When operated in a knock limited state, optimal efficiency is just before the point of detonation/knock. Most engine management systems ignore the knock sensor above a specific rpm. This is because it cannot differentiate between mechanical noise and actual knock at high rpm's. This means the ignition advance is set to less than optimal. This results in lower engine efficiency (less horsepower and torque).

The integrated circuit (IC for short) or chip that is able to do this is Texas Instrument's TPIC8101. The primary advantage of the TPIC8101 is the ability to window your listening period (when valves are not opening or closing etc.) to limit false positives due to valve train and other engine noise. The solutions using the TPIC8101 I have been able to find do not vary the time constant based on RPM. This will cause sensitivity to vary with RPM, which causes false positives on one extreme (low rpm) and not picking up actual knock on the other (high rpm).

Integration is simply determining the area under the curve. The IC is integrating the sine wave output from the knock sensor. The area under the curve depends on the voltage and amount of time. The longer the listening window, the more sine waves the IC receives, which results in more area under the curve. This is why the time constant is so important. Hopefully my illustration will make this easier to follow. Please excuse the crudeness of the hand drawing. If someone with a little more calculus knowledge can give a better explanation, I would greatly appreciate it.

Image

Software:
Link to my github page that contains source code: https://github.com/spillymon/TPIC

My programming skills were non-existent before starting this project, about seven months ago, so, please excuse any crudeness. This is an ongoing learning experience that I have enjoyed every step of the way.

My current code varies the time constant with rpm (check out the “changTc” function in the source code for equation) and takes full advantage of all the aspects the TPIC8101 offers, even the digital integrator output. This means an analog to digital converter is not needed. The microcontroller sends a simple pulsed output when a configurable output level is exceeded, which indicates knock. This output can be sent to an engine management system and/or an indicator light.

When updating the integrator time constant and using the digital integrator output, up to four SPI data transfers occur after each crank sensor input. Each data transfer takes approximately 10.5 micro-seconds (0.0000105 seconds). This leaves plenty of time between inputs or ignition events even at high rpms.

The program is able to estimate a given engine position with an algorithm that calculates the amount of time required to reach that position from the last crank input pulse. This allows a greater selection of engine positions than the number of teeth on the crank position sensor would allow. For example, a 12 tooth crank wheel gives engine position in 30 degree increments. I have tested the program up to a simulated 20k rpm, and the algorithm still provided about 94% accuracy when estimating engine position in one degree increments.

Limitations:
The current program requires both a crank and cam sensor input in order to function properly.

Currently my code is configured for a Toyota 4AGE 20v with booth a 24 tooth and one tooth cam wheel. The code can be reconfigured for other applications by simply changing the user configurable variables in the code. However, I have not yet developed an algorithm to deal with different numbers of cylinders. This means the current code only works with four cylinders.

An issue for some is the requirement of a resonant-type knock sensor. These have a bandpass filter built in. The TPIC8101 does have an adjustable bandpass filter, however, it is not sufficient for use with a non-resonant type sensor (non-resonant means no built in bandpass filter). My testing has indicated the TPIC8101’s bandpass filter has bandwidth of approximately 3khz when using a center frequency of 6.9khz. This means a non-resonant sensor will need additional filtering.

Hardware:
I also have been working on a board that provides dual inputs, hardware adjustable gain, oscillator circuit, and everything else needed to get the TPIC8101 ready to be interfaced with a microcontroller. The next revision of the board will have the microcontroller and voltage regulators built in. This will also be released under an open source license. But for now, just pictures.


Image
Image


This is one of the first public posts I have made with my entire project. Input/criticism is greatly appreciated and I am happy to answer questions. I apologize if my responses are delayed. I am a full time student, with a job, and work on this project in my spare time.

I am not expecting this project to be revolutionary. The most I expect to get out of this project is to develop my engineering skills. I find that I get a much better learning experience when I can see the use of and apply the information in a real world situation. I feel like I have learned more from this project than I would have by simply attending classes like an average student.

Also, if anyone is interested in helping with the development of this I have two current revision boards that I am not going to be using.
Last edited by Spilly on Sun Jul 06, 2014 10:22 am, edited 3 times in total.
slow_hemi6
Super MS/Extra'er
Posts: 4122
Joined: Fri May 07, 2004 3:33 am
Location: Australia

Re: Knock Sensor Solution: TPIC8101

Post by slow_hemi6 »

The knock sensor is used as an input to a feedback loop that adjusts the ignition advance of a four stroke internal combustion petrol engine. Generally optimal ignition advance is just before the point of detonation/knock. Most engine management systems ignore the knock sensor above a specific rpm. This is because it cannot differentiate between mechanical noise and actual knock at high rpm's. This means the ignition advance is set to less than optimal. This results in lower engine efficiency (less horsepower and torque).

Here is a quote, from Wikipedia http://en.wikipedia.org/wiki/Engine_knocking, that provides a short but somewhat thorough explanation of what knock/detonation is.

"The fuel-air charge is meant to be ignited by the spark plug only, and at a precise point in the piston's stroke. Knock occurs when the peak of the combustion process no longer occurs at the optimum moment for the four-stroke cycle. The shock wave creates the characteristic metallic "pinging" sound, and cylinder pressure increases dramatically. Effects of engine knocking range from inconsequential to completely destructive."
I am just wondering if this work is based around the incorrect assumption that an internal combustion engine will produce maximum torque by igniting the mixture just before knock occurs. The quote above might seem to suggest this but the preface "Generally" should really be seen for what it is and not just glossed over. On many engines that are tuned on a dyno you will find examples of knock occurring at say 36 degrees btdc but maximum torque being produced around 30 degrees btdc. These knock detectors will retard to just before knock but will still leave the engine lacking torque due to igniting the mixture too early. This is robbing the engine of power.
My point being that a knock detector is a useful safety device for engine longevity but if you are saying it is a tuning aid to achieve maximum potential from the engine then that is for many engines, quite incorrect. Knock detection can not be seen as some kind of alternative to having a properly mapped ignition curve that was produced with feedback of engine torque produced.
Last edited by slow_hemi6 on Sat Jul 05, 2014 9:12 pm, edited 1 time in total.
Find the Manuals up top under Quick links: Manuals. :RTFM:
Cheers Luke
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Knock Sensor Solution: TPIC8101

Post by racingmini_mtl »

slow_hemi6 wrote:My point being that a knock detector is a useful safety device for engine longevity but if you are saying it is a tuning aid to achieve maximum potential from the engine then that is for many engines, quite incorrect.
I totally agree. But that seems to be extraordinarily difficult for some to understand and that misconception is propagated over and over.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
Spilly
Helpful MS/Extra'er
Posts: 44
Joined: Fri Jan 11, 2013 2:00 pm

Re: Knock Sensor Solution: TPIC8101

Post by Spilly »

Do you guys have some documentation to go with that? I understand that fuel mixes with high levels of alcohol and/or high octane fuel, relative to the combustion pressures, have maximum efficiency well before knock occurs.

However, aren't the majority of the vehicles running petrol based pump gas in a octane limited state?
Spilly
Helpful MS/Extra'er
Posts: 44
Joined: Fri Jan 11, 2013 2:00 pm

Re: Knock Sensor Solution: TPIC8101

Post by Spilly »

slow_hemi6 wrote:
My point being that a knock detector is a useful safety device for engine longevity but if you are saying it is a tuning aid to achieve maximum potential from the engine then that is for many engines, quite incorrect. Knock detection can not be seen as some kind of alternative to having a properly mapped ignition curve that was produced with feedback of engine torque produced.
I do have to disagree with that statement. With the introduction of in combustion chamber pressure sensors, the maximum pressure acceleration point is able to aligned with TDC without the need for a dyno.
subwoofer
Super MS/Extra'er
Posts: 884
Joined: Sat Apr 30, 2011 12:34 pm
Location: Sandefjord, Norway

Re: Knock Sensor Solution: TPIC8101

Post by subwoofer »

A knock sensor is NOT a pressure sensor, thus it can only help in tuning if indeed knock limited. Modern engines are not knock limited in most of the operational envelope.
Joachim
1974 Jensen-Healey
1990 VW Caravelle Syncro - running MS3+X
2014 Ford Fiesta EcoBoost
Spilly
Helpful MS/Extra'er
Posts: 44
Joined: Fri Jan 11, 2013 2:00 pm

Re: Knock Sensor Solution: TPIC8101

Post by Spilly »

I have update my original post to avoid further debate on MBT and whether or not a specific application is knock limited. I am not a Mechanical Engineering major, and I certainly do not have enough knowledge in that area.

I appreciate the input/criticism. It is exactly what I am looking for.
Spilly
Helpful MS/Extra'er
Posts: 44
Joined: Fri Jan 11, 2013 2:00 pm

Re: Knock Sensor Solution: TPIC8101

Post by Spilly »

subwoofer wrote:A knock sensor is NOT a pressure sensor, thus it can only help in tuning if indeed knock limited. Modern engines are not knock limited in most of the operational envelope.
Agreed, a knock sensor is not a pressure sensor.
Spilly
Helpful MS/Extra'er
Posts: 44
Joined: Fri Jan 11, 2013 2:00 pm

Re: Knock Sensor Solution: TPIC8101

Post by Spilly »

I thought I would add, and have added to the OP:

I am not expecting this project to be revolutionary. The most I expect to get out of this project is to develop my engineering skills. I find that I get a much better learning experience when I can see the use of and apply the information in a real world situation. I feel like I have learned more from this project than I would have by simply attending classes like an average student.

Also, if anyone is interested in helping with the development of this I have two current revision boards that I am not going to be using.
tpsretard2
Master MS/Extra'er
Posts: 662
Joined: Thu Feb 14, 2008 4:59 am

Re: Knock Sensor Solution: TPIC8101

Post by tpsretard2 »

If everything is optimal only a cylinder pressure sensor will be able to help you tune for an optimal ignition curve. Other than that a Dyno is the only other way.

Now most of the installs of the ms system or other lower priced ECU's are in road cars or some such. 90% of them are being pushed passed their normal operating levels. For situations like this, a lot of people do not have access to dyno's. This is where having a Knock sensor is invaluable. It is best served as a safety device like when a got a batch of bad gas the other day, but it can be a good tuning device also.
Spilly
Helpful MS/Extra'er
Posts: 44
Joined: Fri Jan 11, 2013 2:00 pm

Re: Knock Sensor Solution: TPIC8101

Post by Spilly »

tpsretard2 wrote:If everything is optimal only a cylinder pressure sensor will be able to help you tune for an optimal ignition curve. Other than that a Dyno is the only other way.

Now most of the installs of the ms system or other lower priced ECU's are in road cars or some such. 90% of them are being pushed passed their normal operating levels. For situations like this, a lot of people do not have access to dyno's. This is where having a Knock sensor is invaluable. It is best served as a safety device like when a got a batch of bad gas the other day, but it can be a good tuning device also.
Agreed. That is the target audience for this project. Hopefully it will help a few people out.
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Knock Sensor Solution: TPIC8101

Post by racingmini_mtl »

tpsretard2 wrote:...but it can be a good tuning device also.
No. The only thing it tells you if that you've got knock or not. If you have knock you can do something to correct it. But if you don't have knock, you have no way of knowing if your spark timing is anywhere close to what it should be and using knock is not an indication of good or bad timing.

Having said that, it is a useful tool so that development is worth continuing. Just don't expect it to be and promote it as something it's not.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
tpsretard2
Master MS/Extra'er
Posts: 662
Joined: Thu Feb 14, 2008 4:59 am

Re: Knock Sensor Solution: TPIC8101

Post by tpsretard2 »

2 of my cars are over 115db. they are also VERY knock limited even on entry level race gas.
with out the knock sensor we would of exploded them long time. Will keep my knock sensor handy for every engine i tune..
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Knock Sensor Solution: TPIC8101

Post by racingmini_mtl »

In the sense that you set some tuning parameters that prevents your engine from blowing up, I guess you can call it a tuning device. I would still call it a safety device rather than a tuning device where tuning is finding the parameters to optimize the power and fuel consumption. But that is basically semantics at this point.

Regardless of what you call the device, you still don't know from the data how far you are from the ideal spark timing and how much what you see is due to bad gas (or badly matched engine components). And there is nothing to tell you that once you hit knock whether it's because your engine is knock limited or whether you just went way past the optimum timing. It's usually because "everyone knows" that "X" engine is knock limited (which may or may not be accurate depending on how the engine was built).

As I said before, there are tons of misconceptions on this subject being propagated over and over. So using a knock sensor as a tuning tool for knock-limited engines should be seen as a very specific case with some very specific limitations.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
jsmcortina
Site Admin
Posts: 39621
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Knock Sensor Solution: TPIC8101

Post by jsmcortina »

See "Internal Combustion Engine Fundamental" by John B. Heywood, ISBN 0-07-100499-8
Section 9.6 Abnormal combustion : Knock and surface ignition
15.4.4 Chamber Octane Requirement

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: Knock Sensor Solution: TPIC8101

Post by 24c »

I tend to regard a knock sensor as a gauge or indicator. The knock sensors that were fitted to the two strokes I messed with were a waste of time, you just got an increasing number of detonation counts that didn't always match reality when you took the cylinder head off and looked at the combustion chamber surfaces and pistons for evidence of knock. In an OHV four stroke, whipping the head off and peeking into the chambers is a little harder.

If the project develops into an accurate "knock gauge" then all well and good, but for me the best indicator of good combustion events is a pressure sensor, but these cost megabucks. I keep meaning to shell out for one of those fancy spark plugs, because when you are modding an old engine (design wise) that is more prone to knock because of its configuration, and trying to create minimal combustion chamber surfaces by remodelling the chambers and fitting larger bore pistons, the ignition events are completely different. Part throttle situations are even harder to dial in, and so some lower cost indicator is a good starting point.

Is there any mileage in a parallel development, using a pressure sensor and comparing it with knock sensor output, after all knock is just a very sudden increase in combustion pressure, so in theory there should be some correlation. :idea:

Mike
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Knock Sensor Solution: TPIC8101

Post by racingmini_mtl »

jsmcortina wrote:See "Internal Combustion Engine Fundamental" by John B. Heywood, ISBN 0-07-100499-8
Section 9.6 Abnormal combustion : Knock and surface ignition
15.4.4 Chamber Octane Requirement

James
James,

Unfortunately, the cost of that book is astronomical.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
jsmcortina
Site Admin
Posts: 39621
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Knock Sensor Solution: TPIC8101

Post by jsmcortina »

racingmini_mtl wrote:Unfortunately, the cost of that book is astronomical.
Jean
Go for the paperwork, it is more reasonable. I seem to remember that the hardbook was a silly figure.

James
EDIT: Amazon UK has it used for £24.
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
piledriver
Super MS/Extra'er
Posts: 1681
Joined: Tue Oct 27, 2009 6:24 am
Location: Van Alstyne, Texas

Re: Knock Sensor Solution: TPIC8101

Post by piledriver »

I still have no response from the plug washer pressure sensor vendor from the other thread, I'm not buying 10000, so no info for you, apparently.
Sadly I did not lie.

The conditioned output of the pressure sensor could easily double as a knock sensor input.
A knock waveform will show the same amplitude/frequency characteristics.
Always doing things the hard way, MS2 sequential w/ v1.01 mainboard, LS2 coils. 80 mile/day commuter status.
bcrx7
Helpful MS/Extra'er
Posts: 110
Joined: Sun May 02, 2004 5:37 pm
Location: Vancouver, BC

Re: Knock Sensor Solution: TPIC8101

Post by bcrx7 »

racingmini_mtl wrote:
jsmcortina wrote:See "Internal Combustion Engine Fundamental" by John B. Heywood, ISBN 0-07-100499-8
Section 9.6 Abnormal combustion : Knock and surface ignition
15.4.4 Chamber Octane Requirement

James
James,

Unfortunately, the cost of that book is astronomical.

Jean
You can easily find a PDF version (at no cost) by searching google for the name of the book followed by "pdf" and the first link is the PDF at about 40mb!
1984 Mazda RX-7 GTM Class (BP Engine + BW-EFR 8374 Turbo Full COP/Sequential on MS3+MS3x)
1986 Toyota 4Runner (22RE running on MS2-Extra 3.2.1)
Post Reply