Post a new topicPost a reply Page 1 of 1   [ 5 posts ]
Author Message
 Post subject: Ag board Humidity Readings are wrong
PostPosted: Tue Jan 10, 2012 2:17 am 

Joined: Tue Sep 13, 2011 12:20 am
Posts: 11
We have been having some trouble getting a correct reading from the humidity sensor on the ag board. The sensors have been verified as operational. It seems as though the waspmote API is calculating the value wrong. Below is our code:

void loop(){



//start humidity read
float value_humidity_1 = 0; //Initialize variables for sensor readings
float value_humidity_2 = 0;
float value_temperature_1 = 0;
float value_temperature_2 = 0;


SensorAgr.setSensorMode(SENS_ON, SENS_AGR_SENSIRION);//TURN ON SENSOR
SensorAgr.setSensorMode(SENS_ON, SENS_AGR_HUMIDITY);//TURN ON SENSOR
SensorAgr.setSensorMode(SENS_ON, SENS_AGR_TEMPERATURE);//TURN SENSOR ON
delay(18000); //waiting for the sensor response time (15 seconds)

value_humidity_1 = SensorAgr.readValue(SENS_AGR_HUMIDITY);//READ SENSOR
value_temperature_1 = SensorAgr.readValue(SENS_AGR_TEMPERATURE);//READ SENSOR
value_humidity_2 = SensorAgr.readValue(SENS_AGR_SENSIRION, SENSIRION_HUM);//READ SENSOR
value_temperature_2 = SensorAgr.readValue(SENS_AGR_SENSIRION, SENSIRION_TEMP);//READ SENSOR

SensorAgr.setSensorMode(SENS_OFF, SENS_AGR_SENSIRION);//TURN OFF SENSOR
SensorAgr.setSensorMode(SENS_OFF, SENS_AGR_HUMIDITY);//TURN OFF SENSOR
SensorAgr.setSensorMode(SENS_OFF, SENS_AGR_TEMPERATURE);//TURN OFF SENSOR


Utils.float2String(value_humidity_1, buffer, 3);//CHANGE FLOAT VALUE READ TO A STRING
senddata(humidity_1,buffer);//SEND TO THE RADIO

XBee.println("");
XBee.print("Humidity: ");
XBee.println(value_humidity_1);
XBee.print("Here we print out aux packet array: ");
XBee.println(aux);


Top
 Profile  
 
 Post subject: Re: Ag board Humidity Readings are wrong
PostPosted: Tue Jan 10, 2012 9:22 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 11578
Dear connector888,

You should also turn on the Agriculture board with

SensorAgr.setBoardMode(SENS_ON);

Check also this topic. it will be useful for you and let us know your results.
viewtopic.php?f=17&t=8168&p=17637&hilit=SensorAgr#p17637

Kind regards.


Top
 Profile  
 
 Post subject: Re: Ag board Humidity Readings are wrong
PostPosted: Tue Jan 10, 2012 11:28 pm 

Joined: Wed Sep 14, 2011 3:01 am
Posts: 18
We turned on the agr board as suggested.
Code:
  float value_humidity_1 = 0;  //Initialize variables for sensor readings
  float value_humidity_2 = 0;
  float value_temperature_1 = 0;
  float value_temperature_2 = 0;

  SensorAgr.setBoardMode(SENS_ON);
  delay(100);

  SensorAgr.setSensorMode(SENS_ON, SENS_AGR_SENSIRION);//TURN ON SENSOR
  SensorAgr.setSensorMode(SENS_ON, SENS_AGR_HUMIDITY);//TURN ON SENSOR
  SensorAgr.setSensorMode(SENS_ON, SENS_AGR_TEMPERATURE);//TURN SENSOR ON
  delay(15000); //waiting for the sensor response time (15 seconds)
 
  value_humidity_1 = SensorAgr.readValue(SENS_AGR_HUMIDITY);
  value_temperature_1 = SensorAgr.readValue(SENS_AGR_TEMPERATURE);
  value_humidity_2 = SensorAgr.readValue(SENS_AGR_SENSIRION, SENSIRION_HUM);
  value_temperature_2 = SensorAgr.readValue(SENS_AGR_SENSIRION, SENSIRION_TEMP);
 
  SensorAgr.setSensorMode(SENS_OFF, SENS_AGR_SENSIRION);//TURN OFF SENSOR
  SensorAgr.setSensorMode(SENS_OFF, SENS_AGR_HUMIDITY);//TURN OFF SENSOR
  SensorAgr.setSensorMode(SENS_OFF, SENS_AGR_TEMPERATURE);//TURN OFF SENSOR
 
  SensorAgr.setBoardMode(SENS_OFF);

We noticed this fixed the input voltage on the humidity sensor's power pin. The power pin now reads 5V. The output voltage now reads 1.4V or 1400mV. This is correct. However, the command:
Code:
SensorAgr.readValue(SENS_AGR_HUMIDITY);

Is calculating a value of 15% which is not correct. As we understand it, this value is being converted by the sencera_conversion command:
Code:
        float humidity = 0;   
        humidity = float(readValue) * 5000 / 1023;   
        humidity = (humidity - 800) / 31; 
        return(humidity);

The humidity output voltage value of 1400mV according to your conversion should return a value of 19.35%

19.35=(1400 - 800) / 31

So we are confused why SensorAgr.readValue(SENS_AGR_HUMIDITY);
is giving us 15 and not 19.


Top
 Profile  
 
 Post subject: Re: Ag board Humidity Readings are wrong
PostPosted: Wed Jan 11, 2012 1:57 am 

Joined: Wed Sep 14, 2011 3:01 am
Posts: 18
.
(Please note: We still need an answer to the above; what follows is a separate issue)

In trying to debug the above, I modified WaspSensorAgr.cpp from

Code:
case   SENS_AGR_HUMIDITY:   digitalWrite(SENS_MUX_SEL,HIGH);
                  aux2=analogRead(ANALOG2);
                  aux=sencera_conversion(aux2); // %Hum
                  digitalWrite(SENS_MUX_SEL, LOW);
                  break;


to

Code:
case   SENS_AGR_HUMIDITY:   digitalWrite(SENS_MUX_SEL,HIGH);
                  aux2=analogRead(ANALOG2);
                  USB.print ("aux2 is ");
                  USB.println (aux2, 16);
                  aux=sencera_conversion(aux2); // %Hum
                  digitalWrite(SENS_MUX_SEL, LOW);
                  break;


This complies and uploads with no errors. I was hoping it would display the analog read value in the serial monitor window; it does nothing.

Why doesn't this tactic work?

How can I achieve my goal of looking at the value at the time the low level read is performed?
.


Top
 Profile  
 
 Post subject: Re: Ag board Humidity Readings are wrong
PostPosted: Mon Jan 16, 2012 2:39 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 11578
Dear
FunWithLibelium,

Regarding your debugging issue, you are not seeing anything due to USB is not started. Try using USB.begin();

Below We attach an example code for the humidity sensor of agriculture board:

Quote:
float value_humidity_1 = 0; //Initialize variables for sensor readings

void setup(){

  USB.begin();
  SensorAgr.setBoardMode(SENS_ON);
  delay(100);
   
  SensorAgr.setSensorMode(SENS_ON, SENS_AGR_HUMIDITY);//TURN ON SENSOR
  delay(15000); //waiting for the sensor response time (15 seconds)
  
}

void loop(){

  USB.println("loop");
  value_humidity_1 = SensorAgr.readValue(SENS_AGR_HUMIDITY);
  USB.print("Humidity:");
  USB.println(value_humidity_1);
  delay(1000);

}




In relation with your previous post, you are right, the value is being converted by sencera_conversion factor.

Libelium provides an approximated conversion factor based on datasheet manufactured, but we did not tested sensor accuracy comparing it with other humidity sensors.

Perhaps you find a more accurate conversion factor in your tests and you want to share with us.

Waiting for your comments.

Kind regards.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 5 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