Saturday, April 07, 2007

Gas Sensors

Tonight Christian and I played with our Figaro gas sensors and got good results with the 2602 (see Figaro datasheet). The 2602 senses the air contaminants emitted by cigarette smoke as well as odorous gases such as ammonia, hydrogen sulfide, and toluene. The sensor is actually fairly easy to wire - it just needs a variable resistor, connections to power and ground, and a connection to the arduino analog input. We used a potentiometer as our variable resistor, at the suggestion of the ITP sensor workshop page on gas sensors. The pot is connected to pin 2 of the sensors and the analog input pin 0 of arduino. We read values into Arduino with the following code:

int gasSensor = 0; // select input pin for gasSensor
int val = 0; // variable to store the value coming from the sensor

void setup() {
Serial.begin(9600);
}

void loop() {
val = analogRead(gasSensor); // read the value from the sensor
Serial.println( val );
delay(500);
}

Since one of the gases the 2602 is supposed to sense is ammonia, we bought some Lemon Ammonia from our friendly neighborhood Kmart (only $1.30 for 64 FL OZ - what a bargain!) and stuck the sensor near the top of the bottle. The readings in Arduino skyrocketed from around 90-100 to 590-600. We have yet to translate that into something meaningful, such as parts per million. Also, the values vary pretty radically depending on the resistance of the potentiometer.

Next on the to-do list is to hookup the 2442 sensor and get readings from it. Christian is working on getting the XBees to transmit the data from the sensors, and I'm going to try to power the Xbees and sensors from recharable batteries, which are in turn powered from solar panels.

0 comments: