CO sensor Figaro TGS2442
As CO sensor, I'm going to use the Figaro TGS2442.
Hardware considerations
Connecting the Figaro TGS2442 is relatively simple (the difficult part is drive its inputs properly!)
The sensor requires application of a 1 second heating cycle which is used in connection with a circuit. voltage cycle of 1 second. Each VH cycle is comprised by 4.8V being applied to the heater for the first 14ms, followed by 0V pulse for the remaining 986ms. The Vc cycle consists of 0V applied for 995ms, followed by 5.0V for 5ms. For achieving optimal sensing characteristics, the sensor's signal should be measured after the midpoint of the 5ms Vc pulse of 5.0V.
The only component to dimension is the load resistance RL. Datasheet states that RL needs to be greater than 10k. I think a 39k resistor is a good trade-off
As usual, I added a buffer and a voltage divider to get a voltage between 0 and 2.0 V
Software implementation
Using the same functions I already talked about in my previous post, I can write a the function to read out the output value provided by the TGS2442 sensor
#define SENSORS_NO2_HEATHER_PORT 3
#define SENSORS_NO2_HEATHER_PIN 0
#define SENSORS_NO2_OUTPUT_PORT 3
#define SENSORS_NO2_OUTPUT_PIN 1
void SENSORS_ReadCO()
{
GPIO_setOutputLowOnPin(SENSORS_NO2_OUTPUT_PORT,
SENSORS_NO2_OUTPUT_PIN);
// generate pulse on heather pin
GPIO_setOutputHighOnPin(SENSORS_NO2_HEATHER_PORT,
SENSORS_NO2_HEATHER_PIN);
delay(14);
GPIO_setOutputLowOnPin(SENSORS_NO2_HEATHER_PORT,
SENSORS_NO2_HEATHER_PIN);
delay(981);
// generate output to measure NO2 level
GPIO_setOutputHighOnPin(SENSORS_NO2_OUTPUT_PORT,
SENSORS_NO2_OUTPUT_PIN);
delay(3);
float val = SENSORS_AnalogRead(ADC12_B_MEMORY_3);
SENSORS_Data.CO = SENSORS_Map(val, 0 , 1023, 0, 100);
}
Currently the delay function is implemented as a simple loop. I'm trying to devise a more energy-efficient implementation
Top Comments