MR2 Owners Club Forum banner

Knock Sensor Solution: TPIC8101

1 reading
13K views 23 replies 7 participants last post by  Matt Cramer  
#1 · (Edited)
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 of sophisticated aftermarket knock detection systems 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.
 
#2 · (Edited)
Very cool project. You seem to be on the right track. Have you been able to do any real world testing yet? Is the system fully functional? Are you planning to leave this open source with wiring diagrams and assembly instructions provided?

You should post about this on the megasquirt forums. There are a lot of DIY hardware guys over there that could probably provide some good input.
 
#3 ·
Very cool project. You seem to be on the right track. Have you been able to do any real world testing yet? Is the system fully functional? Are you planning to leave this open source with wiring diagrams and assembly instructions provided?
I have done limited real world testing on the street. I hope to do some testing with an engine dyno. I may end up providing others with the hardware to do some testing for me.

Yes, the project will remain open source. Once I do a little more research on open source hardware licensing, I will be releasing all of the hardware information.
 
#4 ·
I started this project do to the lack of availability of sophisticated aftermarket knock detection systems.
I think that it is great to do something like this, but I disagree that there is a dearth of good aftermarket knock detection systems. I am aware of systems that operate on both the time and frequency domain AND are fully integrated into the engine management so that ignition retard on an individual cylinder basis, additional fueling on an individual basis, cam control to reduce dynamic compression, TVIS or intake tumbler control to reduce VE and boost retard can all be properly applied. These system are usually a little beyond the pocketbook of many MR2 owners, but they are available for under $2000.
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.
Not really. Most gasoline engines do not detonate above 6000 RPM. There is simply not enough time for even fairly unstable fuel to start a detonation event at these speeds. Put a stethoscope on a crappy engine sometime and do a pull on it with too much timing in the 4000-7000 range. You will hear the pings start at 4K and run up through 5K and then vanish regardless of what you do. You can melt the engine easily at high engine speeds, but you cannot beat it to a pulp with detonation.

Given that, any decent knock control system is going to let the tuner taper response off at higher engine speeds since there is nothing for it to see there.
 
#5 ·
I think that it is great to do something like this, but I disagree that there is a dearth of good aftermarket knock detection systems. I am aware of systems that operate on both the time and frequency domain AND are fully integrated into the engine management so that ignition retard on an individual cylinder basis, additional fueling on an individual basis, cam control to reduce dynamic compression, TVIS or intake tumbler control to reduce VE and boost retard can all be properly applied. These system are usually a little beyond the pocketbook of many MR2 owners, but they are available for under $2000.

Not really. Most gasoline engines do not detonate above 6000 RPM. There is simply not enough time for even fairly unstable fuel to start a detonation event at these speeds. Put a stethoscope on a crappy engine sometime and do a pull on it with too much timing in the 4000-7000 range. You will hear the pings start at 4K and run up through 5K and then vanish regardless of what you do. You can melt the engine easily at high engine speeds, but you cannot beat it to a pulp with detonation.

Given that, any decent knock control system is going to let the tuner taper response off at higher engine speeds since there is nothing for it to see there.
I suppose I should reword my statement about the lack of solutions. The aftermarket lacks a solution that is easily attainable for the average car geek. I ran into this when trying to find a knock solution for my megasquirt MS2.

I have personally experienced audible knock at 5k+ rpm with a Mazdaspeed 3 that had entirely too much ignition advance.

If knock disappears at 5k+rpm, why do 12,000+rpm Indy Car ecu's have four knock sensor inputs? http://www.mclarenelectronics.com/Products/Product/TAG-400i

Certainly there would be an operating speed that this would occur, however, I have yet to see any technical documentation pointing out a certain engine speed.
 
#6 ·
The aftermarket lacks a solution that is easily attainable for the average car geek. I ran into this when trying to find a knock solution for my megasquirt MS2.
I agree. I ran into the same problem. There are a few super basic solutions available, but none of them really work correctly. The only option is a JS Safeguard which sells for about $600 which might be out of the budget for a lot of people.

Personally I ended up getting a JS unit, but would love to see something similar made for the DIY crowd. Looking forward to your progress.
 
#7 ·
Taking a quick glance at the JS unit, I'm a bit suspicious that they are able to determine crank position with only the use of input from the igniter/coil(s). The angular speed could be estimated from this. However, when the igniter/coil(s) is/are fired it could be at a different engine position than the previous event if the ignition advance changed.

I'm not sure how much error would be involved in an algorithm like that. Although it may get you close enough.

Do you know if they are using the TPIC8101 IC? I would be interested to see a higher resolution picture of the board.

Do they have the user program the unit with information like cylinder bore size?
 
#9 ·
As long as a resonant type sensor for that specific bore size is used, it shouldn't cause problems. But, with a non-resonant type sensor, which picks up pretty much every noise in the engine compartment, and without an application specific bandpass filter, false triggering is highly likely.
 
#10 ·
Some comments and musings:
  • I'd be very interested in seeing someone test the efficacy of "windowing" -- everyone quotes "10-90 ATDC etc," does something close to that (10-40 often), no one EVER quantifies the Type I or Type II error (real knock missed/false knock reported) of NOT windowing. Let's face it, you want knock control to either (1) provide safety to your engine, or (2) provide the most-possible performance without grenading (those are not the same thing).
  • The TPIC8101, and its older Intersil cousin, are at their core programmable bandpass filters. Interesting you should recommend using a better bandpass filter in front of one.
  • If you really want to discriminate knock from noise, with a performance-bent (eliminate false positives as much as possible), looking at just the fundamental frequency ain't gonna cut it.
  • J&S does all it's processing in software on a general-purpose chip.
 
#11 ·
I'd be very interested in seeing someone test the efficacy of "windowing" -- everyone quotes "10-90 ATDC etc," does something close to that (10-40 often), no one EVER quantifies the Type I or Type II error (real knock missed/false knock reported) of NOT windowing. Let's face it, you want knock control to either (1) provide safety to your engine, or (2) provide the most-possible performance without grenading (those are not the same thing).
Windowing is simply reducing the chances of picking up other noise that makes it past the bandpass filter.

[*]The TPIC8101, and its older Intersil cousin, are at their core programmable bandpass filters. Interesting you should recommend using a better bandpass filter in front of one.
I certainly do recommend a bandpass filter in front of the TPIC8101 if using a non-resonant knock sensor. TI has indicated on several occasions that the TPIC8101 is not designed to be used with a non-resonant type sensor. So, the additional bandpass filter is a workaround.

If you really want to discriminate knock from noise, with a performance-bent (eliminate false positives as much as possible), looking at just the fundamental frequency ain't gonna cut it.
That's about as good as it gets without adding an in cylinder pressure sensor. These generally cost more for a single sensor than an aftermarket ECU (cost prohibitive). Also, ion-sensing technology looks promising. However, I have yet to see it implemented in the aftermarket (proprietary technology).

J&S does all it's processing in software on a general-purpose chip.
J&S doing all the processing in software is great. That still doesn't change the fact that resonant knock frequency varies with bore size. That makes for a wide range of frequencies.

I would be interested to see a picture/schematic that indicates part numbers used. There are a lot more IC's there than a micro-controller, probably a switch mode regulator, an eeprom, and a usb or other interface IC for programming.
 
#21 ·
Hmm. I can see that adjusting the window is effectively adjusting the time constant. However, wouldn't it be ideal to have a fixed value to avoid noise from valves opening and closing?

I'm in the middle of working on an algorithm to help deal with the limited number (32) of time constants by adjusting gain depending on RPM. There is also limited number (64) of gain selections, but, that will increase output consistency between time constants.
 
#23 ·
Just wanted to say that as a fellow EE student, I am in awe of your abilities! It's an undoubtedly clever project and I definitely agree that if you can pull this off properly it will be a great help to the low-end ECU market. Most of all, what a great learning experience! Just awesome work.