Silicon ChipA Knock Detector For The Programmable Ignition - June 2007 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Business energy use can be greatly reduced
  4. Feature: VAF’s New Soundwall by Ross Tester
  5. Feature: Turntables – Give ’em A Spin; Pt.2 by Barrie Smith
  6. Review: ADS Technologies "Instant Music" by Silicon Chip
  7. Project: 20W Class-A Amplifier Module; Pt.2 by Leo Simpson
  8. Project: A Knock Detector For The Programmable Ignition by John Clarke
  9. Project: Versatile 4-Input Mixer With Tone Controls by Jim Rowe
  10. Project: Fun With The New PICAXE 14-M by Stan Swan
  11. Feature: The Latest PICAXE Developments by Clive Seager
  12. Project: Frequency-Activated Switch For Cars by John Clarke & Julian Edgar
  13. Feature: A Flying Visit To CeBIT Australia 2007 by Ross Tester
  14. Vintage Radio: DC-To-AC Inverters From The Valve Era by Rodney Champness
  15. Book Store
  16. Advertising Index

This is only a preview of the June 2007 issue of Silicon Chip.

You can view 35 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Articles in this series:
  • Turntables – Give ’em A Spin (May 2007)
  • Turntables – Give ’em A Spin (May 2007)
  • Turntables – Give ’em A Spin; Pt.2 (June 2007)
  • Turntables – Give ’em A Spin; Pt.2 (June 2007)
Items relevant to "20W Class-A Amplifier Module; Pt.2":
  • Preamp & Remote Volume Control PCB for the Ultra-LD Mk3 [01111111] (AUD $30.00)
  • Speaker Protection and Muting Module PCB [01207071] (AUD $17.50)
  • 20W Class-A Amplifier Power Supply PCB [01105074] (AUD $20.00)
  • 20W Class-A Amplifier Module PCB, left channel [01105071] (AUD $15.00)
  • 20W Class-A Amplifier Module PCB, right channel [01105072] (AUD $15.00)
  • PIC16F88-I/P programmed for the Low Noise Stereo Preamplifier with Remote Volume Control (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the Low Noise Preamplifier with Remote Volume Control (Software, Free)
  • Speaker Protector and Muting Module PCB pattern (PDF download) [01207071] (Free)
  • 20W Class A Low Noise Stereo Preamplifier/Remote Volume Control PCB pattern (PDF download) [01208071] (Free)
  • 20W Class A Amplifier Module PCB patterns (PDF download) [01105071/2] (Free)
  • 20W Class A Amplifier Power Supply PCB pattern (PDF download) [01105073] (Free)
Articles in this series:
  • A 20W Class-A Amplifier Module (May 2007)
  • A 20W Class-A Amplifier Module (May 2007)
  • 20W Class-A Amplifier Module; Pt.2 (June 2007)
  • 20W Class-A Amplifier Module; Pt.2 (June 2007)
  • 20W Class-A Amplifier Module; Pt.3 (July 2007)
  • 20W Class-A Amplifier Module; Pt.3 (July 2007)
  • 20W Class-A Amplifier Module; Pt.4 (August 2007)
  • 20W Class-A Amplifier Module; Pt.4 (August 2007)
  • Building The 20W Stereo Class-A Amplifier; Pt.5 (September 2007)
  • Building The 20W Stereo Class-A Amplifier; Pt.5 (September 2007)
Items relevant to "A Knock Detector For The Programmable Ignition":
  • Programmable Ignition System main PCB [05104071] (AUD $10.00)
  • Programmable Ignition System Trigger Module PCB [05104072] (AUD $5.00)
  • Programmable Ignition System Hand Controller PCB [05104073] (AUD $10.00)
  • PIC16F88-E/P programmed for the Programmable Ignition System [ignprgm.hex] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the Programmable Ignition System (Software, Free)
  • Sample timing maps for the Programmable Ignition System (Software, Free)
  • Programmable Ignition System PCB patterns (PDF download) [05104071/2/3] (Free)
  • Programmable Ignition System front panel artwork (PDF download) (Free)
  • Knock Detector PCB [05106071] (AUD $7.50)
  • Knock Detector PCB pattern (PDF download) [05106071] (Free)
Articles in this series:
  • Programmable Ignition System For Cars; Pt.1 (March 2007)
  • Programmable Ignition System For Cars; Pt.1 (March 2007)
  • Programmable Ignition System For Cars; Pt.2 (April 2007)
  • Programmable Ignition System For Cars; Pt.2 (April 2007)
  • Programmable Ignition System For Cars; Pt.3 (May 2007)
  • Programmable Ignition System For Cars; Pt.3 (May 2007)
  • A Knock Detector For The Programmable Ignition (June 2007)
  • A Knock Detector For The Programmable Ignition (June 2007)
Items relevant to "Versatile 4-Input Mixer With Tone Controls":
  • Versatile 4-Input Mixer PCB pattern (PDF download) [01106071] (Free)
  • Versatile 4-Input Mixer panel artwork (PDF download) (Free)
Items relevant to "Fun With The New PICAXE 14-M":
  • PICAXE-14M BASIC source code for "Fun with the new PICAXE-14M" (Software, Free)
Items relevant to "Frequency-Activated Switch For Cars":
  • Frequency Switch PCB pattern (PDF download) [05car051] (Free)

Purchase a printed copy of this issue for $10.00.

K NOCK AK KNOCK DETECTOR For The Programmable Ignition System Use it to help program engine timing and/or to automatically retard the ignition timing in response to knock level The Programmable Ignition System would not be complete without the addition of engine knock sensing. This Knock Detector is useful for adjusting ignition timing maps and can also automatically retard the ignition timing if engine knock is detected. E NGINE KNOCK IS often a problem in cars and can cause serious engine damage if allowed to continue. In severe cases, knocking can burn holes in pistons and cause premature engine failure. And even when knocking is only light, it can reduce engine power. So how does knocking occur and what can be done about it? In a typical internal combustion engine, one or more pistons travel up and down inside cylinders to turn a crankshaft. As a piston rises inside its cylinder during the compression stroke, a mixture of fuel and air is compressed. In petrol and gas engines, 42  Silicon Chip this fuel-air mixture is then ignited to drive the piston as it starts its downward stroke. However, if the mixture is ignited too early, it will “push” against the piston as it rises towards top dead centre (TDC). If this ignition is early by only a small amount, then the engine will exhibit a knocking sound as the piston rattles within the cylinder. This effect is called “detonation”, “pinging” or “knocking”. Knocking is typically caused by the timing being too far advanced. It can also be caused by higher than normal operating temperatures or by using a lower octane fuel than normal. As a result, all modern cars with engine management systems are fitted with one or more piezoelectric knock sensors. These monitor for engine knock over specific frequency ranges and automatically retard the ignition timing if knocking begins to occur. This allows the ignition timing maps to be set close to the advance limits to ensure best performance. In addition, the use of knock sensors ensures maximum engine performance with fuels of different octane ratings, without damaging the engine. On vehicles that don’t have knock sensors, the ignition timing advance has to be set conservatively to prevent knocking. And if it does occur during driving, the only remedies are to ease off on the accelerator pedal or change down a gear. Knock detector If you are building the Programmable Ignition System (described in the March, April & May 2007 issues), then you will almost certainly want to add the Knock Detector described here. As siliconchip.com.au BY JOHN CLARKE in the designs used in modern cars, it detects and automatically corrects engine knock by retarding the timing advance at certain map sites. In addition, any detected engine knock can be displayed on the LCD Hand Controller. This makes the Knock Detector a handy tool when it comes to adjusting the programmed ignition maps in the Ignition Timing Module. As shown in the photos, all the parts for the unit are mounted on a small PC board and this is housed in the same case as the Ignition Timing Module. It takes its signal input from a commercial automotive knock sensor, while it’s signal output leads connect to the main board via a 2-way pin header. Power for the circuit is derived directly from the main board. The sensor unit itself is mounted on the engine block, to monitor the sounds from the engine. It comprises a piezo electric element that produces a signal when it detects vibration. This is mounted in a robust housing that’s suitable for the automotive environment. Basic scheme Fig.1 shows the general arrangement of the Knock Detector. In operation, the Main Features • • • • • • • • Simple add-on PC board Fits inside the Programmable Ignition System box Uses an automotive knock sensor Knock is indicated via the LCD Hand Controller display Five knock intensity levels displayed Single trimpot for sensitivity adjustment Optional automatic ignition retard Two RPM limits for knock detection output signal from the knock sensor is first fed to the Knock Detector circuit for processing. This processed signal is then fed to the Programmable Ignition Timing Module and displayed on the LCD Hand Controller. Signal processing is necessary because the knock sensor also detects all the other noises that the engine makes. This means that the wanted knock signal is buried amongst the sounds Fig.1: this diagram shows the general arrangement of the Knock Detector. The output signal from the knock sensor on the engine block is first fed to the Knock Detector circuit for processing. It’s then fed to the Programmable Ignition Timing Module and displayed on the LCD Hand Controller. Fig.2: the block diagram of the Knock Detector circuit. The incoming knock signals are first amplified and then bandpass filtered to remove unwanted engine noise signals. This processed signal is then rectified and filtered to provide a DC signal which is then fed to the Programmable Ignition Timing Module. siliconchip.com.au June 2007  43 Specifications Knock Input Range: 0-5V (0–1.25V no retard, 1.25-5V progressive retard – see Table 3). Knock Monitoring: monitored for the first 6ms after firing. This period is reduced at higher RPM to the start of dwell period. Knock Monitoring Limit: alternative 4000 RPM or 6000 RPM sensing limit. Ignition Retard Activation Period: a minimum of 10 sparks at the onset of knocking. Ignition Retard Hold Period: retard value reduced by 0.5° or 1° (depending on resolution setting) every 10 sparks until zero unless knocking re-occurs. produced by piston movement, valves and tappets opening and closing, and by various other operating parts both inside and outside the engine. This in turn means that some way of removing these unwanted signals is necessary. Fortunately, there are some strategies that can be used to separate out the knock signal from the rest of the noises. Block diagram Fig.2 shows the block diagram of the Knock Detector. As shown, the knock sensor output is first fed to an amplifier stage based on IC1c. Trimpot (VR1) is used to set the gain of this amplifier stage, to set the correct sensitivity for engine knock. According to the car manufacturers, engine knock signals generally only cover a narrow frequency range from about 4.8-6.4kHz. This means that we can more readily detect engine knock if we remove signals outside this range. That’s the purpose of the following high-pass and low-pass filter stages based on IC1b & IC1a. These only allow the frequencies of interest – ie, between 4.8kHz and 6.4kHz – to pass through. The resulting signal is then rectified by D2 and filtered to provide a DC signal voltage. This is then amplified by IC1d and fed to the Programmable Ignition Timing Module. However, that’s not the end of the signal processing, as further processing now takes place in the Ignition Timing Module itself. Engine knock only occurs when a piston is around top dead centre so if the signal is only monitored around this time, we can readily remove further unwanted noise. In practice, engine knock is monitored by the Programmable Ignition System for the first 6ms after ignition. However, at high RPM values, there is less than 6ms between successive plug firings and so the knock signal is monitored between each firing and the start of the dwell period. Another problem at high engine RPM, is that the knock signal is often swamped out by engine noise. This can lead to incorrect knock sensing. To prevent this happening, engine knock is only detected at the lower RPM ranges. This unit gives you the choice of monitoring engine knock up to 4000 RPM or up to 6000 RPM. Knock indication When engine knock is detected, the level is displayed on the LCD Hand Controller using an exclamation (!) mark. This is shown on the second line of the timing display, between the RPM site and the LOAD site values. The relative levels of knock are shown as variations on the width of this exclamation mark. For very low knock levels, a narrow single pixel wide exclamation mark is used. Successively higher levels of knock are then indicated by progressively wider exclamation marks. They range from “level 1” indication at one pixel wide through to “level 5” indication at five pixels wide. You can use this knock signal indication to determine the ignition timing sites where knocking occurs. The timing can then be retarded at those sites to minimise knocking. Note that knocking may be more severe when the engine is hot. Automatic retard An option within the Ignition Timing Module can be set to automatically retard the timing when knocking is Parts List 1 PC board, code 05106071, 96 x 55mm 1 engine knock sensor (available from an automotive wreckers) 2 2-way PC mount screw terminals 1 5mm ferrite bead (L1) (Jaycar LF-1250 or similar) 4 M3 x 12mm screws 4 6mm M3 tapped spacers 4 M3 nuts 4 3mm star washers 1 2-pin DIL socket (2.5mm spacing) 1 40mm length of 0.7mm tinned copper wire 1 2m length of automotive wire 44  Silicon Chip 1 100mm length of green medium duty hookup wire 1 200mm length of red medium duty hookup wire 1 47kW horizontal mount trimpot (code 473) (VR1) Semiconductors 1 LM324 quad op amp (IC1) 1 1N4004 (D1) 1 1N5819 Schottky diode (D2) 1 8.2V 1W zener diode (ZD1) Capacitors 1 470mF 16V electrolytic 2 100mF 16V electrolytic 1 1mF16V electrolytic 1 220nF MKT polyester 1 56nF MKT polyester 1 12nF MKT polyester 1 10nF MKT polyester 3 6.8nF MKT polyester 1 3.3nF MKT polyester 1 1nF MKT polyester 1 330pF ceramic Resistors (0.25W, 1%) 1 1MW 1 3.9kW 1 100kW 1 2.7kW 1 22kW 3 2.2kW 4 10kW 1 1kW 2 5.6kW 1 150W 1W siliconchip.com.au Circuit details Refer now to Fig.3 for the complete circuit details. The circuit designations all correspond to the designations on the block diagram (Fig.2), so the circuit should be easy to follow. Basically, a single LM324N quad op amp is used to perform all the amplification and filtering of the knock sensor signal. As shown, the signal from the knock sensor is loaded using a 10kW resistor reduce the tendency to pick up electrical noise. From there, the signal is AC-coupled to pin 10 of IC1c via a 1nF capacitor and inductor L1. The latter is included to reduce radio frequency (RF) signal pick-up. IC1c functions as a non-inverting amplifier stage, with gain set by trimpot VR1. It’s pin 10 input is biased to half-supply via a 1MW resistor and two 10kW resistors across the 8.2V siliconchip.com.au Fig.3: the circuit is based on a single LM324 quad op amp. IC1c amplifies the incoming knock signal, while IC1b & IC1a are the high-pass and low-pass filter stages. Diode D2 rectifies the bandpass filtered signal and feeds op amp IC1d which then drives the Programmable Ignition Timing Module. detected. The amount depends on the severity of the knock signal – the higher the knock signal, the greater the retard. If the timing map has been set up with 0.5° resolution, the retard ranges from 0.5° at light knock levels through to 6.0° at severe levels. Similarly, for the 1° resolution, the retard ranges from 1-12°. When knocking is detected, the ignition is retarded for a period of 10 sparks. The retard value is then decreased by either 0.5° or 1° (depending on the resolution) every 10 sparks until it reaches zero or until there is further detection of knock. This slow release of ignition retardation helps to prevent the knock level increasing to any more than a very light level. It does this because as retardation is reduced, a small amount of knock may again be detected and so the timing will again be retarded to eliminate this. If there is no knock signal, then the ignition timing reverts to normal until knock is again detected. Note that we do not advocate advancing the ignition timing map to the point where there is constant knocking and then relying on the knock retard feature to correct for this. Instead, the Knock Detector is just there as an insurance against excessive knock in unusual circumstances – eg, when the fuel octane rating is lower than normal or if the engine is abnormally hot or there is some other unusual operating condition. June 2007  45 Table 2: Capacitor Codes Value 220nF 56nF 12nF 10nF 6.8nF 3.3nF 1nF 330pF EIA Code   224   563   123   103   682   332   102   331 IEC Code 220n   56n   12n   10n   6n8   3n3   1n0 330p gain at high frequencies to prevent oscillation. IC1c’s output appears at pin 8 and is fed to pin 6 of IC1b via an RC filter network. IC1b functions as a 4.8kHz high-pass filter, as set by the 6.8nF capacitors and the 10kW & 2.2kW resistors in the input and feedback networks. Signals above 4.8kHz can pass through to the pin 7 output, while signals below this frequency are attenuated. In operation, any signals below 4.8kHz are attenuated by 40dB (100 times) per decade. So at 480Hz, the output level at pin 7 is some 100 times less than for signals above 4.8kHz, assuming the same level of signal is applied to the input to the filter. IC1b in turn feeds IC1a which is configured as a low-pass filter. This filter attenuates signals above 6.4kHz, as set by its associated 12nF & 3.3nF capacitors and the 5.6kW & 2.7kW resistors. As with IC1c, both IC1b and IC1a are biased at half-supply voltage (ie, Vcc/2) and so the output signal from pin 1 of IC1a swings above and below this point. Fig.4: follow this parts layout diagram to assemble the PC board. It should only take you half an hour or so to build but watch the orientation of all polarised parts (ie, the IC, diodes, zener diode & electrolytic capacitors). This view shows the fully-assembled module. It’s a good idea to secure the electrolytic capacitors using hot-melt glue around their bases, to prevent them from vibrating and breaking their leads . supply rail – ie, it is biased to 4.1V. This allows IC1c’s output to swing symmetrically above and below this 4.1V bias voltage. Depending on the setting of VR1, mF Code 0.22mF .056mF .012mF .01mF .0068mF .0033mF .001mF   NA IC1c can provide a gain of up to 48 times. The 1kW resistor and 56nF capacitor on pin 9 roll off the gain below 2.8kHz, while the 330pF capacitor across the 47kW trimpot rolls off the Rectifier stage Following IC1a, the signal is Table 1: Resistor Colour Codes o o o o o o o o o o o No. 1 1 1 4 2 1 1 3 2 1 46  Silicon Chip Value 1MW 100kW 22kW 10kW 5.6kW 3.9kW 2.7kW 2.2kW 1kW 150W 4-Band Code (1%) brown black green brown brown black yellow brown red red orange brown brown black orange brown green blue red brown orange white red brown red violet red brown red red red brown brown black red brown brown green brown brown 5-Band Code (1%) brown black black yellow brown brown black black orange brown red red black red brown brown black black red brown green blue black brown brown orange white black brown brown red violet black brown brown red red black brown brown brown black black brown brown brown green black black brown siliconchip.com.au JOIN THE TECHNOLOGY AGE NOW with PICAXE Developed as a teaching tool, the PICAXE is a low-cost “brain” for almost any project The knock sensor can be mounted directly on the engine head or attached to it via a bracket as shown here. Knock sensors are readily available secondhand from wrecking yards. AC-coupled via a 1mF capacitor to diode D2. This diode rectifies the signal, allowing only positive excursions of the waveform to pass through. The rectified signal is then filtered using a 22kW resistor and a 10nF capacitor. The 100kW resistor discharges the capacitor in the absence of signal. In practice, the 100kW resistor gives a discharge time of around 1ms. This time constant is long enough to smooth out the 4.8-6.4kHz signals but still short enough to quickly discharge the capacitor in the absence of a knock signal between cylinder firings. Finally, the rectified and filtered signal is fed to non-inverting amplifier stage IC1d. This operates with a gain of 4.9, as set by the 3.9kW and 1kW feedback resistors. In practice, it amplifies the DC signal at pin 12 from a typical maximum of 1.2V to 5.88V. Its output appears at pin 14 and is fed to the Ignition Timing Module via a 2.2kW current-limiting resistor. Power supply Power for the circuit is derived from the vehicle’s 12V ignition supply via reverse-polarity protection diode D1. In practice, this supply is picked up from the Ignition Timing Module’s PC board. Following D1, the power is fed via a 150W resistor to zener diode ZD1 siliconchip.com.au which regulates the supply rail to 8.2V. This rail is then filtered using a 470mF electrolytic capacitor and is used to power IC1. In addition, a half-supply rail is derived using two 10kW divider resistors. This is decoupled using a 100mF electrolytic capacitor and is used to bias IC1c, IC1b & IC1a, as indicated previously. A second 100mF electrolytic capacitor provides additional supply rail decoupling for IC1. Construction All the parts for the Knock Detector mount on a PC board coded 05106071 and measuring 96 x 55mm. Before assembly, check the PC board for correct hole sizes and that all the tracks are intact and that there are no shorts between tracks. Repair these if necessary. Fig.4 shows the assembly details. Begin by installing the resistors, using Table 1 as a guide to selecting the values. As usual, it’s also a good idea to check them using a digital multimeter, just to make sure. Next, install diodes D1 & D2, followed by zener diode ZD1. Be sure to install the correct part in each location and make sure they are all oriented correctly. IC1 can then be installed, again making sure it is oriented correctly. The capacitors can now all go in, starting with the smaller MKT and Easy to use and understand, professionals & hobbyists can be productive within minutes. Free software development system and low-cost in-circuit programming. Variety of hardware, project boards and kits to suit your application. Digital, analog, serial RS232, 1-Wire™, and I2C facilities. PC connectivity. Applications include: Datalogging Robotics Measurement & instruments Motor & lighting control Farming & agriculture Internet server Wireless links Colour sensing Fun games Distributed in Australia by Microzed Computers Pty Limited Phone 1300 735 420 Fax 1300 735 421 www.microzed.com.au June 2007  47 Fig.5: the Knock Detector PC board mounts on the case lid of the Programmable Ignition Timing Module and is wired to the main board and to the knock sensor as shown here. ceramic types (see Table 2 for the capacitor codes). Follow these with the electrolytics, taking care to orientate each one as shown on Fig.4. Finally, install VR1, the 4-way screw terminal block and inductor L1. The inductor simply consists of a tinned copper wire link fitted with a 5mmlong ferrite bead. Mounting details The Knock Detector PC board is mounted on the inside of the case lid used for the Ignition Timing Module. As shown in the photo, it must be positioned towards one side, so that it does not foul the Sensym manifold pressure sensor on the main PC board (if fitted). The first step is to mark out and drill four 3mm mounting holes in the box lid. That done, mount the PC board on 6mm-long stand-offs and secure it using M3 x 12mm screws, M3 nuts and star lockwashers. After that, it’s just a matter of run- ning the external wiring connections as shown in Fig.5. These include the +12V, GND and Output leads to the main board. The Input signal lead is run to the knock sensor via the cable gland in the side of the box. Mounting the knock sensor The knock sensor should mounted directly on the engine head if possible. If this is not easy to do, the next best option is to use a mounting bracket. This bracket must be solid enough so that it does not vibrate and cause false knock signals. In our case, we mounted the knock sensor via a bracket because the screw thread on the sensor was too large to directly bolt into the engine head. This worked quite satisfactorily and was sufficient to detect knock. Setting it up The setting-up procedure is quite straightforward. Just follow these steps: Table 3: Timing Retard vs Knock Intensity Displayed Knock Intensity Retard Range For 0.5-Degree Resolution Retard Range For 1-Degree Resolution 1 0.5-1.0 degree 1-2 degrees 2 1.5-2.0 degrees 3-4 degrees 3 2.5-3.0 degrees 5-6 degrees 4 3.5-4.5 degrees 7-9 degrees 5 5.0-6.0 degrees 10-12 degrees 48  Silicon Chip (1) In the settings mode for the Programmable Ignition, set the “Knock” option to OFF (this simply turns off automatic retard) and set the RPM limit to 4000 RPM. Alternatively, if your car’s engine spins out further than 6000 RPM, use the 6000 RPM maximum. Note, however, that you may need to revert to the lower limit if the engine is noisy enough to cause false knock detection above 4000 RPM. (2) Set VR1 fully clockwise. (3) Rev the engine up and down its range and slowly adjust VR1 anticlockwise until no knock is indicated during this procedure. This is done because the engine is unlikely to knock when just free revving and so we can set the sensitivity just low enough to prevent false knock indication due to normal engine noises. However, this setting should still be sufficiently sensitive to detect true engine knock if it occurs. Typically, engine knock can occur when an engine is in its mid-rev range and under load. Find any trouble spots that cause knocking and note the timing values for these RPM and Load sites. The timing at these sites can then be reduced until the knock level is minimised or removed. If you wish, the “Knock” option can now be set to ON using the LCD Hand Controller. This will enable the automatic knock retard feature in the Programmable Ignition. Table 3 shows the amount of retard for each of the displayed knock intensity levels. SC siliconchip.com.au