air quality monitor: lot's of questions


i’m new here,
new with arduino,

i’m trying to build an air quality monitor.
at first i’m running it connected to my pc, and saving the data from the serial motor
in time, it should run on battery and save data on an sdcard, even send it via ethernet, and show it on an lcd… (still miles away)
this project will be finished since i need to control air quality in the building. going along i hope to learn a lot. and maybe this post can become a tutorial for the complete device.

so far i have already connected some sensors, (some are on back-order).
i have made a copy-paste from the output on the serial monitor.

MQ-6 : LPG, butane gas : 33
MQ-9 : Carbon Monoxide, flammable gasses : 167
MQ-2 : Methane, Butane, LPG, smoke : 177
hr201 : humidity : 55

i have always used “shield-sensors”; they were on a pcb and i could connect the Vcc, ground, analog, digital directly. (did not use the digital pin);

a few questions first

1)how can i calibrate these sensors ?
1a)the humidity pin: i have found a formula: sensorValue4 = -47.65*(sensorValue4*5.0/1024)+290.63;
1b)the others i need the measure the R0/Rs, did somebody do this ? i’m a bit stuck, it looks like the real calibration has to be done by a decent gas combustion analyzer…
1c)the MQ-9 can measure CO if the heater has 1.5v, i connect it to 3.3Vcc, does that mean that i’m not measuring CO anymore ? and how can i supply 1.5V since it is a shield and not a sensor with some resistors…

2)i’m trying to use a time stamp on the measurments.
2a)i can use the pc’s internal clock: ask every time before sending information the time (i haven’t seen any sketch)
2b)i can ask the pc time once, and then let the arduino calculate the time passing. (i know it is not accurate)
2c)i have also a RTC DS3231 AT24C32 but no matter what script and library i use, i cannot get it to work
2d)what is the best way to have a very accurate time stamp ? (what device could be used when standalone ? )

so can anybody point me to a library and a sketch that helps me plot the time and date on the serial monitor ?
(i have tried everything).

this is my first sketch

  air quality monitor
  displays values on the serial monitor every 6 seconds
void setup() {

void loop() {
 int sensorValue1 = analogRead(A1);
 Serial. print("MQ-6 : LPG, butane gas : ");
 int sensorValue2 = analogRead(A2);
 Serial. print("MQ-9 : Carbon Monoxide, flammable gasses : ");
 int sensorValue3 = analogRead(A3);
 Serial. print("MQ-2 : Methane, Butane, LPG, smoke : ");
 int sensorValue4 = analogRead(A4);
 Serial. print("hr201 : humidity : ");
 sensorValue4 = -47.65*(sensorValue4*5.0/1024)+290.63;

  delay (60000);

Calibration of sensors can be difficult. I have found that most domestic temperature and humidity sensors are not very accurate.

You could use look up tables, to convert the readings into the correct values, but you'd somehow need to expose your sensors to a wide range or environmental conditions and monitor what values they output versus what they should be giving.

If you are sending data via Ethernet you could do the look up tables on your server rathe than in the Arduino .

Re: time stamp

The RTC modules usually work ok. If your device is permanently connected to the Internet, you can probably get the time from the net and just rely on the crystal controlled timing oscillator of the Arduino and use the Time library.

Hi fillemon!

Here I have one Tiny RTC module working (DS1307 and 24C32AN). I had use a different library, but right now I'm using this. I had a very hard time when I tried put this module running. I buy the module on eBay, and the first time I tried it, it didn't work. After many hours I conclude that the DS1307 was damage. I buy another module an the behaviour was the same. After many tests I add a resistor of 1k between SDA and Vcc, and until today it's running.

Hi, Sorry about the difficulties, but you proved you have Engineering Requirement #1 : persistence.

Some RealTimeClock info and examples HERE:

The gas sensors you show are "Taguchi Gas Sensors" See THIS:

There is a specific TGS that is supposed to be "Air Pollution": sensitive.

The US National Institutes of Health has THIS: reference:

THIS: is an indoor air quality sensor.

first: thanks a lot for the usefull information. second: excuse me for the late reply.

i have found that it is very very hard to get any reading right without a decent and expensive meter that can be used as calibration.

i might hire a decent meter, to get all the calibrations right.

but then i wonder,

1)how hard will these cheap sensors drift ? 2)how long will they stay in lets say 5 % of the calibration

i have also bought a particle counter, but again without no calibration no good. so is there a calibrated particle counter available on ther market that i could connect to an arduino. i have looked around but not yet found anything but compelete devices like the fluke 985, or the cheap dylos, (which a lot of replica's are starting to fluid the market);

if this does not exist, i might buy 10 cheap particle counters, and look up the formula that calibrates them and sell them off for a small extra fee. oh i bought the Sharp GP2Y1010AU0F;

thanks guys

there is an old saying that accuracy costs money. how accurate can you afford to be ?

you can purchase calibration gases and then subject your sensor to a know value. pretty easy to do, once you have the gas.

for the air quality sensor. you might find some specific gasses like O2 or nitrogen or even CO2 at your welding supply house.

for some, you can just make your own. chemistry class would offer how to make what you need. electrolysis of some liquids will release some gasses.

if you go this route, you need one regulator for each gas. also, get the lowest flow rate you can. you can easily empty a gas cylendar in 20 minutes without knowing you used it that fast.

check the manufacturers calibration data sheets. the CO2 units I used to calibrate would consume the CO2 when enclosed. so zero was the easy one to calibrate.