Post a new topicPost a reply Page 1 of 1   [ 2 posts ]
Author Message
 Post subject: Delay in GasSensor Board
PostPosted: Sun May 27, 2012 5:21 pm 

Joined: Wed May 09, 2012 12:06 am
Posts: 12
Hi, i'm writing a sketch to read the output values from GasSensor board with installed :
TGS2442 for CO on 3A
TGS2602 for VOC on 2A
Mic2710 for NO2 on 2B
and Temp/Hum in their Sockets

This is the sKtc:

Quote:
float voc;
float no2;
float co;
float tem;
float hum;

void setup()
{
SensorGas.setBoardMode(SENS_ON);

//RTC.ON(); to define
//setup for Serial port
USB.begin();
USB.println("Setting up GAS sensor board...");
USB.println("\n-------------------------------------------------\n");
//USB.close();
}

void loop()
{

USB.print("\n----------------VOC on TGS2602 skt2A----------------\n");
// TGS2602 on Socket 2A
SensorGas.setSensorMode(SENS_ON, SENS_SOCKET2A);
SensorGas.configureSensor(SENS_SOCKET2A,1,1);

//delay(30000);


USB.print("\n------------------------------\n");
delay(5000);
// delay is right??
voc = SensorGas.readValue(SENS_SOCKET2A) ;

USB.print("total voc = ");
USB.println(voc);

USB.println("----------------------------------------");

SensorGas.setSensorMode(SENS_OFF, SENS_SOCKET2A);

delay(3000);


USB.print("\n----------------NO2 on mic2710 skt2B----------------\n");
// mic2710 on Socket 2B
SensorGas.setSensorMode(SENS_ON, SENS_SOCKET2B);
SensorGas.configureSensor(SENS_SOCKET2B,1,10000);

delay(30000);


USB.print("\n------------------------------\n");
delay(5000);
// delay tbd
no2 = SensorGas.readValue(SENS_SOCKET2B) ;

USB.print("no2 = ");
USB.println(no2);

USB.println("----------------------------------------");

SensorGas.setSensorMode(SENS_OFF, SENS_SOCKET2B);

delay(5000);


USB.print("\n----------------CO on TGS2442 skt3A----------------\n");
// TGS2442 on Socket 3A
SensorGas.setSensorMode(SENS_ON, SENS_SOCKET3A);
SensorGas.configureSensor(SENS_SOCKET2A,1,0.5);

//delay(30000);


USB.print("\n------------------------------\n");
delay(30000);
// delay tbd
co = SensorGas.readValue(SENS_SOCKET3A) ;

USB.print("Co = ");
USB.println(co);

USB.println("----------------------------------------");

SensorGas.setSensorMode(SENS_OFF, SENS_SOCKET3A);

delay(1000);



//value = SensorGas.readValue(SENS_TEMPERATURE);



SensorGas.setSensorMode(SENS_ON, SENS_TEMPERATURE);
tem = SensorCities.readValue(SENS_TEMPERATURE);
USB.print("the temperature value : ");
USB.println(tem);
USB.println(" \n-------------------------------------------------\n");
SensorGas.setSensorMode(SENS_OFF, SENS_TEMPERATURE);

delay(1000);

SensorGas.setSensorMode(SENS_ON, SENS_HUMIDITY);
hum = SensorCities.readValue(SENS_HUMIDITY);
USB.print("the Humidity value : ");
USB.println(hum);
USB.println(" \n-------------------------------------------------\n");
SensorGas.setSensorMode(SENS_OFF, SENS_HUMIDITY);

delay(1000);





}








My questions are:

1. to prevent problems i turn On anf Off every sockets after reading value, so , with kind of delays i have to insert before and after the single operations?
2. is right turn ON and OFF also the temp,hum sockets

Please check if what i've wrote is a possible and operative solution for a multigas reading (in sequence..)

Thanks

Giulio


Top
 Profile  
 
 Post subject: Re: Delay in GasSensor Board
PostPosted: Mon May 28, 2012 11:01 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7455
Hi Giuliogp,

A few tips about how to improve yor code:

1. Load resistor must be expressed in kiloohms, you are exprssing it in ohms for the NO2 sensor.

2. You are not configuring properly the CO sensor, you are selecting socket 2, and setting a gain below the minimum for this sensor (10kiloohms).

3. VERY IMPORTANT: You are reading this sensor wrong!! It is indicated in the technical guide, this sensor MUST NOT BE POWERED or it may be damaged, to read it you should only use the function read value introducing the sockets as SENS_SOCKET3B or SENS_SOCKET4B in order to introduce the supply voltage pulse required.

4. About your first question, the delay time will be a function of the accuracy needed, this sensors take several minutes until they get a flat stable response, so if you need high accuracy and repeatability you sohuld leave them powered for several minutes. In the case of the TGS2602 and MiCS-2710 we have seen that two minutes are enough to get that response, but lower times are feasible in determined applications where full accuracy is not required (thirty seconds is usually more than enough), I'd recommend you to adjust this time in calibration. In the case of the CO sensor, if you are awaiting for a very long time between measurements (more than 5 minutes), I would recommend you to apply several reading cycles before taking the definitive value.

5. Regarding your last question, no, temperature and humidity sensors' supply voltage is directly connected to the board supply, so turning them on or off won't work.

Regards.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 2 posts ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use