A device for detecting toxic gases is a must in every household. This particularly concerns carbon monoxide (CO), as most private houses are equipped with furnaces burning natural gas for heat. Any blocking of the exhaust pipes (e.g. a squirrel in a pipe, or heavy snowfall in winter) might lead to poisoning with lethal outcome.
Commercial devices for detecting CO are priced about $30 - $100 and are generally much more expensive than the ones for detecting CO2. Most of them just detect some presence of CO and launch an alarm without indicating the CO level. Building a CO-meter by yourself is not much less expensive than the cheapest commercial devices of that kind if we consider just the cost of components and their shipping. This is not that bad if you are doing electronics and already have many of them, but the sensor itself costs about $14. However, you can completely control your own device, program the alarm threshold, and adjust it for your needs. It is also worth mentioning that building your own device is at least a $100 fun :)
After some research and browsing I decided to use the TGS 2442 CO sensor manufactured by Figaro Engineering Inc. and purchased it directly from the company. They have a branch in the US. The product information sheet available from the Figaro webpage contains all necessary information on its usage including the timing diagram and a sample circuit. I use a similar circuit but built on MOSFET transistors. This way one can easily achieve clear heating and reading pulses for interfacing with the sensor. The only unclear part was which resistor to use for the voltage divisor by getting the sensor reading. After several experiments I came up with a 3K3 value, which provides a nearly 0 sensing voltage without the presence of CO. According to the sensor specifications, its resistance changes in a factor of 500 in the working range of the gas concentration, so the maximum sensing voltage should be close to 4.5V.
The circuit is straightforward. The PIC takes care on generating the LCD waveforms and timing the sensor. The sensor cycle starts with a 14msec heating impulse at pin RD3 followed by 981 msec waiting period, which in turn, follows by a 5 msec reading impulse at pin RD1. During the data reading impulse the PIC's DAC converts the sensor voltage in digital and compares it with a setup threshold. If the voltage is above the threshold, the PIC generates a 2400Hz buzz for 0.1sec at pin RB5 and turn on the red LED at pin RD0. Otherwise, if the voltage is below the threshold the green LED is turned red from pin RC0. The DAC's reading is converted into the BCD representation and forwarded to the LCD data registers. The LCD codes for tens and units are composed by calling twice the conversion table. Displaying the hundreds needs 3 table calls. Although a 7-segment code for a single digit is just one byte, multiple calls are needed because those bytes are distributed over distant PIC pins. This is done for a convenient layout, which is more difficult to arrange that referring several times to the conversion table in software.
Inner view of the case with boards | Back view of the main board | |
The project is assembled on 3 PCBs in order to fit into my 3.25x2x1.5" plastic project box. One of the PCBs has power supply chip, two electrolytic caps, and an alarm buzzer on it. Another auxiliary board is intended to lift up the LCD up to the level of the front face, and all other components are mounted on the main PCB. The main PCB is put on two 1" posts inside the case and is connected with the LCD board by 24 wires. This is done that way in order to the LCD would appear at the top surface of the box - its own leads are too short for this. In addition to that, I got some room on the main PCB to layout the PIC and other components. I do not know the LCD model, as I purchased it in a surplus store. It is designed to be used in a static mode, has 24 pins placed on a 1.82mm pitch grid, and can display 3 digits with no decimal points between them. The dual color (green/red) LED has long enough own leads to reach the front surface of the box. I used surface mount MOSFETs in the SOT-23 package, however all resistors are regular (not surface mount) because they also serve as jumpers and simplify the layout. The 5-wire connector shown on the left photo is attached temporarily and is used for PIC programming. I plan to purchase a separate wall DC adaptor for this device and solder its wires on place of the currently shown black and red power wires to an auxiliary board inside the box. It should deliver 250mA at 8 - 10V. Mounting the sensor inside the box is done in accordance with the manufacturer's recommendations. Three corner slits in the detector housing facilitate airflow through the sensor compartment. The home-made metal LCD bezel is glued to the front panel.
Schematic | Fully assembled detector | |
My initial plan was to display the CO level in PPM (parts per million) units. However, one needs a working CO-meter for calibration, which I was not able to find. I hope to find one in the future and reprogram my firmware. Therefore, currently my device is programmed to display the value provided by the PIC's DAC. This number is in the range 0 - 255, is proportional to the CO level, and, hence gives some idea on the CO concentration. The alarm turns on as this number exceeds 10. Burning a single match right below the sensor at the home temperature and humidity raises the ADC value to 13 (and launches the alarm). A small piece of burning wood placed in a garage about 1/2" away from sensor raises this value up to 65. If I light on a sigaret below the sensor, the value goes up to 165. So, the sensor is pretty sensible. It responses to the presence of CO after about 15 seconds and it takes 1 - 2 minutes for the sensor to reset after moving it out of the CO source. On the other hand, placing it right at the exhaust pipe of my car running in a closed garage does not affect the displayed value at all. This means that the sensor is not very sensible to other gases.
It should be noticed that CO detectors should use LED displays rather than LCD. This makes it easier to read them under limited light conditions, which is usually the case for the places where the detectors are installed.
Last modified:Mon, Jan 23, 2023.