Application Note – 002c Date of publication: October 22, 2002 Lock-in and Signal Averaging Circuits for an NDIR Gas Spectroscopy Based Carbon Monoxide Detector By Daniel J.M. Guibord Copyright © 2002 Daniel J.M. Guibord - www.guibord.com Reproduction of this document in whole or in part is permitted if both of the following two conditions are satisfied: 1. This notice is included in its entirety at the beginning. 2. There is no charge except to cover the cost of copying. Lock-in and Signal Averaging Circuits for an NDIR Gas Spectroscopy Based Carbon Monoxide Detector SUMMARY This application note describes two circuits (lock-in and signal averaging) for detection and measurement of low levels of carbon monoxide (CO), using Non-Dispersive Infrared (NDIR) gas spectroscopy. NDIR gas detection and measurement offers reliability, sensitivity, and immunity from false alarms for such applications as CO detectors. The lock-in circuit is analog in nature and enables the measurement of CO levels down to 1 ppm, and meets Canadian Standards Association (CSA) requirements for residential CO detectors; while the signal averaging circuit uses a mixed-signals (analog and digital) approach, inherently capable of much higher resolution than that of the analog circuit. INTRODUCTION There are essentially two techniques for extracting faint signals from noise: Lock-in, and Signal Averaging. In both cases, there are no theoretical limits to the depths from which signals can be extracted, below any given noise floor (e.g., thermal). The practical limits, however, are cost and time required for signal lock-in and signal averaging. An analog circuit is described in some details, then a mixed-signals circuit is described in its block diagram format. The mixed-signals circuit approach turns out to be far superior to the analog circuit approach, be it in terms of performance, cost, and reliability. ANALOG CIRCUIT Overview Reference is being made to Figure 1. The circuit compares the signal amplitudes of two MID-IR photodetectors, each irradiated by a common MID-IR source (which may be thermal or quantum in nature), while each photodetector is tuned to a specific wavelength (3.9 µm, and 4.76 µm), within a relatively narrow IR bandwidth. Tuning is accomplished with the use of optical narrow bandpass filters (NBPF), deposited onto the surface of the photodetectors. The IR absorption spectra of CO peaks at 4.76 µm, while offering no absorption at 3.9 µm (gases commonly encountered in a CO environment present no absorption at 3.9 µm). The 3.9 µm tuned photodetector is utilized as a reference. When CO is present between the MID-IR emitter and detectors, a difference in amplitude (amplitude of the electrical signals generated at the photodetectors) results from the absorption of MID-IR at 4.76 µm, by CO, while no signal absorption occurs at 3.9 µm. This difference is amplified by a high gain (160 dB) instrumentation amplifier. A lock-in technique is then utilized to extract the differential signal (deeply buried into amplified Johnson, shot, 1/f, and other forms of noise). The lock-in stage is then followed by a low-pass filter (which further removes noise components, and switching transients, from the signal output of the lock-in circuit). The filtered differential signal is then sent through a peak detector, which maintains a stable voltage level output for 60 seconds, following power turn OFF to the MID-IR source. That signal is then compared (as a function of its amplitude, and as a function of time) to a voltage reference. If the signal exceeds the reference, it latches in a piezoelectric buzzer, providing audible indication of unacceptably high levels of CO, as a function of time. NOTE: The block diagram depicted in Figure 1 makes use of switches where transistors are utilized as simple ON/OFF switches in Figure 2. Refer to Figure 3 for the states of the transistors when utilized as simple ON/OFF switches. -1- Power Supply, Voltage Reference, and Associated Components Reference is being made to Figure 2. R1, R2, and R71 provide a virtual ground located half way between +V and -VBATT, +VBATT and -VBATT, respectively, enabling the use of a single 9 volts dry cell (150 mAh type). +VREF is a precision micropower voltage reference of 2.5 volts. R72 is a pull-up resistor. IC1 is powered directly from the 9 volts battery, whereas the other two time bases (IC2 and IC3), and all Op-Amps (except for IC10, 11, 12, 13, and 14) are powered through the main line switch, Q1, which latter is turned ON/OFF by IC1; enabling reduced power consumption for battery powered applications. Note that Q1 can also be turned ON/OFF by IC11, 12, 13, or 14 (more on this further on). R10 and R11 are current limiting to the base drives of Q1 and Q2, respectively. Time Bases (Main Time Base, Pulse Generator, and 3.75 kHz Oscillator) Reference is being made to Figure 3 and Figure 4. IC1, IC2, and IC3 are CMOS 555 timers. The charge/discharge paths of their timing capacitors take place through small signal diodes (e.g., 1N914 type); thereby, avoiding ohmic values that would otherwise be to close to permissible minimums and maximums, for the proper functioning of the 555s and; it enables reduction of all capacitances to a single value (0.33 uF), for cost reduction purposes, while at the same time providing highly reliable and predictable timing accuracies. MID-IR Emitter, Associated Drive Circuit, and MID-IR Photodetectors Reference is being made to Figure 2. There are two options for the MID-IR emitter: Thermal (a resistive element), and quantum (MID-IR LED). The MID-IR LED source is utilized for this circuit description. The MID-IR LED source is highly efficient from a quantum point of view, relative to the MIDIR thermal source. The MID-IR LED is driven with a constant current of 50 mA, with the use of IC16 (configured as a constant current source). IC16 is powered ON for 2 seconds by Q1, once every 60 seconds. Laser trimming of R13 is utilized for setting the voltage, at the non-inverting input of IC5, equal to that of IC4. R83 is current limiting to the base drive of Q21. High Gain Instrumentation Amplifier Reference is being made to Figure 2. The circuit topology is that of a high gain instrumentation amplifier, and conservative. A differential voltage gain of 10,000 for the input stage (IC4 and IC5) is definable through R15; while the output stage, IC6, also provides a differential voltage gain of 10,000. These two stages can provide a total gain of 100,000,000 (160 dB). IC7 provides common mode rejection and offset compensation. Three laser trimmed resistors, R15, R21, and R28, allow fine adjustment of the amplifier’s gain, CMRR, and offset, respectively; while R16 provides scaling of the 3.9 µm MID-IR photodetector’s signal. C10 is a DC blocking capacitor, converting the output DC signal of the high gain instrumentation amplifier into an AC signal, as seen by the Op-Amp of the Lock-in Demodulator, IC8. D23 and D24 clip the output voltage of IC6 to 6 volts peak-to-peak, thereby, preventing the Op-Amp from saturating, which would otherwise limit its gain to less than 80 dB at < 5 kHz. Strings of small signal diodes with fast recovery times (e.g., 1N914) are required instead of 3.0 V zeners (e.g., MMBZ5225BLT1), due to the latter’s high leakage current and soft knee in the < 6.2 volts region. Lock-in Demodulator Reference is being made to Figure 4. The lock-in demodulator (also called: Balanced Demodulator, Synchronous Demodulator, Phase Sensitive Detector, or Phase Sensitive Rectifier) rectifies the signal present at its input, as a function of the 3.75 kHz oscillator’s signal (IC3), which drives Q3 and Q4, providing the net effective equivalent of a narrow (1 Hz) bandpass filter tuned to 3.75 kHz. The output of the lock-in demodulator (Q3 and Q4 circuit node) is sent through a low-pass filter (R34 and C4), of which the corner frequency is set to 1.34 Hz, which removes carrier components (3.75 kHz) of the rectified signal, along with any other type of amplified noise (Johnson, shot, 1/f, etc.). The corner frequency of 1.34 Hz enables to charge/discharge C4 to 7 time constants, within less than 0.831 second (the peak detector is reset following 0.990 second, each time Q1 turns ON). Reference is being made to Figure 3. IC8 is configured as a unity gain inverting buffer. Q3 and Q4 are utilized as line switches for the rectification of the input signal (C10-R23 node). R77 is a pull-up resistor, while R78 is current limiting to the base drive of Q5. -2- Peak Detector Reference is being made to Figure 2. The output of the lock-in demodulator is sent to IC9, configured as a non-inverting unity gain buffer, and driving the input of the peak detector. D11 prevents C5 from discharging. R40 prevents oscillation of IC9, which latter would otherwise be looking straight into a purely capacitive load, while R39 limits the discharge current of C5 through Q10, and Q11. Reference is being made to Figure 3. Q9 turns OFF once every 60 seconds, turning Q10 and Q11 ON, which discharges C5 during the LOW portion of the pulse generator’s output (IC2). IC10 is chosen for its high input impedance, providing less than 0.1% droop of C5’s voltage during 60 seconds. R36, R37, and R38 are current limiting to the base drives of Q9, Q10, and Q11, respectively, while R35 is a pull-up resistor. PPM Level Comparators Reference is being made to Figure 2. The signal’s level at each comparator’s inverting input is compared to the reference at their respective non-inverting inputs. Their rate of rise is also set by an RC time constant (R41C6, R48C7, R51C8, R56C9), so that the comparators’ outputs will change state (from HIGH to LOW), according to the levels of CO detected, and as a function of time, meeting CSA standard (CAN/CGA-6.19-M93) for Residential Carbon Monoxide Detectors (see Table 1). Q12 through Q19 are turned ON by the Reset Switch, thereby discharging (resetting) the capacitors that make up the RC time constants (R41C6, R48C7, R51C8, R56C9), following an abnormally high level of CO, indicated by the audible alarm triggered by the detection circuit. R44, R45, R49, R50, R54, R55, R59, and R60 provide a small hysteresis to the comparators; thereby, avoiding audible alarms that would otherwise occur in an intermittent fashion at the onset of detection of an abnormally high level of CO. D12 through D15 prevent the outputs of each comparator from sourcing into the other comparators’ outputs, should one of the comparators’ outputs go LOW. R42, R43, R47, R48, R52, R53, R57, and R58 are current limiting to the base drive of Q12 to Q19, respectively, while R73 is a pull-down resistor. Carbon Monoxide Concentration Versus Time For 10 Per Cent Carboxyhaemoglobin (Cohb) A. Carbon monoxide concentration and response time: Concentration (ppm) Maximum response time (minutes) 100 200 400 90 35 15 B. False alarm resistance specification: Concentration (ppm) Exposure time (minutes) (no alarm) 100 ± 5 9 + 3 minus 5 5 480 Table 1 NOTE: The 9 ppm detection level is not required for CSA approval. However, it was designed into the circuit, for the purpose of exploring and evaluating the limits of what can be accomplished with an analog approach to measuring CO to 1 ppm. If the 9 ppm detection level (as a function of time; e.g., > 480 minutes) would be required, say for purposes of sensitivity as a function of time (480 minutes), then 100 megaohms shunt resistors would have to be introduced into the circuit (in parallel with C6 through C9), in order to reduce the error that would otherwise result from the leakage of the capacitors utilized for the RC time constants, given the extremely high ohmic values (e.g., 12.5 gigaohms) required of their associated resistors (R41, R48, R51, R56). These shunt resistors are illustrated as R66 through R69. In other words, the circuit is shown with RC time constants that are equal to just below the maximum permissible time limits set by CSA, including the 9 ppm level, for the purpose of illustrating the limits of what can be accomplished with the analog approach taken for the design of this circuit; while in fact the circuit can meet CSA requirements with much smaller time constants (e.g., 30 seconds), than the ones illustrated by -3- the time constant values set by the circuit’s components (e.g., 90, 35, and 15 minutes, for the 100, 200, and 400 ppm levels, respectively). An abnormally high level of CO sends the output of one of the comparators LOW, turning Q1 and Q20 ON, via R79, and D17 and R65, respectively. Q1 and Q20 remain ON, until the Reset Switch is manually actuated. When Q20 turns ON, it enables IC3 to drive the piezoelectric buzzer. Low Battery Voltage Detector and Indicator Reference is being made to Figure 2. If the battery voltage falls below that stipulated in the CSA Standard (CAN/CGA-6.19-M93) for Residential Carbon Monoxide Detectors, then the piezoelectric buzzer is turned ON (via Q20 and IC15) thereby allowing IC3 to drive it for 10 milliseconds (enabled by the 10 milliseconds pulse of IC2 at the non-inverting input of IC15 (Refer to Figure 3). IC15 is configured as a summing comparator (through R61, R64, and R76). The latter compares the battery voltage to the reference voltage +VREF. If the battery voltage falls below the preset minimum, the output of IC15 goes LOW, enabling a 10 milliseconds beep once every 60 seconds. R62 and R63 form a voltage divider for the input signal received from the output of IC2 (leaving –VBATT compared to +VREF when the output of IC2 goes LOW). D17 prevents the output of IC15 from latching Q1 ON, while D16 prevents the outputs of the PPM comparators from sourcing into the output of IC15, should one of the comparators’ outputs go LOW. R65 is current limiting to the base drive of Q20, while R74 is a pull-up resistor. D1 provides a “Status OK” indication for 10 milliseconds, once every 60 seconds, driven by the LOW of IC2’s output pulse. R3 is current limiting to D1. Analog Circuit - Parts list • • • • • • • • • • • • • • • • MID-IR LED : 4600-4800 nm, Ioffe Physico-Technical Institute, 26, Polytechnicheskaya, 194021, StPetersburg, Russia - http://www.ioffe.rssi.ru MID-IR Photodetectors : Philips RPY77 (InSb). NOTE : Philips Electronics no longer manufactures IR detectors of the InSb or MCT types; however, equivalent detectors can be obtained from Judson (EG&G) - http://www.judsontechnologies.com Voltage Reference : REF192 Analog Devices; or equivalent - http://www.analog.com IC1, IC2, IC3 : LMC555 National Semiconductor, or equivalent; CMOS 555 timer http://www.national.com IC4, IC5, IC6 : LMH6632 National Semiconductor; high open loop gain Op-Amp http://www.national.com IC7, IC8, IC9, IC10, IC11 through IC16 : LMC6442 National Semiconductor; low voltage Op-Amp http://www.national.com Q1, Q20 : 2N2907 Motorola; general purpose small signal - http://www.onsemi.com Q2, Q5 through Q19, Q21 : 2N2222 Motorola; general purpose small signal - http://www.onsemi.com Q3 and Q4 : MMBFJ177LT1 Motorola; P Channel FETs , low VGS(off) - http://www.onsemi.com All Diodes : 1N914, or equivalent D23, D24 : 1N914 X 6, or equivalent D1 : 10 mA LED All Capacitors : 0.33 uF polypropylene; low leakage All Resistors : 0.25 W metal film Piezoelectric buzzer. NOTE : the frequency of oscillator IC3 should be selected to match the peak frequency response of the selected buzzer. In other words, the frequency of oscillation can be anywhere between 1 and 5 kHz; it will not affect the performance of the lock-in circuit. ______________________________________________ -4- 9V -VBATT +VBATT -VBATT +V +V 4.76 um Detector 100PPM RCT imeConstant 9 PPM(+3 minus 5) RCTimeConstant MID-IR LED Q1 +VREF Q14 - Q 15 +VREF Q12 - Q 13 -VBATT 3.9 um Detector 1K -VBATT 500 1K +V -VBATT IC5 +V 4 6 IC7 +V -VBATT -VBATT IC6 +V 400PPM RCT imeConstant 200PPM RCT imeConstant +VREF Q18 - Q 19 +VREF Q16 - Q 17 -VBATT +VREF R23 -VBATT IC1 +VBATT -V BATT IC8 +V -5- 0V Q4 Q3 -V BATT -V BATT IC2 PulseGenerator -V BATT IC15 +V 0V Low-Pass Filter Low Battery Voltage Detector and Indicator +VREF -VBATT Lock-in Demodulator Figure 1 -VBATT IC14 +VBATT -VBATT IC13 MainTimeBase C10 High Gain Instrumentation Amplifier +VREF PPM Level Comparators (as a function of time) -V BATT IC12 +VBATT -V BATT IC11 2 REF192 -VBATT IC4 3 +VBATT 10K +V NDIR CO Detector (MID-IR LED Option) - Block Diagram 0V -VBATT Q20 Piezo Buzzer Q 10 - Q 11 -VBATT IC9 +V -VBATT IC3 NOT E:Waveforms depictedarenottoscale Reset Switch +V "Status OK" Indicator -V BATT IC10 +VBATT Peak Detector +VBATT 3.75KHz Oscillator +V 9V R46 +V 100K R42 100K R48 100K R47 100K 2.3G R10 1K R83 200 +V Q15 Q13 R66 R67 C7 30K R112 R49 +VREF Q14 100PPM C6 10K 0.33uF 10K 0.33uF R79 1K Las er Trim 316K R111 R44 +VREF Q12 R71 +V 9 PPM(+3 minus 5) -V BATT R13 500 1K MID-IR LED -V BATT Q21 3.9um Detec tor 1K 10K +V -V BATT R2 R1 R11 R12 4.76um Detec tor -VBATT -V BATT R43 R41 Q1 Q2 1K IC16 12.5G R84 -VBATT 50 +VREF -V BATT +VBATT R72 3 -VBATT IC4 +V 10K R14 4 REF192 2 -V BATT -V BATT R50 1M IC12 +VBATT R45 1M IC11 +VBATT 10K D12 1K 200 900 D23 D24 Laser Trim CMRR R19 0.1 R17 +VREF R21 R20 R18 10M +V D3 IC7 +V 2 6 7 0.33uF 100K R57 100K R58 R56 389M R53 100K R52 100K 909M R51 Q19 Q17 R68 R 69 R114 R59 +VREF Q18 C9 100 R113 400PPM C8 10K R54 +VREF Q16 200PPM IC1 1 100K R22 1M 10K R7 D 22 D15 D 21 -V BATT -6- R6 D5 10M D14 R26 10M 10K R77 R78 10K D9 -V BATT 10K R 63 R 61 R76 1 100K 10M 3 5 R64 -V BATT IC2 100K +V 4 8 +V -V BATT IC15 +V 360K C4 D16 D 17 C10 -VBATT R9 R8 R35 Q9 +V 0.33uF 100K R34 Low-Pass Filter 100K R36 192K 192K PulseGenerator NC Low Battery Voltage Detector and Indicator R62 10K +V REF -V BATT -VBATT Q5 +V D8 Q4 R25 Q3 2 6 7 0.33uF -VBATT C2 D4 Lock-in Demodulator Figure 2 -VBATT IC14 +V BATT R55 -VBATT IC13 R60 1M 0.33uF 10K 0.33uF +V IC8 100K +V BATT 97.6K 43.7K 2.76M MainTimeBase NC R24 Laser Trim Offs et 100K -VBATT R29 R28 200 R27 +VBATT R23 3 5 50K +VBATT -VBATT 4 8 +VBATT 0.33uF C10 -VBATT C1 D2 -VBATT -VBATT IC6 R5 R4 High Gain Instrumentation Amplifier Las er Trim3.9 um Detec tor Gain R16 1 10K 6 257M 4.33M PPM (as a function of time) Level Comparators D20 D13 D19 -VBATT IC5 +V Laser Trim R InstrumentationAmplifier Gain15 1K +VBATT NDIR CO Detector (MID-IR LED Option) - Circuit Schematic 10K 10K R73 R74 +V 2 6 7 0.001uF R65 10K -V BATT Q20 1 D18 C5 1K 3 5 3.75KHzOscillator NC NOT E:Waveforms depictedarenottoscale +VBATT 0.33uF R40 Reset Switch 1K +V R3 D1 "Status OK" Indicator -VBATT IC10 +VBATT Peak Detector D11 -VBATT IC3 Piezo Buzzer Q11 Q10 4 8 +V R39 1K -VBATT IC9 +V -VBATT 0.33uF R38 100K R37 100K D7 C3 D6 +V ON OFF ON OFF OFF Q10 and Q 11 Q9 Q1 and Q 2 ON -V BATT IC2 +V -V BATT IC1 +V BATT 10milliseconds 1 second 60 seconds -7- Figure 3 2- The pulse of 10 milliseconds enables discharge of C 5; in other words, it clears the peak lev el recorded during the prev ious pulse of 2 seconds of the main time base, IC 1, so that a v alid CO lev el measurement may occur during the period that f ollows the pulse of 10 milliseconds 1- A time delay of one second is introduced f or the components and wav ef orms to reach a state of equilibrium. NOTES: 2 seconds NDIR CO Detector - Timing Waveforms and Pulse Widths Diagram OFF ON OFF FilteredSignal RectifiedSignal Signal tobe retrieved Q4 Q3 ON 100% 50% 2- The amplitude of the wav ef orms is not to scale -8- Figure 4 1- Giv en that the amplitude of the noise component is 10 6 greater than the signal that is required to be retriev ed, the noise component is not shown f or clarity of illustration NOTES: NOTE : The f iltered signal is located at the non-inv erting input of IC9 NOTE : The rectif ied signal is located at the circuit node of Q3 and Q4 NOTE : The signal that is required to be retriev ed is located at the circuit node of C 10 and R 23 3.75 KHzOutputWaveform IC3 NDIR CO Detector - Lock-in Demodulator Waveforms Diagram - + - + - + 0 Volts (GND) 0 Volts (GND) 0 Volts (GND) -V BATT +V BATT MIXED-SIGNALS CIRCUIT Reference is being made to Figure 6. The differential signal and its noise components are amplified by the high gain instrumentation amplifier, of which the output is sent to an A/D converter (The Cypress MicroSystems’ Programmable System-on-Chip (PSoC) harbors a software definable A/D converter, with up to 11 bits of resolution at this point in time). The output of the A/D is then processed by software internal to the PSoC, using signal averaging techniques to extract the desired information (the signal sought). Figure 1 illustrates signal averaging. The cost of the components is, approximately, $1.00 for the high gain instrumentation amplifier, and $2.80 (in quantities > 100) for the Cypress MicroSystems’ CY8C25122 PSoC FLASH based microcontroller (4K FLASH, 128B RAM. 8 PIN DIP). The mixed-signals approach has significant advantages over the analog circuit approach from an electronics point of view. A few of these are that laser trims would likely not be required, nor the use of auto-zeroing techniques (which latter may turn out necessary for the analog circuit, in order to counteract components’ drifts as a function of time, given that, for the analog circuit, the latter is pushed to the limits of stability in terms of long term drifts that may affect the circuit’s reliability, given the magnitudes of the circuit’s voltage gains). Additionally, even if going to an ASIC for the analog circuit, the components’ cost, for the digital circuit, would be approximately 5 or more times cheaper than for the analog circuit. Moreover, digital information can be obtained at its output (e.g., numerical values concerning the level of gas measured, fluctuations measured as a function of time, etc., and serial data that can be sent directly to, say an LCD display, the latter equipped with a serial to parallel converter). It is of note that, although the block diagram shows tuned emitters and detectors, only the emitters or detectors may be tuned. Moreover, the circuit can be made to work equally well by pulsing the detectors instead of the emitters. In terms of integration time (the time required for signal averaging), less than one minute worst case seems a reasonable estimate for producing reliable and meaningful information at the output of the PSoC (e.g., detection and measurement of CO down to <1 ppm). Mössbauer absorption spectrum showing effect of signal averaging. (Reproduced from The Art of Electronics, by Dr. P. Horowitz, and Dr. W. Hill) Figure 5 -9- 9V -VBATT -VBATT +V BATT +V REF Tuned Emitter Tuned Emitter +VBATT -V BATT Tuned Detector 3.9um -V BATT Ion-OpticsT unedBand Emitters andReceivers Tuned Detector 4.76um +V REF Analog -V BATT IC2 +V BATT -V BATT IC1 +V BATT Las er Trim CMRR - 10 - Figure 5 -V BATT IC4 +V BATT -VBATT IC3 +VBATT HighGainInstrumentationAmplif ier -VBATT Las er Trim Offs et +VREF Mixed-Signals NDIR CO Detector - Block Diagram -VBATT Piezo Buzzer A/D M8C8-bit Microcontroller Core SRAM Reset Switch +VBATT Digital "Status OK" Indicator +V BATT I/OTransceiv ers FLASH Program Memory Cy press MicroSy stems' 8-Bit Progammable Sy stem-on-Chip(PSoC)Microcontroller Serial Output Mixed-Signals Circuit - Parts List • • IC1, IC2 IC3 IC4: LMH6632 National Semiconductor; high open loop gain Op-Amp http://www.national.com Cypress MicroSystems’ Programmable System-on-Chip (PSoC): CY8C25122 PSoC FLASH based microcontroller (4K FLASH, 128B RAM. 8 PIN DIP) - http://www.cypressmicro.com ______________________________________________ CONCLUSION State of the art technology (such as the Cypress MicroSystems’ Programmable System-on-Chip (PSoC)), applied to NDIR gas spectroscopy, coupled to signal averaging techniques, can enable low cost ultra-high resolution gas detection and measurement. ______________________________________________ - 11 -