Post a new topicPost a reply Page 1 of 3   [ 22 posts ]
Go to page 1, 2, 3  Next
Author Message
 Post subject: Re: How to programme the waspmote to get CO value?
PostPosted: Sat May 07, 2011 12:03 pm 

Joined: Wed Nov 10, 2010 9:45 am
Posts: 271
Location: Australia
The humidity sensor graph is a linear function: -

That is: -

y = mx + b

on the humidity sensor datasheet

y = Voltage out >> ie.- SensorGas.readValue(SENS_HUMDITY) << that value is your voltage out.

x = Relative humidity(%).

From the graph, just pick 2 points on the graph >> I picked the following: -

Y1 = 1.75 volts , X1 = 30

Y2 = 3 Volts , X2 = 70

the gradient m = ( Y2 - Y1 ) / ( X2 - X1) = ( 3 - 1.75 ) / (70 - 30) = 1.25 / 50 = 0.025

to find the intercept ie. b : -

b = y - mx

for y = 3
m = 0.025
x = 70

b = 3 - (0.025*70) = 1.25

Hence Humidity x is : -

x = (y - b)/m

Humidity(%) = ((SensorGas.readValue(SENS_HUMIDITY) - 1.25) / 0.025

That equation will be sufficient for your needs.

The reason for this equation Humidity(%RH) = ((Voltage_Read*5000/3.3 )- 800)/31; is calculated with the maximum resolution of the waspmote. << Look at Section 2.0 Hardware in the Waspmote Manual and you will get your answer.


Your Carbon Monoxide sensor needs to be calibrated before use. The graph provided on the datasheet is in log scale. Therefore you have to use the following equation: -

log(y) = mlog(x) + log(b) ; get the linear erlationship as I showed you above. and from Vout you can work out Rs. << Look at your Gas Board Manual.

Goodluck!!


Top
 Profile  
 
 Post subject: Re: How to programme the waspmote to get CO value?
PostPosted: Mon May 09, 2011 9:56 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7487
Hi all,

Great post, AmroQuandour, thank you very much!

sayantanib, if you need further help, please let us know, but I think the post by AmroQuandour should be enough, it is very well explained.

Regards.


Top
 OnlineProfile  
 
 Post subject: Re: How to programme the waspmote to get CO value?
PostPosted: Fri May 13, 2011 2:12 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7487
Hi sayantanib,

I'll try to clarify it a little bit:

The conversion you should use for humidity:

humidity = float(readValue) * 5000 / 1023;

humidity = (humidity - 800) / 31;

It has been extracted from the agriculture board API, you may take a look at the humidity_conversion function.

Regarding the gas sensor calibration, take a look at this posts, and let us know if you have any other question:

viewtopic.php?f=15&t=392

viewtopic.php?f=15&t=1159

viewtopic.php?f=15&t=1582

Regards.


Top
 OnlineProfile  
 
 Post subject: Re: How to programme the waspmote to get CO value?
PostPosted: Wed Aug 31, 2011 4:57 am 

Joined: Mon Jul 25, 2011 3:36 am
Posts: 54
It is indeed a great post by AmroQuandour and can be useful for many viewers. However I noticed two small typos in Amro's post which is worth being addressed.

1 : In the post, it is mentioned that in order to calculate m:

the gradient m = ( Y2 - Y1 ) / ( X2 - X1) = ( 3 - 1.75 ) / (70 - 30) = 1.25 /50 = 0.025

which should be changed to :

the gradient m = ( Y2 - Y1 ) / ( X2 - X1) = ( 3 - 1.75 ) / (70 - 30) = 1.25 / 40 = 0.031

and hence :
b = y - mx = 3 - (0.031*70) = 0.81

2: I also think that in the Carbon Monoxide sensor data sheet, both the vertical and horizontal axis of a plot is scaled logarithmically, the plot is referred to as a log-log plot. The equation for a line on a log-log scale would be:

Log(y) = mlog(x) + b or
y = (x^m)(10^b)

instead of log(y) = mlog(x) + log(b)

Regards


Top
 Profile  
 
 Post subject: Re: How to programme the waspmote to get CO value?
PostPosted: Thu Sep 01, 2011 9:42 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7487
Hi Amin,

thank you very much for the corrections, we hadn't noticed them when reviewing the post.

Best regards.


Top
 OnlineProfile  
 
 Post subject: Re: How to programme the waspmote to get CO value?
PostPosted: Thu Sep 01, 2011 3:28 pm 

Joined: Wed Nov 10, 2010 9:45 am
Posts: 271
Location: Australia
Dear Amin.

Thanks for the corrections.

You are right about the log equation: -

Log(y) = mlog(x) + b
y = (x^m)(10^b)
The proof is
--------------------------------------------

Log(y) - b = mlog(x)

=> 10^(log(y) - b) = 10^(mlog(x))

=> 10^(log(y)*10^(-b) = x^m

=> y * 10^-b = x^m

=> y / (10^b) = x^m

=> y = x^m * 10^b


---------------------------------------------


Top
 Profile  
 
 Post subject: Re: How to programme the waspmote to get CO value?
PostPosted: Mon Sep 05, 2011 3:34 am 

Joined: Mon Jul 25, 2011 3:36 am
Posts: 54
Hi libelium-dev and AmroQuandour,

No worries, my pleasure :-)

Cheers


Top
 Profile  
 
 Post subject: Re: How to programme the waspmote to get CO value?
PostPosted: Thu Aug 02, 2012 5:07 am 

Joined: Thu Mar 08, 2012 11:51 pm
Posts: 63
Location: USA
So based on these equations, how do I convert a CO sensor value of 2.419355 to ppm? I have the CO sensor setup with a gain of 1 and a resistance value of 10 (10k Ohms).

The sensor is configured as follows:
Quote:
  // get the CO value
  g_gas_co = 0.0;
  USB.println(" - Configure CO sensor");
  SensorGas.configureSensor(SENS_SOCKET4B, DEF_GAIN_CO, DEF_RES_CO);
  USB.println(" - Waiting for CO sensor to stabilize");
  delay(1000);
  USB.print(" - Reading CO sensor ");
  g_gas_co = SensorGas.readValue(SENS_SOCKET4B);
  USB.println(g_gas_pres);
  delay(1000);


I am at a loss on how to convert this to a PPM value.


Top
 Profile  
 
 Post subject: Re: How to programme the waspmote to get CO value?
PostPosted: Thu Aug 02, 2012 9:38 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7487
Hi Cryptik,

First of all, you have to calculate the sensor resistance, which you can get from the output voltage and the load resistance you loaded.

Then you have to intorduce this value in AmroQuandour's formula, or look at the graph. Take into account the you will need to calibrate the sensor to get an accurate measurement (this is, to get the m coefficeint used in the formula) because the ranges of the resistance in air and sensitivity are very wide.

Looking at the graph, and estimating a typical air resistance of 50kohms (be careful with this estimation, it is very rough) you would be having a concentration of around 150ppm, which is pretty high. Under which conditions are you performing your tests?

Regards.


Top
 OnlineProfile  
 
 Post subject: Re: How to programme the waspmote to get CO value?
PostPosted: Fri Aug 03, 2012 5:32 pm 

Joined: Thu Mar 08, 2012 11:51 pm
Posts: 63
Location: USA
So in this thread, three equations were offered to convert the humidity value from mV to %RH... but they all produce different values. For example the following equations are in this thread:

(1) Humidity = ((voltage_read - 1.25) / 0.025
(2) Humidity = ((voltage_read * 5000/3.3) - 800)/31
(3) Humidity = ((voltage_read * 5000/1023) - 800)/31

My humidity sensor returns a voltage of 1.319355 V while indoors in an air conditioned room (using the gas board). This voltage translates as follows using the equations above:

(1) = 2.7741
(2) = 38.6781
(3) = -25.5984

The only value that is close to correct is equation 2 (39% RH). Using a weather monitor, the monitor reports an indoor RH of 45%... so its more likely that equation 2 is the correct one.

My question is what am I missing with the other two equations?

Cheers,
Cryptik


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 3   [ 22 posts ]
Go to page 1, 2, 3  Next


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