Silicon ChipWideband Air-Fuel Mixture Display Unit - November 2008 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Electrolysis of water in cars is a fuel economy mirage
  4. Feature: Playing With The AirNav RadarBox by Ross Tester
  5. Review: Jaycar’s Sun-In-A-Box Solar Lighting Kit by Stan Swan
  6. Feature: 50 Years Of The Integrated Circuit by Ross Tester
  7. Feature: How Oxygen Sensors Work by John Clarke
  8. Project: 12V Speed Controller/Lamp Dimmer by Leo Simpson
  9. Project: USB Clock With LCD Readout, Pt.2 by Mauro Grassi
  10. Project: Wideband Air-Fuel Mixture Display Unit by John Clarke
  11. Project: IrDA Interface Board For The DSP Musicolour by Mauro Grassi
  12. Feature: Robot-Operated Clarinet by Silicon Chip
  13. Vintage Radio: Those Mysterious Antenna Coils & Loop Antennas by Rodney Champness
  14. Book Store
  15. Advertising Index
  16. Outer Back Cover

This is only a preview of the November 2008 issue of Silicon Chip.

You can view 29 of the 96 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.

Items relevant to "12V Speed Controller/Lamp Dimmer":
  • 12V Speed Controller/Lamp Dimmer PCB [05111081] (AUD $5.00)
  • 12V Speed Controller/Lamp Dimmer PCB pattern (PDF download) [05111081] (Free)
Items relevant to "USB Clock With LCD Readout, Pt.2":
  • PIC18F4550-I/PT programmed for the USB Clock (Programmed Microcontroller, AUD $20.00)
  • Firmware (HEX file), source code, software and driver for the USB Clock [0411008A.HEX] (Free)
  • USB Clock PCB pattern (PDF download) [04110081] (Free)
  • USB Clock front panel artwork (PDF download) (Free)
Articles in this series:
  • USB Clock With LCD Readout, Pt.1 (October 2008)
  • USB Clock With LCD Readout, Pt.1 (October 2008)
  • USB Clock With LCD Readout, Pt.2 (November 2008)
  • USB Clock With LCD Readout, Pt.2 (November 2008)
Items relevant to "Wideband Air-Fuel Mixture Display Unit":
  • PIC16F88-I/P programmed for the Wideband Oxygen Sensor Display [0531108A.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the Wideband Air-Fuel Mixture Display Unit [0531108A.HEX] (Software, Free)
  • Wideband Air-Fuel Mixture Display PCB pattern (PDF download) [05311081] (Free)
  • Wideband Air-Fuel Mixture Display front panel artwork (PDF download) (Free)
Items relevant to "IrDA Interface Board For The DSP Musicolour":
  • DSP Musicolour IrDA Interface PCB pattern (PDF download) [10111081] (Free)

Purchase a printed copy of this issue for $10.00.

Wideband Air-Fuel Mixture Display By JOHN CLARKE Monitor your car’s air/fuel ratio as you drive This Wideband Oxygen Sensor Display can show your car’s airfuel ratio as you drive. It’s designed to monitor a wideband oxygen sensor and its associated wideband controller but could be used to monitor a narrowband oxygen sensor instead. Alternatively, it can be used for monitoring other types of engine sensors. W HY WOULD YOU want to monitor the air/fuel ratio as you drive? Well, for starters, it will allow you to save fuel since the display clearly indicates when the engine is running rich. When used in conjunction with a wideband oxygen sensor and controller, the air/fuel ratios shown on this unit are more accurate than can be obtained from the narrowband sensors that are typically used in cars and which are really only accurate close to the “stoichiometric” point (ie, the air/ fuel ratio at which there is just enough oxygen in the air to ensure complete combustion). Under normal driving, most engine management systems operate under “closed loop” control. This is where the air/fuel ratio from an oxygen sensor 58  Silicon Chip is monitored and controlled by the car’s engine control unit (ECU) to maintain a predetermined fuel mixture. This is usually stoichiometric but under light cruise conditions the mixture can go lean to improve fuel economy. Conversely, during acceleration, the air/fuel mixture in many cars is allowed to go rich to improve performance and is not under the control of the ECU. This is called “open loop” and the richness of the mixture depends on other factors such as the throttle setting and the injector opening period. By monitoring the air/fuel mixture display as you drive, you will quickly learn how to obtain the best economy. When climbing a hill, for example when the car would normally be running rich, you can ease off on the throttle just enough to return the ECU to closed-loop control and run at stoichiometric mixtures to reduce the amount of fuel used. In addition, when gear changes are required, you may find that changing earlier or later than normal will keep the engine running leaner for longer. Similarly, when travelling downhill without throttle, most cars shut off the injectors above a certain RPM limit, so that no fuel is used at all. When this happens, the display will show a very lean air/fuel ratio. Note, however, that the injectors are usually partially open below this RPM limit, to ensure a smooth engine response when the throttle is opened. This means that when travelling downhill, it may be better to drop down a gear to ensure complete siliconchip.com.au injector shut-off (and thus reduced fuel usage), rather than stay in a higher gear with the injectors slightly open. Diagnosing problems Once you’ve used this unit for awhile, you will soon learn what sort of readings to expect in every-day driving. Any subsequent variations from “normal” can then be interpreted as indicating a problem. For example, there could be a fault with the oxygen sensor, the wideband controller or the engine management unit. A problem with fuel delivery is another possibility. Oxygen sensors do wear out eventually, due to an accumulation of contaminants on the sensor tip. As a result, car manufacturers recommend that they be replaced after a specified number of kilometres (typically around 100,000km for a heated sensor type). A worn-out oxygen sensor becomes sluggish in its response and causes a number of problems including excessive fuel consumption, poor engine performance, accelerated catalytic converter damage and increased emissions. By monitoring your car’s air/fuel ratio as you drive, you can quickly discover abnormal operating conditions and have the sensor checked and, if necessary, replaced. Engine modifications This unit will also be invaluable if you are a car modification enthusiast. It will soon show whether or not the mixture is too lean during acceleration or too rich under cruise conditions and allow you to make adjustments accordingly. This can be particularly handy if you are swapping the ECU chip for an aftermarket type or if you are experimenting with the fuel injectors. It’s all too easy to damage an engine if the mixture is too lean under certain circumstances. Oxygen sensor types In order to monitor the air/fuel ratio, the vehicle must be fitted with an oxygen sensor. These are fitted to all vehicles that have fuel injection and engine management, although most cars use what is known as a “narrowband” oxygen sensor. For a detailed explanation on how oxygen sensors work and a description of the two basic types, refer to the article “Narrowband & Wideband Oxygen siliconchip.com.au Main Features & Specifications MAIN FEATURES • • • • • • • • • 3-digit LED display plus 7-segment bargraph. Linear display with 0-5V wideband range or 0-1V S-curve range. Alternative display switching (A or B readings for wideband values); petrol or LPG readings for narrowband S-curve. 0V and 5V endpoint value limit adjustments for both A and B displays. Decimal point positioning. Display leading zero suppression. Bargraph can be operated in dot, bar or centred-bar mode for wideband range. S-curve set-up allows for dot or centred bar styles. Display dimming with minimum brightness and dimming threshold adjustments. Quieting period used for input measurement to ensure accuracy. SPECIFICATIONS Power Supply: 6-15V <at> 240mA (full display brightness) Input Current Loading: less than ±1mA Digit Update Period: 250ms Bargraph Update Period: 30ms Wideband Display Reading Range: 0-999 Narrowband Display Reading Range: 11.8 to 20.6 for unleaded petrol with the stoichiometric ratio set for 14.7; 12.6 to 21.4 for LPG with stoichiometric at 15.5. The display shows an “L” for ratios below the lowest value and an “r” for ratios above the highest value. Sensors” on page 27 of this issue. In practice, the oxygen sensor is located in the exhaust system to monitor the exhaust gas after the fuel has been burnt in the engine. Basically, the fuel is mixed with air inside each cylinder prior to firing. This air/fuel ratio is varied under the control of the ECU in order to obtain the desired engine (and emissions) performance. Under light engine-load conditions, the engine is usually run with exactly the correct proportion of fuel and air to ensure complete combustion. When this happens, the air/fuel ratio is said to be “stoichiometric” and this ratio is typically 14.7 for unleaded petrol. Putting it another way, 14.7kg of air is mixed with each 1kg of the unleaded fuel to achieve the stoichiometric ratio. Note, however, that the stoichiometric ratio is different for different fuels because it depends on the chemical composition of the fuel and its combustion characteristics. For liquid petroleum gas (LPG), the stoichiometric +12V S-CURVE OUTPUT (SIMULATED NARROW-BAND SENSOR SIGNAL) Rcal Ip Vs/Ip Vs H– H+ +12V WIDEBAND CONTROLLER 0–5V AIR/FUEL RATIO SIGNAL INPUT 8.8.8. WIDEBAND DISPLAY WIDEBAND SENSOR Fig.1: here’s how the display unit is used with a wideband sensor and its associated controller. The narrowband S-curve output from the controller is fed to the engine management computer (see text). November 2008  59 NARROWBAND SENSOR +12V +12V +12V INPUT NARROWBAND S-CURVE OUTPUT HEATER 8.8.8. WIDEBAND DISPLAY SET FOR S-CURVE RESISTIVE SENSOR Fig.3: here’s how to use the display unit with a resistive sensor (eg, a temperature gauge). Fig.2: the original narrowband sensor fitted to the car can be used to directly drive the display unit if accuracy isn’t important. The display must be set to run in S-curve mode. tion the “lambda” (λ) value and it has a value of “1” at the stoichiometric point. Basically, the Lambda value is simply the actual air/fuel ratio divided by the stoichiometric ratio. This means that lean air/fuel ratios have a lambda greater than 1, while rich air/fuel ratios have a lambda that’s less than 1. In practice, air/fuel ratios are a compromise between driveability, engine power and the production of air pollutants. Air pollutants are also reduced using a catalytic converter. This converts nitrous oxides to nitrogen and oxygen, carbon monoxide (CO) to carbon dioxide (CO2) and the unburnt hydrocarbons into carbon dioxide and water. LED1 A BAR LED7 NON INVERTED: INVERTED: 0V 5V 2.5V 2.5V 5V 0V 0V 5V 2.5V 2.5V 5V 0V LED1 B CENTRED BAR LED7 NON INVERTED: INVERTED: C DOT Oxygen sensor display unit LED1 As shown in the photos, the SILICHIP Oxygen Sensor Display unit is housed in a small plastic case. It features a 3-digit LED display to show the air/fuel ratio plus a 7-segment bargraph which indicates the signal trend. Just three leads are used to connect the unit to you car: one for 12V power, another for the ground and the third for the signal. In addition, two more leads can be wired to switch the unit from one set of display values to another. Inside the box are four pushbutton switches located along the top edge of the PC board. These are used to initially set up the way the unit works. However, they are not normally used once the various settings have been made. Another feature of the unit is automatic display brightness. During daylight, the displays are driven to full brightness so that they can be easily seen. By contrast, as the ambient light dims, the display brightness is reduced so that they don’t become CON LED7 NON INVERTED: INVERTED: 8.8.8. 0V 5V 2.5V 2.5V 5V 0V Fig.4: this diagram shows the bargraph display options that are available when the display unit is operating in wideband mode: (a) bar; (b) centred bar; and (c) 13-step dot. In each case, the bargraph can also operate in inverted mode. value is typically 15.5 (ie, 0.8 greater than for unleaded petrol). During acceleration, the engine is commonly run with a rich mixture, meaning that more fuel is added to the air compared to that used in the stoichiometric ratio. As a result, the air/fuel ratio becomes lower in value. This rich mixture provides more power under load at the expense of fuel economy. Unburnt hydrocarbons When the mixture is rich, there is insufficient oxygen in the air/fuel mix60  Silicon Chip ture to provide complete combustion. As a result, unburnt hydrocarbons are present in the exhaust gas. Conversely, when the engine is running in cruise conditions, the fuel supplied to the engine can be reduced to produce a “lean” mixture, so that there is residual oxygen in the exhaust. This is done to improve fuel economy and results in an air/fuel ratio that’s slightly higher than stoichiometric. Another way of specifying the air/fuel ratio is to “normalise” the stoich­ iometric value so the ratio is referenced to 1. We call this normalisa- siliconchip.com.au What Type Of Oxygen Sensor To Use A wideband oxygen sensor also requires the use of a wideband controller unit, such as this Tech edge WB02 2J1. It provides a 0-5V output which is fed to the Oxygen Sensor Display unit, plus a simulated narrowband S-curve output that’s fed to the engine management computer. V IRTUALLY ALL CARS come fitted with narrowband oxygen sensors and if you want to save money and accuracy isn’t important, you can use the existing sensor with the SILICON CHIP Oxygen Sensor Display. That said, it’s best to substitute the Bosch LSM11 narrowband oxygen sensor, since the display unit is calibrated for this sensor in narrowband mode. Conversely, if you want high accuracy, you must use a wideband oxygen sensor such as the Bosch LSU 4.2. This must be teamed with a wideband controller that gives a 0-5V output. Such controllers include the Tech Edge WB02 2J1 (http://wbo2.com/home/products.htm) and the Innovate Motosports LC-1 (http://www.innovatemotorsports.com/products.php). Alternatively, we intend to publish a wideband controller in a future issue of SILICON CHIP. At present, there are only a few vehicles such as Audi and VW that have factory-fitted wideband sensors, so the chances are that you will have to buy a wideband sensor and fit it. In most cases, all you have to do is remove the existing narrowband sensor, substitute the wideband sensor and team it with a wideband controller. The simulated narrowband S-curve output from the wideband controller is then connected to the vehicle’s engine management computer. This replaces the signal from the original narrowband sensor and allows the engine to operate normally – see Fig.1. The 0-5V output from the wideband controller unit is connected to the display unit which then provides accurate air/fuel mixture readings. distracting, particularly at night. Fig.1 shows how the unit is used with a wideband sensor and its associated controller. As can be seen, the 0-5V output from the controller provides the air/fuel ratio signal for the Oxygen Sensor Display. In addition, a wideband controller usually has a simulated S-curve output and this can be used to replace the signal from the original narrowband sensor for the engine management computer. siliconchip.com.au By using the 0-5V signal from the controller, the display unit can be set up to show the air/fuel ratio over a set range. For example, it could be set to show air/fuel ratios between 7.4 and 22.0. These values are set to match the 0-5V range from the wideband controller, with the unit responding in a linear fashion. That’s not all it can do though. Basically, this unit can be set to display what ever values you wish. For ex- Control Systems POSITION VACANT SENIOR ELECTRONICS DESIGN ENGINEER Have a proven record in designing Analogue, Digital & Power Electronics for 7 years or more? Willing to manage projects and supervise Junior Engineers? This will be a perfect career opportunity for you in Sydney. To apply, visit “careers” on www.dynalite.com.au or email your resume and cover letter to hr<at>dynalite.com.au November 2008  61 REG1 LM2940CT-5 +12V IN OUT 220 F 10V 105 C GND 470nF +5V 0V 2.2k 14 Vdd 1 AN2 4 MCLR INPUT 2.2k 3 100nF 16 RA1 15 RA6 18 RA0 17 RA7 AN4 10nF IC1 PIC16F88-I/P +5V RB5 K A K A K A K A K A 6 RB0 8 RB2 7 RB1 10 RB4 13 RB7 22k 2 11 AN3 12 RB6 9 RB3 LDR1  10k +5V MODE S1 6 4 2 1 a b c d f C 3 A a 3 A a 3 A a b b g dp d f b c b g d e d c dp DISP1 LTS542R 5 c a 8 f g fe fe c d dp dp d g b DISP2 LTS542R c dp dp DISP3 LTS542R SC  2008 WIDEBAND OXYGEN SENSOR DISPLAY 12 K  A a  b  c  d  e  f  g  dp  LED4 LED1 LED8 LED6 LED5 LED3 LED2  A K LED7 DISP4 10-LED BAR ARRAY 10 LM2940CT Q4 C e g E B Q3 C a S4 E B Q2 C e 9 e f 10 g 5 UP S3 E B Q1 4x 2.2k 7 S2 E B 8x 100 DOWN SELECT ALTERNATIVE DISPLAY SWITCH GND Q1–Q4: BC327 76 34 5 B IN GND OUT E C Fig.5: the circuit is based on a PIC16F88-I/P microcontroller (IC1). This processes the sensor signal at its AN4 (pin 3) input and drives three 7-segment LED displays and an 8-LED bargraph in multiplex fashion. ample, it could be set to show lambda values from say 0.51 to 1.50 instead. Alternatively, you can set it up to display either the air/fuel ratio or the lambda value at the flick of a switch. In that case, there are two sets of values labelled “A” and “B” and you select between them. Similarly, for cars that run on both unleaded petrol and LPG, it’s possible to switch the unit so that it displays the correct air/fuel ratio for the selected fuel. Narrowband sensor Fig.2 shows how the unit is used with a narrowband oxygen sensor. In this case, the display includes a preset response for the standard Bosch LSM11 narrowband oxygen sensor and shows the air/fuel ratio for unleaded petrol from 11.8 to 20.6 (stoichiometric at 14.7). For air/fuel ratios below 11.8, the display shows an “r” for rich while ratios above 20.6 give an “L” for lean. Similarly, for LPG, the range is 12.6 to 21.4 (stoichiometric at 15.5), with an “r” shown for ratios below 12.6 and an “L” for ratios above 21.4. 62  Silicon Chip One option here is to have a dot or a centred bargraph display for the S-curve narrowband mode. For more information on this, refer to the panel titled “Using The Unit With A Narrowband Sensor”. If the output from the sensor does not cover the full 0-5V range, then the values set at the 0V and 5V end points are obtained by extrapolation. This involves first drawing a graph similar to Fig.9 or Fig.10 that shows two points that correspond to the output from the sensor and their corresponding values. The graph is then extended until it reaches the 0V and 5V points. The values that are obtained at the 0V and 5V points are the endpoint values that need to be entered into the display during the setting up procedure. Bargraph display As indicated previously, the LED bargraph shows the sensor the voltage level and is useful for indicating the voltage trend. Its response to voltage changes is significantly faster than that of the digital display which is deliberately slowed down so that the values can be easily read. Fig.4 shows the three bargraph display options that are available in the wideband operating mode. Note that although a 10-LED bargraph display is used, only seven LEDs are used in these displays. Fig.4(a) shows the “Bar” display mode. Here, the number of LEDs lit increases from one to seven over six steps in response to a rising sensor voltage. Alternatively, it can be set up to increase the number of LEDs lit in response to a falling sensor voltage (ie, an inverted display). The “Centred Bar” mode is displayed in Fig.4(b). In this mode, the centre bar is always lit (2.5V sensor output), with the bar then extending either up or down in response to a rising or falling sensor voltage. Once again, an inverted display option is available. This option is the most useful when showing the air/fuel ratio, with the bars indicating as the mixture moves into either rich or lean ratios. The centre bar is the stoichiometric point. Finally, Fig.1(c) shows the “Dot” mode option. In this case, there are siliconchip.com.au Using It As A General-Purpose Display B ecause it’s based on a microcontroller, this unit can also be used as a general-purpose display to monitor other sensors (ie, you don’t have to use it with an oxygen sensor). Basically, it can display any number ranging from 0-999 in response to any sensor with a 0-5V output signal. You can set it up so that the display either increases in value as the sensor output voltage increases or set it so that the display decreases in response to rising sensor voltages. A decimal point can also be included and can be positioned after the first or second digit. If no decimal point is selected, then the display features leading zero blanking. This means that a value of 007, for example, will be displayed as 7, while a value of 021 will be displayed as 21. Similarly, if the decimal point is positioned after the second digit, a value of say 00.2 will be shown as 0.2. This decimal point selection and zero blanking feature also applies when displaying air/fuel ratios from a wideband controller. 13 levels, with either one or two LEDs being lit as the sensor voltage varies. As with the previous two modes, an inverted display option is available. Circuit details Despite its versatility, the circuit for the Wideband Oxygen Sensor Display is really very simple. Fig.5 shows the details. As shown, it’s based on a PIC16F88I/P microcontroller (IC1), with most of the clever stuff hidden inside its firmware program. Apart from that, there are the three 7-segment LED displays (DISP1-DISP4), the 10-LED bargraph display, four driver transistors (Q1Q4), a 3-terminal regulator (REG1) and a few sundry bits and pieces. IC1’s monitors the input voltage from the sensor, processes the data and drives the LED displays to show the calculated air/fuel ratio value. Output ports RB0-RB7 drive the display segment cathodes, while transistors Q1-Q4 switch the common display anodes, ie, the displays are multiplexed so that only one display digit is driven at any given time. Note that all the segments common to each display are tied together. For example, the “a” segment of DISP1 connects to the “a” segments of DISP2 and DISP3. In addition, LED4 within the LED bargraph (DISP4) also connects to the “a” segments of DISP1DISP3. These “a” segments are driven via the RB5 output of IC1 via a 100Ω resistor. As a result, when this output is low, the “a” segment in one display will light, depending on which driver transistor is turned on. siliconchip.com.au PNP transistors Q1-Q4 are driven by ports RA0, RA1, RA6 & RA7 via 2.2kΩ resistors. For example, transistor Q1 is controlled by RA1 and when this output is high, Q1 is held off. Conversely, when RA1 goes low (0V), Q1’s base is pulled low via its 2.2kΩ resistor and so Q1 turns on. As a result, any segments within DISP1 that have their cathodes pulled low via IC1’s RB outputs (and their respective 100Ω resistors) will now light. Transistors Q2, Q3 and Q4 are driven in a similar manner to Q1 to control DISP2, DISP3 and the LED bargraph (DISP4). For example, to light DISP2, we switch off Q1, set the required segment driver outputs required for the DISP2 display and then switch on Q2 by taking RA6 low. A similar process is then used to switch on DISP3 and DISP4 in turn. This on-off switching of the displays is done at such a fast rate (around 2kHz) that the displays all appear to be continuously lit. Parts List 1 PC board, code 05311081, 80 x 50mm 1 plastic case measuring 83 x 54 x 31mm 1 rectangular piece of red clear Perspex 48 x 18mm 4 SPDT micro tactile switches with a 6mm actuator (S1-S4) 1 LDR with 48kΩ light resistance 1 DIP20 IC socket, 0.3-inch width 1 DIP18 IC socket 1 DIP16 IC socket 1 DIP14 IC socket 1 M3 x 10mm screw 1M3 nut 5 PC stakes 1 2m length of twin shielded wire Semiconductors 1 PIC16F88-I/P microcontroller coded with 0531108A.hex (IC1) 3 13mm common anode LED displays (DISP1-DISP3) 1 10-LED DIL bargraph (DISP4) 4 BC327 transistors (Q1-Q4) 1 LM2940CT-5, +5V low dropout regulator (REG1) Capacitors 1 220μF 10V electrolytic 1 470nF MKT polyester 1 100nF MKT polyester 1 10nF MKT polyester Resistors (0.25W, 1%) 6 2.2kΩ 1 10kΩ 1 22kΩ 1 5 x 100Ω individual SIL resistor array 1 3 x 100Ω individual SIL resistor array Display dimming Light dependent resistor LDR1 is used to sense the ambient light to control the display dimming. This is connected in series with a 22kΩ resistor to form a voltage divider across the +5V rail and its output is fed to IC1’s AN3 port. When the ambient light is high, the LDR has a low resistance and the voltage at the AN3 input is pulled down close to 0V. Conversely, in low ambient light, the LDR has a high resistance and IC1’s AN3 input is pulled close to the +5V rail via the 22kΩ resistor. At intermediate light levels, AN3 will sit somewhere between 0V and +5V. In operation, IC1 dims the displays in response to its AN3 voltage. It does this by limiting the amount of time that the displays are lit. In bright light, each display is lit for almost 25% of the total time but this reduces as the AN3 voltage rises in response to falling light levels. In fact, at very low levels, each display might only be lit for about 2% of the time. Pushbutton switches Switches S1-S4 allow the unit to be November 2008  63 100nF 3 x 100  SIL ARRAY 2.2k 10nF DISP1 Q4 Q3 2.2k DISP2 2.2k DISP3 ALTERNATIVE DISPLAY SWITCH DISP4 10k Q2 2.2k IC1 PIC16F88-I/P 22k 2.2k LDR1 S4 S3 Q1 18011350 d n a b e di w S2 S1 220 F 5 x 100  SIL ARRAY 470nF REG1 2940-5 2.2k GND IN +12V NOTE: DISP1–DISP4 ALL MOUNTED IN IC SOCKETS (SEE TEXT) Fig.6: install the parts on the PC board as shown here. The alternative display switch is optional (see text). Take care to ensure that all the parts are installed on the PC board with the correct orientation. The LED bargraph is mounted with its bevelled edge at bottom right (see Fig.6). Oxygen Sensor Display DISPLAY CUTOUT SILICON CHIP www.siliconchip.com.au This view shows the PC board before the 7-segment LED displays and the bargraph are plugged in. programmed by providing the Mode, Select, Down & Up functions. These are connected respectively to the bases of transistors Q1-Q4, while the other ends are commoned and connected to the +5V rail via a 10kΩ resistor. This commoned end is also connected to IC1’s AN2 input, which monitors the switches. If switches S1-S4 are all open, IC1’s AN2 input will be held at +5V via the 10kΩ pull-up resistor. However, if a switch is closed, AN2 is connected to the base of its corresponding transistor. As a result, the voltage on the AN2 input will drop to about 0.6V below the +5V rail (ie, to 4.4V) each time Fig.7: this full-size artwork can be used as a drilling template for the front panel. that particular transistor switches on. In operation, the microcontroller periodically checks the voltage at its AN2 input. As a result, it can decide if a switch has been closed based on the AN2 voltage and then determine which switch it is by checking which transistor is currently switched on. The optional external Alternative Display Switch is connected in parallel with switch S4. This switch can be a dashboard toggle switch so that, for example, either the air/fuel ratio or the lambda value can be shown. Alternatively, it can be a relay contact that automatically opens or closes depending on the fuel (eg, petrol or LPG). Note that this switch is not required if the display only needs to show one set of values. Input signal The signal from the sensor is fed to the AN4 pin of IC1. IC1 converts this input voltage into a 10-bit digital Table 2: Capacitor Codes Value 470nF 100nF 10nF μF Code IEC Code EIA Code 0.47μF 470n 474 0.1μF 100n 104 0.01μF   10n 103 Table 1: Resistor Colour Codes    o o o o o No.   6   1   1   8 64  Silicon Chip Value 2.2kΩ 10kΩ 22kΩ 100Ω 4-Band Code (1%) red red red brown brown black orange brown red red orange brown brown black brown brown 5-Band Code (1%) red red black brown brown brown black black red brown red red black red brown brown black black black brown siliconchip.com.au 100  1/4W RESISTORS MOUNTED END-ON How The Micro Calculates The Values 5V VALUE 22.0 (EXAMPLE) PC BOARD ALTERNATIVE TO USING RESISTOR ARRAYS Fig.8: separate 100W resistors can be used instead of the two resistor arrays. Mount them as shown here. value which is then processed and the resulting calculation fed to the display. A 2.2kΩ current-limiting resistor and internal clamping diodes inside IC1 protect the AN4 input should the input voltage go above the +5V supply or below the 0V rail. The associated 10nF capacitor filters any voltage spikes at the input. A feature of unit is that it switches off all the displays for a short period before measuring the input voltage. This minimises any voltage drops that could occur due to supply current in the ground wiring if the displays were lit and ensures accurate measurements. Timing for IC1 comes from an internal oscillator running at 4MHz. This has an accuracy of about 2% which is close enough for this application, as the timing is not critical. Power supply Power is derived from the vehicle’s fused ignition supply. This +12V rail is fed to a low-dropout LM2940CT-5 +5V regulator. These regulators are designed for automotive applications and are protected against line transients and reverse supply voltage (if the supply is reversed, the output remains at 0V and no damage occurs). A 470nF capacitor decouples the supply for the regulator input, while a 220μF capacitor filters the +5V output. This output capacitor supplies the transient current required for the displays and also prevents the regulator from becoming unstable. In addition, the supply rail to IC1 is decoupled using a 100nF capacitor at pin 14. The 2.2kΩ resistor between IC1’s MCLR-bar input (pin 4) and the +5V rail provides the power-on reset signal for IC1. Construction This unit is easy to assemble, with all parts installed on a double-sided PC siliconchip.com.au WHEN THE 5V VALUE IS GREATER THAN THE 0V VALUE: SPAN x 2.5 ((22.0 – 7.4) ) + 7.4 = 14.7 5V 7.4 (EXAMPLE) 0V VALUE 0V 2.5V 5V Fig.9: this graph shows how IC1 calculates the display values when the 5V endpoint value is greater than the 0V endpoint value. This example uses 7.4 and 22.0 for the 0V and 5V endpoint values respectively, giving a 2.5V sensor output value of 14.7 (ie, stoichiometric for unleaded petrol). 0V VALUE 22.0 (EXAMPLE) WHEN THE 5V VALUE IS LESS THAN THE 0V VALUE: (22.0 – 7.4) x (5V–2.5V) + 7.4 = 14.7 5V ( SPAN 7.4 (EXAMPLE) 5V VALUE 0V ) 2.5V 5V Fig.10: the equation is slightly different when the 0V endpoint value is greater than the 5V endpoint value. In this example, 22.0 has been used for the low endpoint value, while 7.4 has been used for the high endpoint value. To set the values for the display, you only need to set the endpoint values at 0V and at 5V. The internal microcontroller then processes the input signal and calculates the correct vales for display. For example, if the 0V endpoint value is 7.4 and the 5V endpoint value is 22.0, a 2.5V input will give a display reading of 14.7 for the air/fuel ratio. This is calculated by first subtracting the low endpoint value from the high endpoint value to get the span value (in this case, 22 - 7.4 = 14.6). This span value is then multiplied by the input voltage, divided by the 5V range and finally added to the low endpoint value (7.4 in our example). Fig.9 shows this in graphical form. If the unit is set up so that the 0V endpoint value is higher in value than the 5V endpoint value, then the calculation is different (see Fig.10). In this case, the 5V endpoint value is subtracted from the 0V endpoint value to get the span value. This value is then multiplied by the difference between the input voltage and 5V, after which the result is divided by 5V and added to the 5V endpoint value. Fig.10 shows the equation for endpoint values of 22 and 7.4. Note that in both cases, the 5V value assumes that the reference voltage used in the Oxygen Sensor Display is exactly 5V. However, the reference voltage from the regulator that’s used could be anywhere from 4.85-5.15V so there is an adjustment to compensate for this. If the reference voltage is below 5V, then the Oxygen Sensor Display will not show readings for input voltages that are higher than this reference. Conversely, if the reference is above 5V, then the unit will show readings for input voltages only up to the +5V. By compensating for this reference voltage, the correct value will be shown on the display. In practice, the regulator used for the reference is trimmed during manufacture and its output will probably be very close to +5V. November 2008  65 Changing The Wideband Display Settings T HE FOUR PUSHBUTTON switches inside the case are for Mode (S1), Select (S2), Down (S3) & Up (S4). Pressing the Mode switch initiates the Settings mode. Pressing it again then returns the display to the normal Run mode so that it shows the values in response to the input voltage. Once in the Settings mode, you can alter the way the display operates. You can set how the dimming works, set the regulator voltage, alter the “A” or “B” values selection and alter the 0V & 5V endpoint values for each selection. In addition, you can change the bargraph display from dot to bar or to a centred bar. The bargraph is used to indicate which setting is selected. In this mode, the lower LED (LED8) is always lit – see Fig.11 (note: LED8 is never lit in the normal run mode). The remaining LEDs on the bargraph show which setting has been selected (see Fig.11). Note that there are 10LEDs on the bargraph but only the middle eight (designated LEDs1-8) are used. You cycle through the settings by pressing the Select switch (S2). Minimum Display Brightness: when LED7 is lit, the setting is for the minimum display brightness that occurs when the LDR is in complete darkness. This value is initially set at “14”, as shown on the display. When adjusting this value, it’s necessary to cover the LDR so that it does not receive any ambient light either from below or above its surface. A black film canister is ideal for this and the value is adjusted using the Up & Down switches to set the desired minimum brightness. The absolute minimum brightness is reached at 0 but typical settings would range from 10-30. Dimming Threshold: pressing the Settings switch again brings up the Dimming Threshold setting, with LED6 lit. This is initially set at 200 and determines the ambient light level below which dimming begins. Increasing the value means that dimming begins at a higher ambient light level, while decreasing the value sets the dimming to begin at a lower light level. Regulator Voltage: the next setting is for the Regulator Voltage (LED5 lit). This value is initially set at 5.00V and is normally adjusted (using the Up & Down switches) to agree with the actual regulator output voltage, as measured between its OUT and GND terminals. A Or B Display: LED4 indicates the A or B Display selection. Here, you can select between the “A” and “B” display values. If “A” is selected, then the normal Run mode will show the “A values and the “B” value can be shown by pressing S4 (Up) or by using the external alternative display switch. Alternatively, if the “B” values are selected, the display will show these in Run mode and the “A” values will be shown if S4 is press (or the external switch is toggled). Display Format: the Display Format is next in the sequence (LED3 lit). In this case, the digital display will show A.AA, AA.A or AAA for the “A” selection. You can select the decimal point position using the Up or Down switches. Similarly, if the “B” values have been selected, the display will show b.bb, bb.b or bbb. 0V Display Value: pressing S1 again to light LED2 selects the 0V Display Value. This is the value that’s displayed in Run mode when the input is at 0V and it can be set to any value from 0-999. Note that this value will be for the “A” display if this was previously selected in the “A Or B Display” option. Alternatively, this value will be for the “B” display if this was previously selected in the display option. Note that where the “A” and “B” displays both need to be set, it will be necessary to temporarily change the display option from “A” to “B” or from “B” to “A” and also set the required Display Format before adjusting the endpoint value to suit the alternate display. 5V Display Value: this setting is indicated when LED1 is lit. Again, you can set this to any value from 0-999 and the same comments as above apply to setting values for both “A” & “B” displays. It’s important to note here that the 0V and 5V values must match the output from the wideband controller. This means that if you set the wideband board with plated-through holes. This board is coded 05311081 (80 x 50mm) and is housed in a small plastic case measuring 83 x 54 x 31mm. Begin by checking the board for any defects and by checking the hole sizes for the major parts. Check also that the PC board is cut and shaped to size so that it clips into the integral side slots in the case. Fig.6 shows the parts layout. Install the resistors first, taking care to place each in its correct position. Table 1 shows the colour code values but you should also use a digital multimeter to check each resistor before installing it. Note that the 100Ω resistors are in single in-line (SIL) resistor arrays. However, you can also use standard 0.25W resistors here and these can be installed by mounting them end-on as shown in Fig.8. Next, install the PC stakes. These are installed from the underside of the PC board at the three external wiring positions (the external wiring connects to the rear of the board). Transistors Q1-Q4 can go in next and these must be installed so that their tops are no higher than 12mm above the PC board. Follow them with the four switches (S1-S4). These switches can only go in with the correct orientation so if the holes don’t line up, simply rotate them by 90° REG1 is next on the list. This device mounts horizontally on the PC board, with its leads cranked down through 90° so that they pass through their corresponding holes. Secure its tab to the board using an M3 x 6mm screw and nut before soldering its leads. Once it’s in, install the capacitors. Note that 220μF electrolytic adjacent to REG1 is installed with its leads bent through 90°. Its body lies horizontally across the regulator’s leads as shown in the photo. 66  Silicon Chip Mounting the displays The 7-segment LED displays and the 10-LED bargraph are raised up off the PC board using IC sockets. The sockets for the 7-segment dissiliconchip.com.au LED1 (ALL LIT) DOT, BAR OR CENTRED BAR LED8 LED1 LED8 SETTINGS INDICATOR (LEDS1–7 INDIVIDUALLY LIT ACCORDING TO SELECTION) 5V DISPLAY VALUE 0V DISPLAY VALUE DISPLAY FORMAT A OR B DISPLAY REGULATOR VOLTAGE DIMMING THRESHOLD MIN DISPLAY BRIGHTNESS SETTINGS INDICATOR Fig.11: this diagram shows the bargraph setting indications for the default wideband operating mode. controller to deliver air/fuel ratios over a range of 7.4 to 22.0, then the display should also be set to these values. If you want to have the stoichiometric value in the middle of the scale (so that the bargraph display is centred), then the sum of the 0V endpoint value and the 5V endpoint value must be twice the stoichiometric value. So if the stoichiometric air/fuel ratio is 14.7, the 0V endpoint value and the 5V endpoint value must add up to 29.4 – eg, you could use 7.4 and 22.0 as the endpoints. If you intend to display the lambda value, then the minimum and maximum values must add up to 2 (eg, 0.52 and 1.48 could be used but other values could be used instead). Bargraph Display Option: the final selection brings up the Bargraph Display Option and in this case all eight LEDs are lit. Again, the options are selected plays are made using a 16-pin DIP socket and a 14-pin DIP socket. These are cut into strips of two 8-pin and two 7-pin SIL sockets using a small hacksaw. One 8-pin and one 7-pin strip is then installed along the top edge of the display positions, while the remaining 8-pin and 7-pin strips are installed along the bottom edge (ie, the sockets form two 15-pin strips). Once these SIL strips are in, install a 20-pin DIP socket for the LED bargraph and an 18-pin DIP socket for IC1. Be sure to orientate the socket for IC1 with its notched end towards the top (ie, towards the 2.2kΩ resistor). Don’t plug the displays or IC1 in yet, though Finally, install the LDR (either way siliconchip.com.au using the Up & Down switches and are as follows: (1) dot (shown as doT on the display); (2) bar (shown as bAr on the display); and (3) centred bar (shown as bCn). Note that the “T” in the doT lettering has the lefthand side of its cross piece located over the “o”. The default setting for the bargraph display is to have the LEDs progressing upwards with increasing sensor output voltage. Conversely, if you want them to progress upwards with a falling sensor voltage, then it’s just a matter of selecting the inverse, as follows. To invert the “A” curve selection, press S2 at power up and the display will show the current selection. Initially, this will show “A.ni”(A not inverted) and this indicates that the A bargraph is not inverted. If S2 is now held pressed for four seconds, the display will change to show “A. i” (A inverted) to indicate that the bargraph operation is now inverted. You simply release the switch when the required selection is displayed. Holding the switch down will cause the display to cycle between the inverted and non-inverted options. Similarly, to set the “B” bargraph sense, S3 is pressed when power is applied. This will initially indicate “b.ni” (B bargraph not inverted) but can be changed to “b.i” (B bargraph inverted) by holding the switch down for four seconds. It’s easy to check the current selection by pressing S2 or S3 at power up. No changes will occur unless the switch is held for more than four seconds and the display changes to the next option. PRIME ELECTRONICS Est. 1987 â 115 Compact DMM 3 YEAR WARRANTY CAT III 600V True RMS AC/DC Volts 600V AC/DC Amps 10A Resistance Continuity Frequency Capacitance List Price $245.00 Our Price $199.00 179/EDA2 Combo Kit LIMITED LIFETIME WARRANTY CAT III 1000V CAT IV 600V around) so that its top surface is 15mm above the top of the PC board. Kit Contains Testing ● Now for the smoke test but first go over the board carefully and check for incorrect component placement and for missed or shorted solder joints. Next, with IC1 out of its socket, apply power to the +12V and GND terminals and check that 5V is present between pins 14 & 5 of IC1’s socket. If this is correct, switch off and install IC1 and the displays. DISP1, DISP2 and DISP3 mount with the decimal points to bottom right, while DISP4 (the LED bargraph) mounts with its chamfered edge at bottom right (note: Diode Test Analog Bar Graph Backlight Min/Max/Avg Display Hold Auto/Manual Range Holster ● ● ● ● ● ● Fluke 179 True RMS DMM TL224 SureGripTM Silcone Test Lead Set TL910 Electronic Test Probe Set AC280 SureGripTM Hook Clip Set TPAK Magnetic Hanger 80BK Intergrated DMM Temp Probe C35 Soft Meter Case List Price $585.00 Our Price $499.00 Prices exclude GST Call for a 2008 Fluke Catalogue www.prime-electronics.com.au Brisbane (07) 3252 7466 Sydney (02) 9704 9000 November 2008  67 Using The Unit With Narrowband Sensors LED1 RICH LED7 LEAN Enabling the S-curve response BAR A O 2 SENSOR OUTPUT VOLTAGE (mV) W HEN USED WITH narrowband sensors, this unit will display air/fuel ratios that are calibrated to the S-curve output of a Bosch LSM11 narrowband oxygen sensor. Note, however, that this may not be accurate for other oxygen sensors. In the case of the LSM11, it shows air/fuel ratios for unleaded petrol from 11.8 to 20.6, with the stoichiometric ratio set for 14.7. For air/fuel ratios below 11.8 the unit will show an “r” for rich, while for ratios above 20.6 the unit shows an “L” for lean. For LPG, the range is from 12.6 to 21.4 with stoichiometric at 15.5. The unit displays an “r” (rich) for ratios below 12.6 and an “L” (lean) for ratios above 21.4. For narrowband sensors, the bargraph options are as shown in Fig.12; ie, either a centred bar mode or a 13-level dot mode. These 13 different levels are achieved by lighting either one or two LEDs at a time. For the bar mode, the centre LED is always lit and is the only LED that is lit at stoichiometric. The bar then progresses upwards from the middle LED for richer mixtures or below the middle LED for leaner mixtures. BARGRAPH DISPLAY MODE DOT 1000 A B B C D E 800 C F G 600 D H 400 I 200 E J 0 LAMBDA () AIR/FUEL RATIO (UNLEADED PETROL) LPG K L M F G 0.8 0.9 1.0 1.1 1.2 1.3 11.8 12.4 13.2 13.9 14.7 15.5 16.2 17.1 17.6 18.6 19.0 20.2 RICH A A B C B D LEAN CENTRED BAR MODE C E D E DOT MODE F G H F G I J K L M LED1 RICH LED7 LEAN Fig.12: two bargraph options are available when the unit is set to operate in narrowband mode – either centred bar mode or a 13-step dot mode. The S-curve graph at top indicates which bargraph LEDs light in response to the various sensor output voltages. the chamfer is quite subtle). IC1 goes in with its notched end towards the top. When power is now reapplied you should be greeted with a display on the 7-segment digits and the bargraph. If not, check the orientation of IC1. If that’s correct, check that transistors Q1-Q4 are BC327 PNP types. Final assembly As mentioned above, the PC board is designed to simply clip into the specified plastic case. A 48 x 18mm cut-out is made in the lid of the box for the displays and this cut-out is 68  Silicon Chip Enabling the narrowband S-curve response is easy: just press and hold the Mode switch as power is applied. The display will then indicate the current display mode setting. This can be either the Linear (wideband) mode, the S-curve unleaded mode or the S-curve LPG mode. If the switch is released before four seconds the current display mode will not be altered. Conversely, if the switch is held down, the mode will cycle from one to the other at a nominal 4-second fitted with a red Perspex filter. In addition, a hole is drilled in the lid for the LDR, so that it is exposed to the ambient light. A hole at the rear of the box allows the wiring to exit from the case. The front-panel artwork shown in Fig.7 can be used as a template for cutting and drilling the holes. It can either be scanned or downloaded from the SILICON CHIP website and temporarily affixed to the lid using double-sided tape. The cut-out for the LED displays can be made by drilling a series of holes inside the inside perimeter of the cut- out and then knocking out the centre piece. The cut-out is then carefully filed to a smooth finish. The hole for the LDR should be drilled to 5mm, as should the exit hole in the back of the case. This exit hole should be positioned near the bottom edge of the case, so that it will directly line up with the PC stakes on the back of the board. Alternatively, you can drill the hole to 9.5mm and fit it with a 6mm ID rubber grommet. Making the connections We used twin-shielded wire for the power and input connections but siliconchip.com.au rate.You simply release the switch when the required display mode is shown. It’s also easy to tell which mode the unit is in. The display will show “Lin.” for the linear mode (or wideband mode), while the two S-curve modes are shown as S.UL (S-curve unleaded) and S.LP (S-curve LPG). Pressing the Mode switch after power-up has been applied initiates the Settings mode. As before, this allows you to alter the way the display operates. You can adjust how the dimming works, set the regulator voltage, alter the unleaded or LPG selection and change the bargraph display from dot mode to centred bar mode. As in wideband mode, the bargraph LEDs are again used to indicate which setting has been selected. These settings are somewhat different for the narrowband S-curve modes but are altered in exactly the same manner. Fig.13 shows the details. As before, only eight LEDs in the 10-LED bargraph are used and the lower LED (LED8) is always lit in the settings mode. The remaining LEDs on the bargraph show which setting has been selected and you can cycle through these settings by pressing switch S2. Minimum Display Brightness : when LED7 lit, the setting is for the minimum display brightness that occurs when the LDR is in complete darkness. This value is initially set at “14”, as shown on the display. When adjusting this value, it’s necessary to cover the LDR so that it does not receive any ambient light either from below or above its surface. A black film canister is ideal for this and the value is adjusted using the Up & Down automotive wire could also be used. Connect the +12V lead to the fusebox in the car so that the Oxygen Sensor display is powered only when the ignition is on (ie, be sure to connect to the fused side). The ground connection should preferably connect to the same ground as the wideband controller. For narrowband use, connect the ground to the same ground as the sensor. The input lead for the Oxygen Sensor Display is connected either to the 0-5V output from the wideband controller or (if you are saving money) to a narrowband sensor signal. Fit a cable tie around the leads on siliconchip.com.au LED1 (ALL LIT) DOT OR CENTRED BAR LED8 LED1 LED8 SETTINGS INDICATOR (LEDS4–7 INDIVIDUALLY LIT ACCORDING TO SELECTION) UNLEADED OR LPG DISPLAY REGULATOR VOLTAGE DIMMING THRESHOLD MIN DISPLAY BRIGHTNESS SETTINGS INDICATOR Fig.13: the setting indications for the narrowband mode. This mode is initiated by pressing and holding the Mode switch as power is applied. switches to set the desired minimum brightness. The absolute minimum brightness is reached at 0 but typical settings would range from 10-30. Dimming Threshold: pressing the Settings switch again brings up the Dimming Threshold setting, with LED6 lit. This is initially set at 200 and determines the ambient light level below which dimming begins. Increasing the value means that dimming begins at a higher ambient light level, while decreasing the value sets the dimming to begin at a lower light level. Regulator Voltage: the next setting is for the Regulator Voltage (LED5 lit). This value is initially set at 5.00V and is normally adjusted (using the Up & Down switches) to agree with the actual regulator output voltage, as measured between its OUT and GND terminals. The regulator voltage adjustment can the inside of the box, to prevent them being pulled out of the hole. Setting up For use with a wideband controller, the unit is set up as described in the panel titled “Changing The Wideband Display Settings”. Note that commercial wideband controllers can have either fixed or adjustable endpoint values. The adjustable versions have their endpoints set by connecting them to a computer. Note also that the endpoint values programmed into the display unit must match those of the wideband also be used to alter the unit’s response to the oxygen sensor’s output. For example, setting the regulator voltage to a value that’s higher than the actual regulator voltage results in the unit displaying its full range of air/fuel values over a reduced voltage range. It effectively lowers the rich end of the S-curve, so that rich readings are indicated at lower oxygen sensor voltages. Similarly, setting the regulator voltage value lower than the real regulator voltage increases the voltage range. This raises the rich end of the S-curve and rich readings are shown at higher oxygen sensor voltages. Basically, this adjustment can be used to provide a more accurate air/ fuel reading for the particular oxygen sensor used. Unleaded Or LPG Display: LED4 indicates the Unleaded Or LPG Display setting. This can be toggled using either the Up or Down switch between S.UL (for unleaded petrol) or S.LP (for LPG). When normal mode is resumed, the display will then show the air/fuel ratio values for the selected fuel. As before, the unit can be set up for both unleaded petrol and LPG and the display reading toggled using an external switch wired across S4. When this switch is open, the default air/fuel readings (as selected in the preceding paragraph) are displayed. Bargraph Display Options: finally, S1 is pressed again to bring up the bargraph display options (all 8-LEDs are lit). Again, these are selected using the Up or Down switch and you can choose either the centred bar mode (shown as bCn on the display or the 13-step dot mode (shown as doT). controller. This ensures that the unit is correctly calibrated and gives accurate air/fuel ratio readings. Switching between the “A” and “B” display values (eg, between air/fuel ratio and lambda values or between unleaded petrol and LPG air/fuel ratios) can be achieved by wiring an external switch (or NO relay contacts) in parallel with switch S4 (see Fig.6). Note that the connections on the relay contacts or switch must be solely for this purpose. If you need to switch a fuel valve or anything else at the same time, use a double-pole relay SC or switch. November 2008  69