By now you must be getting the idea that I really like Gadgeteer and you would be absolutely correct. I’m an idea guy and Gadgeteer gives me an easy to use medium in which to explore my ideas by creating working prototypes. Like most people I am keenly interested in the world around me, and in particular the world I can’t see (or at least hope I can’t see it, otherwise that might be a bad sign). For example air quality is pretty much a universal hot topic all over our planet, and I’d like to participate in those discussions as an informed contributor where I can share information based on data and not just opinion. While everyone is entitled to an opinion, one must be very careful of opinions as often they are just that, an opinion without data or facts to back them up and as such shouldn’t carry much weigh, however some people and even so called scientists often confuse facts with ‘volume’ of their opinion, which is a dangerous thing in the public media as public opinion can be mislead by ‘volume’. My objective for this Gadgeteer device was to explore some air quality sensors and their value as data providers. The project also gave me a chance to evaluate the new Cerberus board and .NetMF 4.2.
First the components, currently there no native Gadgeteer air quality or gas sensors, but there is a Grove Expansion module which allows you to use Grove modules with Gadgeteer, so I picked up the following Grove Sensors:
Grove -Air quality sensor 1.0 The sensor is designed for indoor air quality testing. The main gas detected is carbon monoxide, alcohol, acetone, thinner, formaldehyde and other slightly toxic gases.
Grove - Gas Sensor(MQ2) The Grove - Gas Sensor(MQ2) module is useful for gas leakage detecting(in home and industry). It can detect LPG, i-butane, methane, alcohol, Hydrogen and so on. Based on its fast response time. measurements can be taken as soon as possible. Also the sensitivity can be adjusted by the potentiometer.
Grove - Gas Sensor(MQ5) The Grove - Gas Sensor(MQ5) module is useful for gas leakage detecting(in home and industry). It can detect LPG, natural gas, town gas and so on. Based on its fast response time. measurements can be taken as soon as possible. Also the sensitivity can be adjusted by the potentiometer.
As mentioned I wanted to use the FEZ Cerberus Mainboard as its a 100% open source hardware .NET Gadgeteer-compatible mainboard with 168Mhz 32bit Cortex M4 processor with floating point, 1MB FLASH and 192KB RAM. This tiny mainboard has plenty of peripherals exposed on 8 sockets. A perfect match for robotics, quadcopters and cloud-sensor-monitoring. The 112KBytes of heap memory offers plenty of memory needed for about any network or internet connected application and has a killer price of $29.95, so how could I say No to trying this. One thing to note is the Cerberus runs .NetMF 4.2, which caused some problems in that Seeed hasn’t released 4.2 drivers for their modules yet and the 4.1 driver for the Grove Expansion module was pretty much garbage, fortunately the board is almost identical to GHI Electronics Eblock Expansion module so initially I was able to modify that driver to work with the Grove Expansion module, but later the fine folks at GHI Electronics took it upon themselves to release 4.2 versions of Seeed’s modules, to which everyone in the Gadgeteer community is grateful.
Now the sensor are all analog based sensors meaning you just have to get a voltage reading as the sensor reports back different levels as different voltages on a pin so we first declare AnalogInputs:
private AnalogInput _aq;
private AnalogInput _mq2;
private AnalogInput _mq5;
and then assign them pins (see back of Grove Expansion Module for which pins to use for Analog inputs).
_mq2 = groveExpansion.SetupAnalogInput(Socket.Pin.Three);
_aq = groveExpansion.SetupAnalogInput(Socket.Pin.Four);
_mq5 = groveExpansion.SetupAnalogInput(Socket.Pin.Five);
now all we have to do is query the the AnalogInputs for voltages or Proportions
double mq2v = _mq2.ReadVoltage();
double mq2p = _mq2.ReadProportion();
double mq5v = _mq5.ReadVoltage();
double mq5p = _mq5.ReadProportion();
double aqv = _aq.ReadVoltage();
double aqp = _aq.ReadProportion();
Now this brings up what do these voltages mean, how are they calibrated and that is the million dollar question as to calibrate a sensor you have either a known gas sample, or you have a calibrated gas sensor to compare with, neither of which I have, so what good is a gas sensor if its not calibrated? What I’m looking for really is ‘change’ so if I assume that my air is generally OK now, what I’m looking for is changes to my current readings. For example I ran my device for sometime, recording the measurements every 5 seconds and I could see spikes in the reading which were caused by various events in my local area (eg using the BBQ outside my office, cutting the lawns, etc)
I believe there is a sensor ‘break in period’ which can be seen initially. So I can see changes in my air quality which isn’t bad for a $7 to $15 sensor and I have some data on which I can form an opinion on.
Source code for this project is available at TinyCLR and discussion if any here.
Now after completing and testing this project one of the things I’d like to see is native Gas Sensor modules for Gadgeteer and it should be really easy to build a killer Gas Sensor module that can sensor a number of different gases and such and I’ve outlined the killer feature here, hopefully someone will build such a module soon as I’d be happy to buy a number of them.