Post a new topicPost a reply Page 1 of 2   [ 12 posts ]
Go to page 1, 2  Next
Author Message
 Post subject: information collected by sensors
PostPosted: Mon May 21, 2012 5:43 pm 

Joined: Tue Jul 26, 2011 4:26 pm
Posts: 26
Hi Libelium,

My sensors are collecting the following values with a delay (1000):

ID = Sensor1
Humi = 32.3715820312
Leaf = 3.2999999523
Temp = 25.1612911224
ID = Sensor1
Humi = 32.2139167785
Leaf = 3.2999999523
Temp = 26.1290340423
ID = Sensor1
Humi = 32.3715820312
Leaf = 3.2999999523
Temp = 27.0967712402
ID = Sensor1
Humi = 32.0562553405
Leaf = 3.2999999523
Temp = 29.6774177551
ID = Sensor1
Humi = 32.3715820312
Leaf = 3.2999999523
Temp = 30.6451606750
ID = Sensor1
Humi = 32.0562553405
Leaf = 3.2999999523
Temp = 25.8064517974

But the question comprises my with temperature variation, it is possible to alter these values so within a room?

Brgds
Daniela


Top
 Profile  
 
 Post subject: Re: information collected by sensors
PostPosted: Tue May 22, 2012 8:12 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7515
Hi Daniela,

not really, you should have a more stable measurement. Could you please post your code and tell us which board, if any, are you using?

Regards.


Top
 Profile  
 
 Post subject: Re: information collected by sensors
PostPosted: Tue May 22, 2012 1:27 pm 

Joined: Tue Jul 26, 2011 4:26 pm
Posts: 26
Hi Libelium,

I'm using a simple code:

float value_humidity_1 = 0; //Initialize variables for sensor readings
float value_lw = 0;
float value_temperature = 0;

void setup(){
SensorAgr.setSensorMode(SENS_ON, SENS_AGR_HUMIDITY);//TURN ON SENSOR
SensorAgr.setSensorMode(SENS_ON, SENS_AGR_LEAF_WETNESS);
SensorAgr.setSensorMode(SENS_ON, SENS_AGR_TEMPERATURE);
USB.begin();
delay(1000);
}

void loop(){
// Blinking LEDs
Utils.blinkLEDs(1000);
USB.print("[ID:");

USB.print("Sensor1");
value_humidity_1 = SensorAgr.readValue(SENS_AGR_HUMIDITY);
USB.print(",Humi:");
USB.print(value_humidity_1);

value_lw = SensorAgr.readValue(SENS_AGR_LEAF_WETNESS);
USB.print(",Leaf:");
USB.print( value_lw);

value_temperature = SensorAgr.readValue(SENS_AGR_TEMPERATURE);
USB.print(",Temp:");
USB.print( value_temperature);
USB.print("]");
delay(1000);

}


I have the board waspmote agriculture, with the three sensors connected.

Brgds
Daniela


Top
 Profile  
 
 Post subject: Re: information collected by sensors
PostPosted: Wed May 23, 2012 10:01 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7515
Hi Daniela,

a couple of tips:

First of all, you must turn on the sensor board before turning on the sensors, add this line at the begining of your setup:

Code:
SensorAgr.setBoardMode(SENS_ON);


Secondly, we have found an issue that may be a potential source of noise for those three sensors in the library that we will fix in the next version of the API as follows:

In the readValue function, in the case of these sensors (TEMPERATURE, LEAF_WETNESS and HUMIDITY) you'll find two lines as the following:

Code:
digitalWrite(SENS_MUX_SEL, HIGH);
...
digitalWrite(SENS_MUX_SEL, LOW);


Comment both of them and copy the first one in the setSensorMode function, for the mode == SENS_ON case and for these three sensors, just before the break instruction; and the second one in the same case but for the three Watermark sensors.

This should reduce considerably the noise in your sensor.

Regards.


Top
 Profile  
 
 Post subject: Re: information collected by sensors
PostPosted: Wed May 23, 2012 3:35 pm 

Joined: Tue Jul 26, 2011 4:26 pm
Posts: 26
Hi Libelium,

thanks for the help.
I've made changes to the API (WaspSensorAgr.cpp), as illustrated by the following code:
void WaspSensorAgr::setSensorMode(uint8_t mode, uint16_t sensor)
{
if( mode==SENS_ON )
{
switch( sensor )
{
case SENS_AGR_PRESSURE: digitalWrite(SENS_SWITCH_1,HIGH);
break;
case SENS_AGR_WATERMARK_1:digitalWrite(SENS_SWITCH_2,HIGH);
digitalWrite(SENS_MUX_SEL, LOW);
break;
case SENS_AGR_WATERMARK_2:digitalWrite(SENS_SWITCH_2,HIGH);
digitalWrite(SENS_MUX_SEL, LOW);
break;
case SENS_AGR_WATERMARK_3:digitalWrite(SENS_SWITCH_2,HIGH);
digitalWrite(SENS_MUX_SEL, LOW);
break;

case SENS_AGR_ANEMOMETER: digitalWrite(SENS_SWITCH_3,HIGH);
break;
case SENS_AGR_VANE : digitalWrite(SENS_SWITCH_3,HIGH);
break;
case SENS_AGR_DENDROMETER:digitalWrite(SENS_SWITCH_4,HIGH);
break;
case SENS_AGR_PT1000 :digitalWrite(SENS_SWITCH_4,HIGH);
break;
case SENS_AGR_LEAF_WETNESS:digitalWrite(SENS_SWITCH_4,HIGH);
digitalWrite(SENS_MUX_SEL, HIGH);
break;
case SENS_AGR_TEMPERATURE: digitalWrite(SENS_SWITCH_4,HIGH);
digitalWrite(SENS_MUX_SEL, HIGH);
break;
case SENS_AGR_HUMIDITY:digitalWrite(SENS_SWITCH_4,HIGH);
digitalWrite(SENS_MUX_SEL, HIGH);
break;

case SENS_AGR_RADIATION:digitalWrite(SENS_SWITCH_4,HIGH);
break;
case SENS_AGR_SENSIRION: digitalWrite(SENS_SWITCH_4,HIGH);
break;
}
}
if( mode==SENS_OFF )
{
switch( sensor )
{
case SENS_AGR_PRESSURE:digitalWrite(SENS_SWITCH_1,LOW);
break;
case SENS_AGR_WATERMARK_1:digitalWrite(SENS_SWITCH_2,LOW);
break;
case SENS_AGR_WATERMARK_2:digitalWrite(SENS_SWITCH_2,LOW);
break;
case SENS_AGR_WATERMARK_3:digitalWrite(SENS_SWITCH_2,LOW);
break;
case SENS_AGR_ANEMOMETER:digitalWrite(SENS_SWITCH_3,LOW);
break;
case SENS_AGR_VANE :digitalWrite(SENS_SWITCH_3,LOW);
break;
case SENS_AGR_DENDROMETER:digitalWrite(SENS_SWITCH_4,LOW);
break;
case SENS_AGR_PT1000:digitalWrite(SENS_SWITCH_4,LOW);
break;
case SENS_AGR_LEAF_WETNESS:digitalWrite(SENS_SWITCH_4,LOW);
break;
case SENS_AGR_TEMPERATURE:digitalWrite(SENS_SWITCH_4,LOW);
break;
case SENS_AGR_HUMIDITY:digitalWrite(SENS_SWITCH_4,LOW);
break;
case SENS_AGR_RADIATION:digitalWrite(SENS_SWITCH_4,LOW);
break;
case SENS_AGR_SENSIRION:digitalWrite(SENS_SWITCH_4,LOW);
break;
}
}
}
float WaspSensorAgr::readValue(uint16_t sensor)
{
return readValue(sensor,0);
}
float WaspSensorAgr::readValue(uint16_t sensor, uint8_t type)
{
float aux=0;
uint16_t aux2=0;

switch( sensor )
{
case SENS_AGR_PRESSURE:aux2=analogRead(ANALOG3);
aux=pressure_conversion(aux2); // KPa
break;
case SENS_AGR_WATERMARK_1:aux=readWatermark(SENS_AGR_WATERMARK_1);
break;
case SENS_AGR_WATERMARK_2:aux=readWatermark(SENS_AGR_WATERMARK_2);
break;
case SENS_AGR_WATERMARK_3:aux=readWatermark(SENS_AGR_WATERMARK_3);
break;
case SENS_AGR_ANEMOMETER:aux2=analogRead(ANALOG7);
aux = float(aux2) * 3.3 * 2.4 / (1023*0.03);
break;
case SENS_AGR_VANE :aux2=analogRead(ANALOG5);
aux=(aux2*3.3)/1023; // Volts
getVaneDirection(aux); // Direction
break;
case SENS_AGR_DENDROMETER:aux=readDendrometer(); //mm
break;
case SENS_AGR_PT1000:aux=readPT1000(); // º Celsius
break;
case SENS_AGR_LEAF_WETNESS: //digitalWrite(SENS_MUX_SEL,HIGH); // Volts
aux2=analogRead(ANALOG6);
aux=(aux2*3.3)/1023;
//digitalWrite(SENS_MUX_SEL, LOW);
break;
case SENS_AGR_TEMPERATURE://digitalWrite(SENS_MUX_SEL,HIGH);
aux2=analogRead(ANALOG4);
aux=mcp_conversion(aux2); // ºCelsius
//digitalWrite(SENS_MUX_SEL, LOW);
break;
case SENS_AGR_HUMIDITY://digitalWrite(SENS_MUX_SEL,HIGH);
aux2=analogRead(ANALOG2);
aux=sencera_conversion(aux2); // %Hum
//digitalWrite(SENS_MUX_SEL, LOW);
break;

case SENS_AGR_RADIATION: aux=readRadiation(); //Volts
break;
case SENS_AGR_SENSIRION: if(type==SENSIRION_TEMP) aux=readSensirion(SENSIRION_TEMP); // ºCelsius
else if( type==SENSIRION_HUM ) aux=readSensirion(SENSIRION_HUM);// %Hum
break;
case SENS_AGR_PLUVIOMETER:aux2=readPluviometer();
aux=float(aux2) * 0.2794 * 20; // mm/min
break;
}
return aux;
}

But my question is what should I do after this change in order to have correct values?

Brgds
Daniela


Top
 Profile  
 
 Post subject: Re: information collected by sensors
PostPosted: Thu May 24, 2012 8:24 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7515
Hi Daniela,

now you have to upload your code (the same you posted before) again to Waspmote, using the library you modified.

Please let us know if your results improved.

Regards.


Top
 Profile  
 
 Post subject: Re: information collected by sensors
PostPosted: Thu May 24, 2012 10:07 pm 

Joined: Tue Jul 26, 2011 4:26 pm
Posts: 26
Hi Libelium,

Sorry, I made changes to the API, but still have variations in temperature.

You can see the previous post if changes are made correctly?

Brgds
Daniela


Top
 Profile  
 
 Post subject: Re: information collected by sensors
PostPosted: Fri May 25, 2012 9:20 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7515
Hi Daniela,

I can't see anything wrong in your modifications, so lets try it the "hard" way. Try this code and let us know how did it work:

Code:
void setup()
{
  pinMode(DIGITAL5, OUTPUT);
  pinMode(DIGITAL3, OUTPUT);
  PWR.setSensorPower(SENS_3V3, SENS_ON);
  PWR.setSensorPower(SENS_5V, SENS_ON);
  digitalWrite(DIGITAL5, HIGH);
  digitalWrite(DIGITAL3, HIGH);
  USB.begin();
  USB.println("start");
  delay(500); 
}

float temp;

void loop()
{
  temp = (float(analogRead(ANALOG4))*330/1023)-50;
  USB.println(temp);
  delay(1000);
}


Regards


Top
 Profile  
 
 Post subject: Re: information collected by sensors
PostPosted: Fri May 25, 2012 12:41 pm 

Joined: Tue Jul 26, 2011 4:26 pm
Posts: 26
Hi Libelium,

As your code I get the following result:

23.5483856201 23.2258071899 23.2258071899 23.2258071899 24.5161285400 23.2258071899 23.5483856201 23.5483856201 23.8709640502 23.2258071899
23.2258071899 23.2258071899 23.2258071899 23.2258071899 23.2258071899
23.2258071899 23.2258071899 23.2258071899 22.9032287597 23.2258071899
22.9032287597 23.5483856201 23.2258071899 23.2258071899 23.2258071899

But with my code, the result is unstable.

Temp:24.5161285400,Humi:43.9125900268,Leaf:3.2999999523
Temp:27.0967712402,Humi:44.0860176086,Leaf:3.2999999523
Temp:22.2580642700,Humi:44.2594490051,Leaf:3.2999999523
Temp:23.2258071899,Humi:44.4328842163,Leaf:3.2999999523
Temp:22.5806427001,Humi:43.5657272338,Leaf:3.2999999523
Temp:22.2580642700,Humi:43.2188682556,Leaf:3.2999999523
Temp:22.5806427001,Humi:43.3922958374,Leaf:3.2999999523
Temp:22.5806427001,Humi:42.8719978332,Leaf:3.2999999523
Temp:22.5806427001,Humi:43.0454330444,Leaf:3.2999999523
Temp:25.1612930297,Humi:43.3922958374,Leaf:3.2999999523
Temp:27.7419357299,Humi:43.0454330444,Leaf:3.2999999523
Temp:22.2580642700,Humi:42.8719978332,Leaf:3.2999999523
Temp:22.5806427001,Humi:43.3922958374,Leaf:3.2999999523
Temp:23.5483856201,Humi:44.2594490051,Leaf:3.2999999523
Temp:22.9032287597,Humi:43.3922958374,Leaf:3.2999999523
Temp:25.4838714599,Humi:43.5657272338,Leaf:3.2999999523
Temp:22.5806427001,Humi:43.5657272338,Leaf:3.2999999523
Temp:24.1935501098,Humi:43.3922958374,Leaf:3.2999999523
Temp:25.4838714599,Humi:43.9125900268,Leaf:3.2999999523
Temp:26.1290359497,Humi:43.5657272338,Leaf:3.2999999523

Code:
void setup()
{
SensorAgr.setBoardMode(SENS_ON);
pinMode(DIGITAL5, OUTPUT);
pinMode(DIGITAL3, OUTPUT);
PWR.setSensorPower(SENS_3V3, SENS_ON);
PWR.setSensorPower(SENS_5V, SENS_ON);
digitalWrite(DIGITAL5, HIGH);
digitalWrite(DIGITAL3, HIGH);
SensorAgr.setSensorMode(SENS_ON, SENS_AGR_HUMIDITY);//TURN ON SENSOR
SensorAgr.setSensorMode(SENS_ON, SENS_AGR_LEAF_WETNESS);
USB.begin();
delay(500);
}

float temp;
float value_humidity_1 = 0; //Initialize variables for sensor readings
float value_lw = 0;

void loop()
{
temp = (float(analogRead(ANALOG4))*330/1023)-50;
USB.print(",Temp:");
USB.println(temp);
delay(3000);
value_humidity_1 = SensorAgr.readValue(SENS_AGR_HUMIDITY);
USB.print(",Humi:");
USB.println(value_humidity_1);
delay(3000);
value_lw = SensorAgr.readValue(SENS_AGR_LEAF_WETNESS);
USB.print(",Leaf:");
USB.print( value_lw);
delay(3000);
}



Brgds
Daniela


Top
 Profile  
 
 Post subject: Re: information collected by sensors
PostPosted: Mon May 28, 2012 10:15 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7515
Hi Daniela,

I think we found the problem, could you please try this code?

Code:
float value_humidity_1 = 0; //Initialize variables for sensor readings
float value_lw = 0;
float value_temperature = 0;

void setup(){
SensorAgr.setSensorMode(SENS_ON, SENS_AGR_HUMIDITY);//TURN ON SENSOR
SensorAgr.setSensorMode(SENS_ON, SENS_AGR_LEAF_WETNESS);
SensorAgr.setSensorMode(SENS_ON, SENS_AGR_TEMPERATURE);
USB.begin();
delay(1000);
}

void loop(){
// Blinking LEDs
Utils.blinkLEDs(1000);
USB.print("[ID:");

USB.print("Sensor1");
value_humidity_1 = analogRead(ANALOG2);
delay(5);
value_humidity_1 = SensorAgr.readValue(SENS_AGR_HUMIDITY);
USB.print(",Humi:");
USB.print(value_humidity_1);

value_lw = analogRead(ANALOG6);
delay(5);
value_lw = SensorAgr.readValue(SENS_AGR_LEAF_WETNESS);
USB.print(",Leaf:");
USB.print( value_lw);

value_temperature = analogRead(ANALOG4);
delay(5);
value_temperature = SensorAgr.readValue(SENS_AGR_TEMPERATURE);
USB.print(",Temp:");
USB.print( value_temperature);
USB.println("]");
delay(1000);

}


Regards.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 2   [ 12 posts ]
Go to page 1, 2  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