Automotive Knock Sensor Interface
Spilly
Posts: 26
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.
Software:
Link to my github page that contains source code: https://github.com/spillymon/TPIC
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. Ex: 12 tooth crank wheel gives engine position in 30 degree increments. Currently the program is able to do one degree increments with about 94% accuracy.
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.
This is the first public post 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. 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.
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.
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.
Software:
Link to my github page that contains source code: https://github.com/spillymon/TPIC
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. Ex: 12 tooth crank wheel gives engine position in 30 degree increments. Currently the program is able to do one degree increments with about 94% accuracy.
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.
This is the first public post 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. 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.
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.
Comments
I can see it not making much of a difference since an engine does not ignite all the fuel the moment the plug is fired. There it is a flame wave that starts at the plug. That is why engines are timed so the plug fires before top dead center (TDC). The plug fires, and by the time the flame goes from the plug, to the point to where there is enough gases to push the piston back down, the crank has moved 10-30 degrees. As the RPM's increase, the timiming has to advance. I have seen engines have a base timing of 20 degrees BTDC, and 50 degrees @5000 RPM BTDC. Racing engines that run on alcohol are even higher than that. In a top fuel dragster, there is so much fuel in the cylinders, that the engine is on the edge of hydro-locking.
Yes, that is common knowledge in the automotive world. When using a primarily petroleum based fuel, the maximum efficiency is found when having the ignition advance just shy of causing detonation. However, that is not the case when using a fuel mixture that contains a large percentage of alcohol (E85). I have been doing a bit of tinkering with automotive and motorcycle engine management since I was a teenager (currently 27 years old).
The ignition advance does vary with rpm, but it also varies with engine load, air temperature, combustion chamber temperature, compression ratio, boost pressure (if forced induction), fuel octane, etc. These varying conditions make it next to impossible to have a look-up table that compensates for all those variables, not to mention a sensor array to measure it all. The next best thing is to increase the ignition advance until detonation occurs. Then decrease the ignition advance. Then after a few crankshaft revolutions, begin to increase the advance again. That process is the feedback loop I refer to in the OP. It would not take much to modify the code to be able to identify what cylinder is detonating. This information could be used to decrease the ignition advance for only that cylinder.
Another thing is consider treating an engine cycle as 720 degrees since that is how often you get a cam signal. That makes decoding cylinders fairly easy as 2 cylinder engines fire a plug once every 360 degrees, 3 cylinders fire once every 240 degrees, 4 cylinders fire once every 180 degrees, 5 cylinders fire once every 144 degrees, 6's fire once every 120 and 8's fire once every 90... generally speaking; odd-fire engines can have significantly different firing patterns. Multiple cam signals are a bit more tricky unless you have a missing tooth on the crank wheel at which point the next cam signal is typically #1 cylinder, but that can vary too.
Agreed. I tried using the waitcnt function to do just that. I was having issues with it keeping up with just one degree increments. I ended up with a less taxing algorithm. It calculates a multiplier/ratio based on the difference of the given crank angle and the closest tooth before that angle. It then uses that multiplier/ratio on the previously recorded time between the two teeth. I'll have to post up some logic analyzer screen shots. It gets pretty darn close.
The code does take into account a full 720 degree cycle. Which is why it requires a cam sensor as well as a crank sensor. I have seen a few applications using a missing tooth crank wheel, but that only allows a 360 degree cycle (you don't know which of the two 360 degree cycles you are on). That would work, but you would not be able to determine which cylinder is knocking.
Really?? I do agree with you that setting the timing a few degrees before detonation is optimal, But I am concerned about higher RPM's. At higher RPM's, by the time the knock sensor noticed detonation, I would think the next plug would've already fired.
That is what you get out of the pump, and some racers use it (mostly ones who have to reuse parts.) Just FYI
And that's great. I have been apart of the automotive market since I was a child (currently 37), I work at a major automotive, and motorsports research and development facility, that has been apart of the formula1 circuit for decades. Where engines are EFI, and engines run at +12,000 RPM. I would think that with 100's of millions of dollars , years of experience, and some of the smartest minds available, someone would of thought of monitoring the knock sensor at higher RPM's.
Just a little FYI, most manufactures have removed the knock sensor from new cars. It is old technology, and with CDI, it is not really needed. Personally, I think that is what should be brought to the aftermarket. CDI offers amazing fuel economy, good emissions, excellent drivability, and the ability to have a wider torque range.
I am not trying to put the idea down. explore it, you never know.
I'm not saying that systems do not exist to monitor knock at high rpm's. Information on these systems seems to be proprietary and even the datasheet for the IC I'm working with has information removed according to TI. I'm simply trying to increase the resources that are openly available.
Just a quick search brought me to this ECU which is used for IZOD Indycar series that has 4 knock sensor inputs. http://www.mclarenelectronics.com/Products/Product/TAG-400i
I do not have any data on the response time of the knock sensor. I assume this would be based on the amount of time required for the vibration to reach the piezo element.
There are in combustion chamber pressure sensors currently available but are cost prohibitive for use in mass production. That is the only device I am aware of that could replace a knock sensor.
I can't work out how a capacitve discharge ignition system is going to have an affect on detonation. Could you explain?
Check "Ion Sense" ignition. It uses the spark plugs as sensors and can detect detonation. This is where many conventional / non-direct injection engines are going and there are efforts in the aftermarket to implement this too.
Direct injection will definitely help cool the temperatures inside the combustion chamber and allow for a more precise amount of fuel. But, you will still have the limitations of fuel octane.
Looking at Delphi's pdf on "Ion-Sense-Based Real-Time Combustion Sensing for Closed Loop Engine Control", it says they are using an in combustion chamber pressure sensor. From the limited research I have done, this pressure sensor is used to align the maximum pressure acceleration point with TDC. I would love to work one of those, but the last time I looked into them they were upwards of a thousand dollars USD for a single sensor. But, if you are buying 100's of thousands of sensor I'm sure they are a good bit cheaper.
Edit: I should have read a little further into the pdf. I see they are measuring the flame conductivity.
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.
I do not know that much about the inner workings of CD ignitions (capacitive discharge), what I do know is; Every high voltage coil (automotive, motorsports, etc..) produces a spark when the coil collapses. (using a old HEI ignition for example) when while the engine is running, the coil is charged, then when the plug needs to fire, the power is removed from the coil. The collapsing magnetic field creates a high voltage spark for the plug. Then, power is re-applied to the coil, and the magnetic field is charged up again waiting for the next plug.
With a CD ignition, the capacitor is used to store voltage for the coil. Then when the coil needs to charge, the capacitor can charge the coil faster, then just taking voltage from the battery. That allows higher RPM's to be achieved since it is taking the coil less time to charge, and it allows the coil to charge completely before it needs to fire. It also allows the plug to fire multiple times during the power stroke. That allows more or all the fuel to be burned.
That is exactly what I was talking about. I could've said GDI (Gasoline Direct Injection), or ADI (Alcohol Direct Injection), etc... CDI just covers all the variations of the technology, even though diesels have been doing it for long, long, long, LONG time....
Great!!! you figured out what I was talking about (I like to let others figure things like this out for them selves.) Like I said, its not a bad idea, and I did not want to discourage you from trying. But I know it would not work for current and future markets. But using it to expand knowledge and understanding of things is never a bad idea.
Just a little info about the parallax forums, there are some amazing and smart people on here. But there is only a hand full that think of a car as more than a way to get around. So getting answers could at times be hit or miss.
I have had a passion for cars, racing, etc.. for my whole life. And I am blessed to have a job where I get to see and work on cars that the public will never see. I have seen ideas that made me think "WHAT WRE YOU THINKING?!?!". But I also have seen ideas that make me think "THAT IS AWESOME". And usually the great ideas come from the ones that like cars. So keep pushing yourself, and you might just have one of those great ideas.
From my experience, that is case for the general population. There is nothing wrong with that as long as they have their own passions, which I believe everyone is entitled to.
I agree with you 100%