Friday, June 22, 2012

Gas Sensors

The gas sensors are a bit more tricky to connect. We have four gas sensors currently: MQ-4 (CH4), MQ-6 (LPG - butane, propane, etc), MQ-7 (CO), MQ-8 (H2 gas). Some other sensors (ozone, CO2, etc) might be ordered later.

All the sensors are mounted onto little breakout boards that look like the one in the picture below. I've soldered wires to the breakout board to make it easier to connect things to the breadboard.


The sensors all have 6 pins that go into the holes on the breakout board. The breakout board is also labeled, with the 4 wires connecting to H1 (heating element), A1, B1 (data), and GND (ground). For all the breakout boards, I've connected the red wire to H1, blue wire to B1, white to A1, and brown to ground. 

The gas sensors were the hardest to connect, as the data sheet was a bit confusing. We at first connected the B1 and A1 together before realizing that one of them had to be connected to H1 and the voltage supply, while the other had to be connected to data output. 


MQ-4, MQ-6, and MQ-8

The MQ-4, MQ-6, and MQ-8 are all connected the same way: 

 Here's what the actual connection looks like:


My phone just has terrible picture quality.......

You can see the tip of a cigarette lighter on the top of the picture, which we used to test the LPG sensor for butane detection (bit sketchy). The value would rise when the sensor detected the butane gas, but it seemed to drop very slowly, as if the gas was "trapped" in the sensor for a bit. We are thinking of putting a fan close to the sensors to prevent this from happening. The methane and hydrogen sensors aren't tested yet, as we don't really have access to those gases safely. However, they do show decent readings, seeming to imply that they work.


MQ-7

The MQ-7 (Carbon monoxide) sensor is the most complicated of the already complicated gas sensors. In addition to having to connect the blue and white (B1 and A1) leads correctly, it also requires an alternating 5V and 1.4V input created using PWM. I used code from the analogWrite() example to create a PWM wave. The MQ-7 is powered at 5V for 60 seconds, and 1.4V for 90 seconds in each cycle. 

Setup: 



To test the CO sensor, I... uh... burned a sponge with my soldering iron for a little bit, and then captured the fumes with the sensor. The value would rise sharply when CO was detected, but also drop sharply when we removed it from the source of the fumes, so it seems like this one will be the most responsive to rapid changes in the environment. 

Current draw for all sensors is roughly 170 mA. 

I'm leaving the sensors on a 5V power supply for two days to "burn" them in. Apparently, data sheets for the sensors suggest that if you burn them in for 24-48 hrs, they become more stable and accurate when measuring changing gas levels. 

***Edit 6/27/12:
During testing, I accidentally ignored the alternating current and just plugged the sensor into the 5V power source. I tested it again, this time powering the sensor with a alternating current outputted from pin 11 on the Arduino: 

Using the same method to test for CO detection revealed that the sensor responded less to changing CO levels. Room values was about 300. The smoke from the sponge (even when I put the detector very close to the sponge) made the values rise to only about 330. Of course, this is after the sensors "burned in" for two days. The values could have become more stabilized because of that. It could also be because the soldering iron (which I used to burn the sponge with) wasn't as hot since I needed to disconnect it from the power supply before testing (there was no other outlet I could use that was closer to my computer/Arduino set up. 

I asked Dr. Bunn whether we should keep using PWM for this sensor, and he suggested that for the time being, we just stick with 5V: 



No comments:

Post a Comment