Silicon ChipAir-Quality Meter For Checking CO & CO₂ Levels - June 2010 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Unflued gas heaters are a health hazard / Problems with our VOIP phone system
  4. Feature: Unmanned Aerial Vehicles: An Australian Perspective by Bob Young
  5. Feature: Breakthrough Aussie Innovation: Making 3D Movies by Barrie Smith
  6. Project: Air-Quality Meter For Checking CO & CO₂ Levels by John Clarke
  7. Review: LeCroy WaveAce 112 Digital Storage Oscilloscope by Nicholas Vinen
  8. Project: Dual-Tracking ±19V Power Supply, Pt.1 by Nicholas Vinen
  9. Project: Build a Digital Insulation Meter by Jim Rowe
  10. Vintage Radio: How AGC works and why it’s necessary, Pt.2 by Rodney Champness
  11. Project: A Solar-Powered Lighting System, Pt.2 by John Clarke
  12. Advertising Index
  13. Outer Back Cover

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

You can view 31 of the 112 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:
  • Radio Control (November 1996)
  • Radio Control (November 1996)
  • Radio Control (February 1997)
  • Radio Control (February 1997)
  • Radio Control (March 1997)
  • Radio Control (March 1997)
  • Radio Control (May 1997)
  • Radio Control (May 1997)
  • Radio Control (June 1997)
  • Radio Control (June 1997)
  • Radio Control (July 1997)
  • Radio Control (July 1997)
  • Radio Control (November 1997)
  • Radio Control (November 1997)
  • Radio Control (December 1997)
  • Radio Control (December 1997)
  • Autopilots For Radio-Controlled Model Aircraft (April 1999)
  • Autopilots For Radio-Controlled Model Aircraft (April 1999)
  • Model Plane Flies The Atlantic (May 1999)
  • Model Plane Flies The Atlantic (May 1999)
  • Tiny, Tiny Spy Planes (July 1999)
  • Tiny, Tiny Spy Planes (July 1999)
  • 2.4GHz DSS Radio Control Systems (February 2009)
  • 2.4GHz DSS Radio Control Systems (February 2009)
  • Unmanned Aerial Vehicles: An Australian Perspective (June 2010)
  • Unmanned Aerial Vehicles: An Australian Perspective (June 2010)
  • RPAs: Designing, Building & Using Them For Business (August 2012)
  • Flying The Parrot AR Drone 2 Quadcopter (August 2012)
  • Multi-Rotor Helicopters (August 2012)
  • Multi-Rotor Helicopters (August 2012)
  • Flying The Parrot AR Drone 2 Quadcopter (August 2012)
  • RPAs: Designing, Building & Using Them For Business (August 2012)
  • Electric Remotely Piloted Aircraft . . . With Wings (October 2012)
  • Electric Remotely Piloted Aircraft . . . With Wings (October 2012)
Items relevant to "Air-Quality Meter For Checking CO & CO₂ Levels":
  • Air Quality Monitor PCB [04306101] (AUD $10.00)
  • PIC16F88-I/P programmed for the Air Quality Monitor [0430610A.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the CO/CO₂ Air Quality Meter [0430610A.HEX] (Software, Free)
  • Air Quality Monitor for CO & CO₂ PCB pattern (PDF download) [04306101] (Free)
  • Air Quality Monitor for CO & CO₂ lid panel artwork (PDF download) (Free)
Items relevant to "Dual-Tracking ±19V Power Supply, Pt.1":
  • Dual Tracking ±0-19V Power Supply PCB [04206101] (AUD $15.00)
  • Dual Tracking ±0-19V Power Supply front panel PCB [04206102] (AUD $5.00)
  • Dual Tracking ±0-19V Bench Supply PCB patterns (PDF download) [04206101/2/3] (Free)
  • Dual Tracking ±0-19V Supply panel artwork/drilling templates (mains-powered) (PDF download) (Free)
  • Dual Tracking ±0-19V Supply panel artwork/drilling templates (plugpack-powered) (PDF download) (Free)
Articles in this series:
  • Dual-Tracking ±19V Power Supply, Pt.1 (June 2010)
  • Dual-Tracking ±19V Power Supply, Pt.1 (June 2010)
  • Dual-Tracking ±19V Power Supply, Pt.2 (July 2010)
  • Dual-Tracking ±19V Power Supply, Pt.2 (July 2010)
Items relevant to "Build a Digital Insulation Meter":
  • Digital Insulation Meter PCB [04106101] (AUD $15.00)
  • Digital Insulation Meter Power Supply PCB [04106102] (AUD $10.00)
  • PIC16F88-I/P programmed for the Digital Insulation Meter [0410610A.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the Digital Insulation Meter [0410610A.HEX] (Software, Free)
  • Digital Insulation Meter PCB patterns (PDF download) [04106101/2] (Free)
  • Digital Insulation Meter front panel artwork (PDF download) (Free)
Articles in this series:
  • How AGC works and why it’s necessary (May 2010)
  • How AGC works and why it’s necessary (May 2010)
  • How AGC works and why it’s necessary, Pt.2 (June 2010)
  • How AGC works and why it’s necessary, Pt.2 (June 2010)
Items relevant to "A Solar-Powered Lighting System, Pt.2":
  • Solar-powered Lighting System PCB [16105101] (AUD $10.00)
  • PIC16F88-I/P programmed for the Solar Powered Lighting Controller [1610510A.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the Solar Powered Lighting Controller [0610510A.HEX] (Software, Free)
  • Solar-Powered Lighting System PCB pattern (PDF download) [16105101] (Free)
Articles in this series:
  • A Solar-Powered Lighting System (May 2010)
  • A Solar-Powered Lighting System (May 2010)
  • A Solar-Powered Lighting System, Pt.2 (June 2010)
  • A Solar-Powered Lighting System, Pt.2 (June 2010)

Purchase a printed copy of this issue for $10.00.

By JOHN CLARKE Unflued gas heaters are a hazard to health & life . . . Build an Air Quality Monitor to ensure your safety & well-being This Air Quality Monitor indicates carbon dioxide (CO2) and carbon monoxide (CO) levels on a dual bargraph and sounds an alarm when either level reaches a preset concentration. You should use it if you have an unflued heater in your home, boat, caravan or any indoor space. 28  Silicon Chip siliconchip.com.au Main Features & Specifications Features • • • • • Detects carbon monoxide (CO) and carbon dioxide (CO2) levels 15-level LED bargraph display for each gas Three-stage alarm ranging from initial warning through to urgent Internal fan replenishes air for sensors Automatic display dimming in low light levels Specifications CO2 Range: 0.03% to 1% (300-10,000ppm) with recommended calibration. CO Range: .003% to .03% (30-300ppm) with recommended calibration. Bargraph Displays: separate bargraphs to show CO and CO2 concentrations, each consisting of eight LEDs with 15 display levels. Alarm Modes: 16ms chirp every 16s (third top LED), 32ms chirp every 4s (second top LED) and 64ms chirp every 0.5s (top LED). CO2 Sensor Heating: continuous at 200mA. CO Sensor Heating: 60s heating at 150mA; 90s reading period at 42mA. Readings Update: CO = 2.5 minutes; CO2 = after an initial 60s then with a nominal 5s lag due to sensor response. Dimming Range: 205 brightness levels. Diagnostic Display: CO sensor only when VR4 is set to give 0V on TP4. The top two LEDs are lit during the heating cycle, while the third top LED and LEDs below light for the measurement cycle with these LEDs extinguishing successively every 15s. Power Supply: 12VDC 500mA plugpack. A LL COMBUSTION heaters, including those using wood, coal, coke, kerosene, methylated spirits and gas, draw oxygen from the air as the fuel is burnt. If used indoors, such as inside a house, this gradually reduces the oxygen concentration in the air unless there is sufficient ventilation to the outside. However, judging how much room ventilation is needed to keep the air safe is almost impossible and it’s all too easy to provide insufficient outside air. After all, you do want to keep warm. If you don’t have sufficient fresh air in the room, there is the immediate danger that the deadly gas carbon monoxide will be produced. This is much more likely if the heater is unflued, whereby the combustion gases are released into the room. Unfortunately, most gas heaters used in Australia are unflued and every one of these is a potential source of carbon monoxide and other noxious gases. Some gas heater designs attempt to siliconchip.com.au get around this problem by employing an oxygen depletion sensor. These extinguish the heater if the oxygen concentration in the room is reduced by 20%. While better than having no sensor at all, this definitely should not be regarded as a safe answer. Why? Because regardless of whether the oxygen depletion sensor, a pretty crude device, is working, the heater may still produce some carbon monoxide as well as the normal combustion products of carbon dioxide, water vapour, nitrogen oxides, sulphur dioxide and formaldehydes. An oxygen depletion sensor does not detect or react to any of these noxious and potentially harmful gases – it only detects a reduction in oxygen concentration. Even if no carbon monoxide is produced, all unflued gas heaters still produce the other combustion products listed above and these can cause breathing difficulties for people who suffer from asthma or allergies. Ultimately, unflued gas heaters must be regarded as less than ideal but they are much cheaper than properly flued gas heaters and most of them have the advantage of using a bayonet gas connector which allows them to be moved from room to room. Monitoring air quality Ideally, if you have a combustion heater in your home, there should be some means of monitoring the air quality. The SILICON CHIP Air Quality Monitor measures both carbon dioxide and carbon monoxide levels and displays the results on LED bargraphs. If the concentration of either of these gases rises above a preset level, a loud alarm will sound which means that you should turn off the heater and open the room up to fresh air. Each bargraph comprises eight LEDs that light individually (ie, one at a time) to show eight distinct levels. In-between values are displayed by lighting two adjacent LEDs. This June 2010  29 30  Silicon Chip siliconchip.com.au Q5 IRF540 S D G VR5 50k +5V 10k IC2a CO THRESHOLD 1k 2 3 1 10 11k VR6 500k CO 2 LEVEL VR3 10k 6 5 VR4 10k CO LEVEL DIMMING THRESHOLD 2.2k LDR  DIGITAL AIR QUALITY METER H B H CO SENSOR VR2 200 THRESHOLD CO 2 SENSOR 2 13 H B CO 2 SENSOR GUARD IC2: LMC6482AIN 100nF 2.2k TP5 TP4 TP3 TP2 7 RB1 AN3 AN4 AN1 AN2 AN5 +5V 14 A E 4 10k Q6 BC337 RA0 RB4 RB3 PWM MCLR C K Vss 5 RB5 RB2 RA6 RB7 IC1 RA7 PIC16F88I/P Vdd B D1: 1N4004 7 2 3 18 1 12 10 F 16V 4 IC2b 8 B H B A A A H 1k 1k 1k 1k LED10 A 150 LED9 A 150 LED2 150 A B K  K  K  K  IN K A ADJ LED1 VR1 1k SET 6V 150 GAS SENSORS 11 8 15 13 16 17 10 9 6 TP6 100 F 16V 120 OUT A E B Q1 BC337 LEDS E C LED11 A LED12 A LED3 A LED4 FAN REG1 LM317T K  K  K  K  – B A LED6 A LED5 A C BC337 E B G K  K  K  K  100 F 16V Q2 BC337 LED14 A LED13 C 56  1W + D A K S IRF540 E Q3 BC337 C LED15 A LED16 A LED7 A LED8 S1 POWER Fig.1: the circuit is based on two gas sensors (Sensor 1 for CO2 and Sensor 2 for CO) plus a PIC16F88-I/P microcontroller (IC1). IC1 in turn drives a 4 x 4 LED matrix array, with the LEDs arranged to form two bargraphs. IC2b & Q6 provide a +5V rail for IC1. SC 2010 100 2.2 A 13 A H SENSOR 1 1k +6V TPG TP1 +6V B K  K  K  K  D1 D ADJ Q4 BC337 OUT E C + 12V DC INPUT (500mA) – IN LM317T K OUT POWER  LED17 A 220 +6V PIEZO SOUNDER A gives a total of 15 levels that can be displayed. The four lower LEDs are green, followed by two orange and then two red LEDs. An automatic dimming circuit ensures that the LED displays are not too bright at night. In addition, the alarm sounds if any of the top three LEDs light in either display. There are three alarm levels: (1) a main alarm that sounds if the top LED lights. This consists of a 64mslong 4kHz tone that repeats every 0.5s; (2) a less urgent alarm that sounds if the second top LED is lit (top LED off). This alarm gives a 32ms-long 4kHz “chip” every four seconds (4s); and (3) a warning alarm that sounds if the third top LED is alight. This alarm mode gives a brief 16ms 4kHz “chirp” every 16 seconds (16s). As shown in the photos, the Air Quality Monitor is housed in a plastic case with a clear lid to reveal the LED bargraphs. An internal fan at one end draws air through the box so that the internally-mounted CO and CO2 sensors are presented with a continuous sample of the air that’s being monitored. Power for the unit comes from a 12VDC 500mA plugpack. Circuit details Take a look now at the circuit of Fig.1. It’s based on two gas sensors and a PIC microcontroller (IC1). The microcontroller monitors the sensor signals and drives two multiplexed LED bargraph displays. We’ll start by looking at the CO2 sensor. This consists of a heater coil and a solid electrolyte cell comprising a lithium (Li) cathode and a potassium (Ka) anode. When these electrodes react with carbon dioxide, a potential difference is produced between them that varies with the CO2 concentration. The sensor is built into a metal housing and is exposed to air (and to CO2) via a stainless steel mesh. Its output in normal air (ie, with a normal CO2 concentration) is typically 325mV. This voltage falls with increased CO2 concentrations beyond 400ppm (parts per million) or 0.04%. The CO2 concentration in normal air is 0.0314% but this can increase to 5% in air that’s directly exhaled from the lungs. At this latter level, the sensor’s output will be well below 250mV (compared to 325mV in standard air). The CO2 sensor’s output appears across its “A” and “B” terminals and has a very high impedance, so any siliconchip.com.au 5V HEATER VOLTS 1.4V 0V 60s HEAT CYCLE 90s 60s HEAT CYCLE 90s 3V SENSOR SIGNAL MEASUREMENTS TAKEN HERE (JUST BEFORE HEAT CYCLE) CO SENSOR MEASUREMENT CYCLE Fig.2: this diagram shows the measurement cycle for the CO sensor. The sensor is initially heated using a 5V supply for 60s, then the heater voltage is reduced to 1.4V for 90s. The CO concentration is measured near the end of this 90s period, after which the heating cycle is repeated. loading will drastically reduce this output. As a result, the manufacturer recommends monitoring the voltage using a circuit that has a 100GΩ to 10TΩ input impedance and an input current not exceeding 1pA. To comply with these requirements, we have used an LMC6482 CMOS op amp (IC2a) to buffer the sensor signal. Its input impedance is 10TΩ while the input current is typically just 0.02pA. Note, however, that these specifications would not normally be met when the op amp and the sensor are mounted on a PC board, due to leakage current. Fortunately, this leakage current can be prevented by shielding the sensor’s output pin and the op amp’s pin 3 input with a complete loop of copper track. As shown, this loop is connected to the op amp’s pin 2 inverting input. Because the inverting input is at the same potential as the non-inverting input, no current flows between them and the shield (or guard) track prevents any leakage between pin 3 and other sections of the PC board. IC2a is wired as a non-inverting stage with a gain of about 11, as set by the 10kΩ and 1kΩ feedback resistors. As a result, a 315mV output from the sensor (ie, in normal air) should result in a 3.47V output from the op amp. In practice, we found that the output from the particular CO2 sensor we used was greater than 315mV in normal air, causing IC2a’s output to go above 5V. Consequently, trimpot VR2 has been added so that IC2a’s output can be level shifted, to correctly set the output to 3.47V in normal air. Note that VR2 changes IC2a’s gain slightly, depending on its setting, but this doesn’t matter in this application. In practice, VR2 is adjusted so that the lowest LED in the CO2 bargraph is just off in normal air. By contrast, the maximum bargraph level is adjusted using VR3 which sets the voltage on the AN2 (pin 1) input of IC1. This voltage is used by IC1 to calculate the display levels. The amplified sensor signal at the output of IC2a is applied to the AN5 (pin 12) input of IC1 via a 2.2kΩ resistor. An internal analog-to-digital (A/D) converter then converts the signal to a digital output to drive the bargraph display. Note that the output from the sensor is valid only after it has been heated sufficiently. This is achieved by connecting a 6V supply across the internal heater element. For this reason, the microcontroller June 2010  31 How an Oxygen Depletion Sensor (ODS) Works PILOT BURNER PILOT BURNER GAS IGNITOR IGNITOR THERMOCOUPLE PILOT BURNER GAS THERMOCOUPLE 1. NORMAL OXYGEN An oxygen depletion sensor consists of a pilot burner, a thermocouple and an ignitor. When the oxygen level in the air is normal (20.9%), the pilot flame touches the tip of the thermocouple as shown at (1). As a result, the thermocouple generates a voltage which 2. REDUCED OXYGEN indirectly activates an electromagnet and keeps the heater’s gas valve open. When the oxygen level decreases to around 19%, the pilot flame begins to lift and the thermocouple begins to cool (2). Finally, at 18% oxygen, the unstable pilot flame lifts off the thermocouple The Effects Of CO And CO2 Carbon monoxide (CO) is a colourless, odourless gas that’s made up of molecules comprising one carbon (C) atom and one oxygen (O) atom. By contrast, carbon dioxide (CO2) molecules consist of one carbon and two oxygen atoms. Over time, CO molecules will pair with a spare oxygen atom to form the more stable carbon dioxide (CO2) gas. CO2 has a concentration of about 0.03% in fresh air and is not dangerous at such low levels. However, higher concentrations result in accelerated breathing and an increase in heart rate and can lead to headaches and dizziness. And a concentration of 10% can cause respiratory failure and death within a matter of minutes. CO2 concentrations can increase in enclosed spaces when oxygen is combined with carbon to form CO2, due to combustion and respiration. High CO2 concentrations are a sure sign that oxygen has been depleted from the air and this can heighten the adverse effects of elevated CO2 levels. Poor combustion can result in the production of the oxygen-starved carbon monoxide (CO) gas. Carbon monoxide is extremely dangerous because it has a 200 times greater affinity for haemoglobin than does oxygen. As a result, it blocks oxygen from being carried by the blood supply to other parts of the body, including the brain. Table 3 list the physiological effects of various concentrations of carbon monoxide in air. As can be seen, even relatively low concentrations can be dangerous. Table 3: Physiological Effects Of CO Concentration Symptoms 0.005% (50ppm) No symptoms with prolonged exposure. 0.01% (100ppm) Slight headache within a few hours. 0.05% (500ppm) Headache within 1 hour, increasing in severity over time. 0.1% (1000ppm) 0.4% (4000ppm) Headache, dizziness and nausea within 20-30 minutes; death within two hours Headache, dizziness and nausea within 5-10 minutes; death within 30 minutes 1% (10,000ppm) Death in 1-3 minutes 32  Silicon Chip GAS IGNITOR THERMOCOUPLE 3. SHUTOFF STAGE and its output voltage decreases (3). At that point, the electromagnet closes the gas valve and the heater ceases operation. The heater can only be restarted when the oxygen level in the room returns to normal. ignores readings from this sensor for the first 60s after power is applied. CO sensor The output from the CO sensor (Sensor 2) is monitored at the AN3 input (pin 2) of IC1. However, this sensor operates differently from the CO2 sensor in that it varies its resistance with CO concentration. The sensor itself is made up of a tin dioxide layer deposited onto an aluminium oxide ceramic tube. This tube is fitted inside a plastic housing and is exposed to air (and CO) via a stainless steel mesh. The specifications state that this sensor must initially be heated using a 5V supply connected across its heater element for 60s. The heater current is then reduced by placing just 1.4V across the element for a 90s period. The CO concentration is then measured, after which the initial 60s heating cycle begins again – see Fig.2. In practice, this means that measurements are repeated at 2½ minute (150s) intervals. In our circuit, the heater is powered from a +6V rail via two parallel 13Ω resistors (equivalent to 6.5Ω), while Mosfet Q5 ties the lower end of the heater element to 0V. The heater has a resistance of 33Ω, so when Q1 is on, a current of 152mA flows through it. This results in a 1V drop across the two 13Ω resistors, thus giving the required 5V supply for the heater. Q5 is controlled by IC1’s RB1 output siliconchip.com.au and turns on when its gate is pulled high. In operation, RB1 switches Q5 on for 60s to provide the heating current. RB1 then goes low for 90s and this switches Q5 off so that the measurement can be made. During this 90s period (ie, with Q5 off), the CO sensor’s heater is effectively in series with the 2.2Ω and 100Ω resistors connected across Q5. As a result, the current through the sensor drops to 42.34mA which means that the voltage across the heater is now 1.397V (ie, 33 x 0.4234). That is close enough for practical purposes to the 1.4V value specified. As before, the sensor’s output appears across its A and B terminals. This output varies in resistance according to CO concentration, so one side is connected to the +5V rail and the other side to 0V via trimpot VR5 to form a voltage divider. As a result, any changes in the sensor’s resistance (ie, due to CO variations) will result in a corresponding voltage change at the top of VR5. This signal is then applied to the AN3 input of IC1 (pin 2) and fed to its internal A/D converter. During set-up, VR5 is set so that AN3 is at 0.5V when the sensor is in normal air. However, this signal voltage can rise to around 3V when the CO concentration is over 300ppm. In operation, the sensor varies its resistance over a 10:1 range for CO concentrations ranging from 10ppm to 1000ppm. The maximum bargraph level for CO is adjusted using trimpot VR4. It effectively forms a voltage divider across the 5V supply and its output is applied to the AN4 (pin 3) input of IC1. This voltage, along with the sensor voltage on AN3, is then used by IC1 to calculate the bargraph display level. Bargraphs Two 8-LED bargraphs are used to indicate the CO2 and CO levels and these are driven via eight outputs from IC1. These 16 LEDs (LED1-16) are wired in a 4 x 4 matrix, with transistors Q1-Q4 driving their common cathode connections. Q1-Q4 are in turn driven by the RB7, RA6, RB2 & RB5 outputs of IC1 via 1kΩ resistors. In greater detail, transistor Q1 drives the cathodes of LED1, LED2, LED9 & LED10, while their anodes are respectively driven via the RB3, RB4, RA0 & RA7 outputs via 150Ω limiting siliconchip.com.au Parts List 1 PC board, code 04306101, 104 x 78mm 1 IP65 ABS box with clear lid, 115 x 90 x 55mm (Jaycar HB-6246 or equivalent) 1 front panel label, 84 x 80mm, printed onto clear plastic film (eg, overhead projector film) 1 CO sensor (Jaycar RS-5615 or equivalent) 1 CO2 sensor (Jaycar RS-5600 or equivalent) 1 50kΩ LDR with >1MΩ dark resistance (Jaycar RD-3480 or equivalent) 1 12V DC 500mA plugpack 1 12V cooling fan, 40 x 40 x 10mm 1 piezo transducer, 30mm diameter 1 2.5mm PC-mount DC socket (CON1) 1 SPDT PC-mount miniature toggle switch (Altronics S1421 or equivalent) (S1) 1 2-way screw terminal block, 5.08mm pin spacing (CON2) 1 2-way male pin header, 2.54mm pin spacing 1 2-way female pin header, 2.54mm pin spacing 1 DIP18 IC socket 1 mini TO-220 heatsink, 19 x 19 x 9.5mm 2 M4 x 12mm countersunk (CSK) screws (to secure fan) 2 M3 x 10mm countersunk screws (to secure piezo transducer) 1 6mm ID (internal diameter)Nylon washer (spacer for piezo transducer) 4 M3 x 6mm screws 1 M3 x 10mm screw 1 M3 nut 1 60mm length of 0.7mm tinned copper wire 8 PC stakes 1 340mm length of black 5mm heatshrink tubing; OR resistors. Similarly, Q2 drives the cathodes of the second LED column in the matrix, Q3 the third column cathodes and Q4 the fourth column cathodes. In operation, the LED bargraphs are controlled in multiplexed fashion, with the transistors switched on one at time in turn. This allows the LEDs in a switched column to be lit individually. 1 160mm length of 5mm green heatshrink tubing, 1 80mm length of 5mm yellow heatshrink tubing & 1 100mm length of 5mm red heatshrink tubing (to match LED colours) Semiconductors 1 PIC16F88-I/P microcontroller programmed with 0430610A.hex (IC1) 1 LMC6482AIN dual op amp (IC2) 5 BC337 transistors (Q1-Q4, Q6) 1 IRF540-N channel Mosfet (Q5) 1 LM317T adjustable regulator (REG1) 1 1N4004 1A diode (D1) 5 3mm red LEDs (LEDs1-2, LEDs9-10, LED17) 4 3mm orange LEDs (LEDs3-4, LEDs11-12) 8 3mm green LEDs (LEDs5-8, LEDs13-16) Capacitors 2 100µF 16V 1 10µF 16V 1 100nF MKT (code 100n or 104) Resistors (0.25W 1%) 1 11kΩ 1 120Ω 2 10kΩ 1 100Ω 2 2.2kΩ 1 56Ω 5% 1W 6 1kΩ 2 13Ω 1 220Ω 1 10Ω 4 150Ω 1 2.2Ω 5% Trimpots 1 500kΩ miniature horizontal trimpot (code 504) (VR6) 1 50kΩ miniature horizontal trimpot (code 503) (VR5) 2 10kΩ miniature horizontal trimpot (code 103) (VR3,VR4) 1 1kΩ miniature horizontal trimpot (code 102) (VR1) 1 200Ω miniature horizontal trimpot (code 201) (VR2) For example, when Q1 is switched on, either LED1, LED2, LED9 or LED10 can be switched on. This is done by taking either RB3, RB4, RA0 or RA7 of IC1 high. Alternatively, by taking more than one of these outputs high, the LEDs can be switched on in any combination. The same goes for the other columns June 2010  33 RETE M YTILAU Q RIA 12V MINI FAN TP3 TP5 VR4 10k CO TO PIEZO IC1 PIC16F88 VR3 10k TP4 150 Q1 LED 1 LED 1k 2 LED Q2 3 LED 1k 4 LED Q3 5 LED 150 6 LED Q4 TP2 7 LED 1k 8 LED 9 LED 10 LED 11 LED 12 LED 13 LED 14 LED 15 LED 16 IC2 SENSOR1 + CO 2 1k 100 F 1k VR2 200 Q6 LED17 2.2k 11k 120 S1 VR1 1k TP1 4004 H1 D1 220 REG1 1 0 1LM317 60340 100 F TERMINAL PIN 2.2k LMC6482 10k 100nF 10 2.2 100 13 13 56  1W 1k 150 Q5 LDR1 VR6 500k VR5 50k SENSOR2 150 10 F 10k CON2 + TP5V + GND CON1 Fig.3: install the parts on the PC board as shown in this layout diagram and the accompanying photos. Take care to ensure that all polarised parts are correctly oriented and note that the CO2 sensor must be tested to determine its polarity before it is fitted (see text). The CO sensor can go in either way around. in the matrix when their switching transistor is on. Each transistor is driven on for about 1ms before switching off. As soon as it switches off, the next transistor is switched on to drive the next column of LEDs. However, there is a short gap (or “dead time”) between one transistor switching off and the other switching on, to prevent display errors. In operation, the LEDs are switched on and off at such a fast rate that they appear to be continuously lit. They are also physically laid out on the PC board as two bargraph columns. The top two rows of LEDs in the matrix (LEDs1-8) form the CO bargraph, while the bottom two rows (LEDs9-16) form the CO2 bargraph. LED17 is the power indication LED. This connects to the +6V supply via a 220Ω current-limiting resistor and is driven by transistor Q4, so that it always appears lit when power is applied. Display dimming Automatic display dimming is achieved using a light dependent 34  Silicon Chip resistor (LDR). As shown, the LDR is connected in series with trimpot VR6 across the 5V supply to form a voltage divider. The output of this voltage divider is connected to the AN1 input (pin 18) of IC1. In bright light, the LDR’s resistance is 50kΩ or less and so the voltage applied to IC1’s AN1 input is pulled close to the 5V supply. This signals IC1 to drive the LEDs at full brightness. Conversely, at lower ambient light levels, the LDR’s resistance increases and voltage at AN1 decreases. As a result, IC1 now drives the LEDs with a reduced duty cycle. This is achieved by using a longer dead time, ie, the time between when one transistor switches off and the next one switches on. This effectively reduces the length of time that the LEDs are lit and hence reduces their brightness. In full darkness, the LDR has a high resistance and VR6 pulls the AN1 voltage down close to 0V. The display is then dimmed to its maximum extent. Piezo alarm The alarm feature is provided by using the pin 6 PWM (pulse width modulation) output of IC1 to drive a piezo transducer. Its frequency of operation is set to 4kHz (50% duty cycle) and there are three alarm modes, as described earlier. Note that the alarm is only activated when one of the top three LEDs in either bargraph is lit. Power supply Power for the circuit is derived from a 12VDC 500mA plugpack, with diode D1 providing reverse polarity protection. The nominal +12V supply rail is then fed via on/off switch S1 to the input of 3-terminal regulator REG1, with filtering provided by a 100µF 16V capacitor. This +12V supply rail also drives a 12V fan via a 56Ω resistor. The resistor is there to reduce the fan speed and thus the noise it makes, while still allowing sufficient air to be drawn through the case. REG1 is an LM317T variable regulator and is configured to provide a 6V supply. The voltage between its OUT and ADJUST pins is nominally 1.25V siliconchip.com.au output to maintain +5V at Q6’s emitter. This +5V rail powers microcontroller IC1, trimpots VR3 & VR4 and LDR1. Construction Construction is a snap with all parts, except the 12V fan and piezo alarm, mounted on a PC board. This board is coded 04306101 (104 x 78mm) and is housed in a 115 x 90 x 55mm IP65 ABS box with a clear lid so that the LED bargraphs are visible. The PC board is designed to mount onto integral standoffs within the box. Begin by checking that the PC board fits neatly inside this case. If not, carefully file the edges and/or file the corner cutouts until it does. Next, check the PC board for breaks in the tracks or shorts between tracks and pads. Repair any defects as necessary (they are rare these days), then check that the hole sizes are correct by test fitting the larger parts (ie, the screw terminal block, regulator REG1, trimpots, sensors and the DC socket). Check also that the regulator’s mounting hole and the corner mounting holes are all 3mm in diameter. Fig.3 shows the parts layout on the PC board. Start the assembly by fitting the two wire links and the resistors. The resistor colour codes are shown in Table 1 but you should also check each one with a digital multimeter, just to make sure. Diode D1 is next on the list, taking care to install it with the orientation shown. Once it’s in, install PC stakes at all the test points and adjacent to the CO2 sensor, then install the 2-way pin header for the piezo transducer. Next, install a DIP18 socket for microcontroller IC1, again taking Above: inside the completed prototype. Light pipes made from heatshrink sleeving are fitted to the bargraph & power LEDs. but in practice can be anywhere from 1.2V to 1.3V. If this voltage is 1.25V, this means that a current of 10.4mA flows through the 120Ω resistor and trimpot VR1. Adjusting VR1 to 456Ω sets the voltage across it to 4.75V and the output the regulator to 6V (ie, 4.75V + 1.25V). This 6V supply is used to drive the heaters in the CO2 and CO sensors. In addition, the 6V rail is fed to a voltage divider made up of 2.2kΩ and 11kΩ resistors. The resulting +5V output from the divider is then fed to the pin 5 (non-inverting) input of op amp IC2b which in turn drives current amplifier Q6 (BC337). As shown, Q6’s emitter provides feedback to IC2b’s inverting input. As a result, IC2b automatically adjusts its Table 1: Resistor Colour Codes o o o o o o o o o o o o o siliconchip.com.au No. 1 2 2 6 1 4 1 1 1 2 1 1 Value 11kΩ 10kΩ 2.2kΩ 1kΩ 220Ω 150Ω 120Ω 100Ω 56Ω 1W 5% 13Ω 10Ω 2.2Ω 5% 4-Band Code (1%) brown brown orange brown brown black orange brown red red red brown brown black red brown red red brown brown brown green brown brown brown red brown brown brown black brown brown green blue black gold brown orange black brown brown black black brown red red gold gold 5-Band Code (1%) brown brown black red brown brown black black red brown red red black brown brown brown black black brown brown red red black black brown brown green black black brown brown red black black brown brown black black black brown not applicable brown orange black gold brown brown black black gold brown not applicable June 2010  35 sure to use the correct colour at each location – see Fig.3. Completing the board The fan is attached to one end of the case using two M4 x 12mm countersunk screws while the transducer is secured using M3 x 10mm countersunk Nylon screws – see text. Note the ventilation holes in front of the fan. care to orient it correctly (ie, notch towards the top). By contrast, IC2 can be directly mounted on the PC board and this can go in next. It faces in the same direction as IC1. The DC socket and the 2-way screw terminal block are next on the list. Be sure to mount the latter with its access holes facing outwards. Transistors Q1-Q4 & Q6 (all BC337) can then be installed. Follow these parts with Mosfet Q5 (IRF540). This is mounted vertically with its metal tab towards trimpot VR5 and doesn’t require a heatsink. By contrast, regulator REG1 mounts horizontally on the PC board and must be fitted with a small U-shaped heatsink for cooling. CO2 Sensor Orientation The CO2 sensor has a symmetrical pin arrangement and so will fit the PC board either way around. However, there’s nothing on the package to indicate which output is the positive terminal. This means that the sensor’s output has to be checked before it is soldered in place on the PC board. Be sure to follow the step-by-step procedure in the text before fitting this device. 36  Silicon Chip To install REG1, first bend its two outer leads down through 90° about 7mm from its body and the centre lead down through 90° about 4mm away. That done, fasten the regulator and its heatsink to the PC board using an M3 x 10mm screw and nut, then solder its leads. Don’t solder the regulator’s leads before fastening it down. If you do, you could crack the copper tracks as the mounting screw is tightened. Trimpots VR1-VR6 can now all go in. Be sure to use the correct value in each position. Note that trimpots are often marked with a value code instead of their ohms value. In this case, the code markings will be 102 for the 1kΩ trimpot (VR1), 201 for the 200Ω trimpot (VR2), 103 for the 10kΩ trimpots (VR3 & VR4) and 503 for the 50kΩ trimpot (VR5). Mounting the LEDs LEDs1-17 must all be mounted so that their tops sit exactly 30mm above the PC board. The best way to do this is to cut a 25mm-wide thick cardboard spacer which can be slid between the leads of each LED – just push the LED all the way down onto the spacers before soldering its leads. Take care to ensure that the LEDs are all correctly oriented (the anode lead is the longer of the two) and be Switch S1, the DC socket (CON1), the LDR and the two sensors can now all be installed. Note that the LDR should be mounted with its top surface about 5mm above the PC board. The CO sensor (Sensor2) in the red plastic housing can go in either way around. By contrast, the CO2 sensor (Sensor2), which is in the metal housing, must be tested for polarity before it is installed. The step-by-step procedure is as follows: (1) Connect short lengths of hook-up wire between each heater pin on the sensor (ie, the centre pin of each set of three pins) and the corresponding pad on the PC board (polarity not important). (2) Plug the appropriate DC connector into the plugpack lead, so that the “+” marking on the connector plug aligns with the “+” marking on the connector socket. (3) Adjust VR1 fully anticlockwise, then connect a digital multimeter between GND and TP1. Set the meter so that it can measure up to 6VDC. (4) Connect the plugpack to the DC socket, switch on and adjust VR1 for a reading of 6V on the DMM. That done, check for +5V on TP6. (5) Connect the multimeter to the A and B terminals of the CO2 sensor. You should get a reading of 300-500mV. Identify which terminal is positive and mark it with a “+” sign. (6) Switch off, disconnect the heater wiring and mount the CO2 sensor on the PC board with the positive (+) side oriented as shown on Fig.3. (7) Solder the PC stake adjacent to the CO2 sensor to the sensor’s body. Fitting the microcontroller You can now fit the microcontroller (IC1) in its socket, taking care with the orientation. That done, apply power again and check that LED17 (the power LED) lights. If all is well so far, check that this LED dims when the LDR is covered over and adjust VR6 for best dimming results (note: adjustment of the dimming threshold is best done at night). Initial adjustments Before using the unit, it’s necessary to adjust the full-scale sensitivity and threshold level of each bargraph siliconchip.com.au A 6mm ID Nylon washer is attached to the top of the transducer before it is installed in the case. This washer can be secured using a light smear of silicone sealant. display. The initial procedure is as follows: (1) Adjust trimpot VR3 (CO2 level) to give 3V at TP3. This sets the CO2 full scale sensitivity to about 10,000ppm or 1%. (2) Adjust trimpot VR4 (CO level) to give 3V at TP4. This sets the full-scale CO sensitivity to about 300ppm. Note: rotating trimpots VR3 & VR4 clockwise will increase the sensitivity of the CO2 and CO bargraphs respectively (ie, the display will read higher for a given gas concentration). However, do not rotate VR3 for less than 2V at TP3 or VR4 for less than 2V at TP4. Conversely, rotating each level trimpot anti-clockwise lowers the sensitivity of its corresponding bargraph. (3) Adjust VR2 so that the bottom LED of the CO2 bargraph just extinguishes (ie, no LEDs lit). This should be with TP2 at just under 3V. (4) Wait 60s after applying power, then blow on the CO2 sensor to expose it to extra CO2 gas. Check that the CO2 bargraph now shows a full-scale reading (ie, top LED lit). If the piezo transducer is connected, check that the alarm sounds with any of the top three LEDs lit. CO sensor adjustments Making the adjustments for the CO sensor is a slow process, since it requires a “burn-in” period of 48 hours. The unit must therefore be left on for 48 hours before making the final adjustments. Additionally, as stated in the circuit description, the sensor is heated for 60s and then allowed to respond to the gas over a 90s period before each measurement is made. This means that it will take 2.5 minutes to get the result after each adjustment. Initially, however, you can bypass the 48-hour burn-in period and make siliconchip.com.au This view shows the power switch and DC socket end of the unit. The air to be monitored is drawn in through the two central holes. The 12V fan blows the sampled air out through five holes at the other end of the case. the initial adjustments straight away. The final “touch-up” adjustments can then be made after the burn-in period. The first step it to adjust VR5 so that TP5 is at 0.5V right towards the end of the 90s measurement period, ie, when the sensor is in fresh air. However, this requires some means of monitoring the heating and measurement cycles. In practice, you can either use a second multimeter to monitor the drain of Q5 or use a diagnostic tool that’s built into the Air Quality Monitor that shows the heating/measurement cycles. The procedure for each method is as follows: METHOD 1: if you have a second multimeter, connect it between Q5’s tab (ie, its drain) and GND. Q5’s tab will be close to 0V during the heating cycle and at 4.3V during the measurement cycle. Adjust VR5 to set TP5 to 0.5V near the end of the 90s measurement cycle. METHOD 2: if using the inbuilt diag- nostic tool, start by adjusting VR4 fully clockwise, so that TP4 is at 0V. This will now cause the CO bargraph display to show the heating and measurement cycle. During the 60s heating cycle, the top two red LEDs will be lit. Then, during the 90s measurement cycle, the red LEDs switch off and the four green and two orange LEDs initially light. These LEDs then extinguish one at a time, starting with the topmost orange LED and continuing at 15s intervals until the bottom green LED goes out at the end of the 90s period. The unit then reverts to the heating mode again, with the top two LEDs lit. Note that if VR4 is not set all the way down to 0V, only the top LED will light. Additionally, the alarm will sound if VR4 is set below 2V, so the piezo transducer should be unplugged during this procedure. Assuming VR4 is set for 0V at TP4, it’s just a matter of adjusting VR5 so June 2010  37 SENSOR SIDE OF BOX A 13 A HOLES F: 3.00mm DIA COUNTERSUNK (PIEZO MOUNTING) 28 15 HOLE E: 6.0mm DIA (PIEZO SOUND OUTLET) A A A B B PIEZO TRANSDUCER 10 16 16 F FAN END OF BOX CL 17.5 HOLES A: 5.0mm DIAMETER (AIR HOLES) HOLES B: 4.0mm DIA CSK (FAN MTG) CL E POWER INPUT END OF BOX 17.5 16 F C C GLUE A NYLON WASHER TO THE TOP OF THE TRANSDUCER FOR SPACING AWAY FROM THE BOX EDGE 11 D E 13 16.5 ALL DIMENSIONS IN MILLIMETRES 16.5 16 HOLES C: 9.0mm DIA (AIR HOLES) HOLE D: 8.0mm DIA (DC PLUG) HOLE E: 6.0mm DIA (SWITCH) FILE A SHARP SLOT IN A METAL SCREW TO PRODUCE A THREAD CUTTING SCREW FOR PLASTICS Fig.4: these diagrams can be copied and used directly as drilling templates for the plastic case (the larger holes are best made using a pilot drill and then enlarged to size using a tapered reamer). Also shown are the mounting details for the Nylon washer on the transducer plus the details on modifying a metal screw to so that it cuts a thread in plastic. that TP5 is at 0.5V when the lowest one or two green LEDs are alight. Once that’s done, be sure to readjust VR4 so that TP4 is at 3V. This has been done to prevent the CO bargraph from being oversensitive for readings below 30ppm. Testing the CO sensor As stated, the PC board is designed to fit inside a standard IP65 ABS box with a clear lid (Jaycar HB-6246 or equivalent). Before installing it though, you need to drill a few holes to mount the fan and the piezo transducer. You also need to drill clearance holes for the on/off switch (S1) and the DC power socket, a hole directly in front of the piezo transducer and intake and exhaust holes for the fan. Fig.4 shows the drilling details. It can be copied and cut into sections to make drilling templates. Once the holes have been drilled, glue a 6mm ID Nylon washer to the top of the piezo transducer (using silicone sealant), then tap the two mounting holes in the transducer to 3mm. If you don’t have an M3 tap, then a modified M3 metal screw will suffice to cut the thread – see Fig.4. The best way to confirm that the CO sensor is working correctly is to expose it to car exhaust fumes for at least 2.5 minutes. This can be done by first capturing some exhaust in a length of plastic tubing (eg, 120 x 16mm-diameter) that’s closed at one end. The open end is then held over the CO sensor for 2.5 minutes, during which time the CO bargraph display should rise to full scale. The display should subsequently switch off again a few minutes after the tube is removed. If it does all this, then the sensor and its circuit are working correctly. As an aside, it’s worth noting that the voltage on TP5 has to rise from the 0.5V fresh-air setting to 2V before the lower LED lights on the CO bargraph. 38  Silicon Chip Fitting the board in a case All you have to do is file a slot along the thread of the screw, with a deeper cut at the thread end. This slot will assist in the cutting and removal of the plastic to form the thread in each hole. Similarly, the two bottom mounting holes in the fan housing must be tapped to 4mm. You can use a modified 4mm machine screw (ie, with a slot) to cut the threads if you don’t have a proper M4 tap. The PC board can now be slid into the case and secured using four M3 x 6mm machine screws. That done, secure the fan using two M4 x 12mm countersunk (CSK) head screws, then install the transducer. The latter is fitted with its attached Nylon washer against the side of the case and secured using two M3 x 10mm CSK Nylon screws (don’t over-tighten these screws). Next, attach the transducer’s leads to the 2-way female pin header (the polarity is not important) and plug it into the matching male header on the PC board. The fan can then be wired to siliconchip.com.au the screw terminal block, with the red lead going to the “+” terminal and the black lead to the “-” terminal. Now check to make sure that the 10µF capacitor at the top end of IC1 doesn’t foul the fan. It may be necessary to bend the capacitor back towards IC1 slightly, to ensure adequate clearance. SILICON CHIP Extreme High Medium LED tubing Each LED can be made to project its light onto a small spot on the front panel label by fitting it with a small light guide made from heatshrink tubing – see photos. You will need 17 x 20mm lengths of 5mm-diameter heatshrink tubing and it’s a good idea to use red, yellow and green tubing so that it matches the colours of the LEDs. Alternatively, you can just use black heatshrink. Once the heatshrink tubes have been cut to length, slide them down over their respective LEDs by about 6mm and shrink them down by gently applying heat from a hot-air gun. They should each form a tight grip around the LEDs and be left with a small circle at the top. Finally, adjust the LEDs so that the light pipes are all in a straight line. Now, when the lid is in place, each bargraph LED will project a small spot onto its correct position when it is lit. The same goes for the power LED. CO CO2 Fig.5: the full-size front panel artwork. Alternatively, a PDF version can be downloaded from the SILICON CHIP website and printed out onto clear film. Low Normal Air Quality Monitor ON 12V DC 500mA Power + Below: the completed prototype with the label in position. The “light pipes” fitted to the LEDs ensure that only the correct “dots” on the bargraphs are lit. Front panel label The front panel label is made by printing it out on clear overhead projector film. It is then fitted in place inside the clear plastic lid and can be secured using neutral-cure silicone sealant at each corner. You can download the label in PDF format from the SILICON CHIP website. Installation The Air Quality Monitor should be mounted near to the combustion heater and preferably on a wall, so that the display can be easily seen. The box has mounting holes that are accessed with the lid off, so it’s easy to fix in position. Note that it’s normal for CO2 levels to rise while the heater is on. However, the ventilation should be increased if the indicated level rises past the low region on the bargraph. The carbon monoxide (CO) level in the room should be kept to an absolute minimum and this can be achieved siliconchip.com.au by ensuring that the heater is operating correctly. With wood heaters, this means allowing the temperature to rise sufficiently after the fire has been started, to ensure clean combustion, before reducing the air intake to slow the combustion process. Finally, never use treated or manufactured timber such as treated pine, medium-density fibreboard (MDF), chip board, hard board or similar in wood fires. These products can produce noxious fumes during comSC bustion. June 2010  39