Hi, first I would like to clarify something (you may already know it),
that the readings of the SHT1x sensor should be calibrated depending on
the supplied voltage.
So, you should probably check for two things:
(1) Try first to change or use new batteries, or power the Telos node
with the USB (through the computer or an AC to USB adapter), if this
doesn't solve the problem try (2).
(2) Make sure that you have selected the correct calibration parameters
according to the SHT1x datasheet, which you can download from this link:
http://www.sensirion.com/en/pdf/product_information/Datasheet-humidity-sensor-SHT1x.pdf
In particular, look at Table 6 for humidity, and Table 8 for
temperature, your calibration equations should be as follows:
For temperature,
// convert temperature reading in "Celcius (C)"
glb_temperatureReading = (uint16_t)(-39.6 +
0.01*(float)temperatureReading);
and for humidity,
//convert humidity reading in "Relative Humidity (%)"
glb_humidityReading = (uint16_t)(-2.0468 +
0.0367*(float)humidityReading + 0.00000159*(float)(humidityReading^2));
I hope this works for you, good luck,
Hussein
On 01/02/2011 5.34, Augusto Alonso de la Cruz Jimenez wrote:
> Hi to all,
>
> I am developing an application to sense temperature and relative
> humidity, using Telosb motes.
>
> The application is Java. When running the application, it receives the
> temperature and humidity values correctly. But after a while, the
> value of the temperature begins to rise and rise, reaching 124.23 °
> (limit of sensor SHT11) and the humidity exceeds 100%. Furthermore,
> the battery voltage begins to decrease.
>
> Where is the problem:
> - NESC application
> - Java application
> - Calibrate the sensors. ¿how to?
>
> Here are the files NESC:
> #ifndef TMOTESKY_H
> #define TMOTESKY_H
> enum {
> NREADINGS = 2,
> DEFAULT_INTERVAL = 1000,
> AM_TMOTESKY_STRUCT = 0x93
> };
>
> typedef nx_struct tmotesky_struct {
> nx_uint16_t version;
> nx_uint16_t interval;
> nx_uint16_t id;
> nx_uint16_t count;
> nx_uint16_t Temp;
> nx_uint16_t ITemp;
> nx_uint16_t TSR;
> nx_uint16_t PAR;
> nx_uint16_t Humedad;
> nx_uint16_t Voltage;
> nx_uint16_t tipoUmbral;
> nx_uint16_t transmision;
> nx_uint16_t umbralSuperior;
> nx_uint16_t umbralInferior;
> } tmotesky_struct_t;
>
> #endif
> configuration TmoteSkyAppC {
> }
>
> implementation {
> components TmoteSkyC;
> components MainC;
> components ActiveMessageC;
> components LedsC;
> components new TimerMilliC();
> components new SensirionSht11C() as TempSensor;
> components new SensirionSht11C() as HumSensor;
> components new VoltageC() as VoltageSensor;
> components CC2420ActiveMessageC as LplRadio;
> components new AMSenderC(AM_TMOTESKY_STRUCT);
> components new AMReceiverC(AM_TMOTESKY_STRUCT);
>
> TmoteSkyC.Boot -> MainC;
> TmoteSkyC.RadioControl -> ActiveMessageC;
> TmoteSkyC.AMSend -> AMSenderC;
> TmoteSkyC.Receive -> AMReceiverC;
> TmoteSkyC.Timer -> TimerMilliC;
> TmoteSkyC.ReadTemp -> TempSensor.Temperature;
> TmoteSkyC.ReadHum -> HumSensor.Humidity;
> TmoteSkyC.ReadVolt -> VoltageSensor;
> TmoteSkyC.Leds -> LedsC;
> TmoteSkyC.LowPowerListening -> LplRadio;
> }
> #include "Timer.h"
> #include "TmoteSky.h"
>
> module TmoteSkyC {
> uses {
> interface Boot;
> interface SplitControl as RadioControl;
> interface AMSend;
> interface Receive;
> interface Timer<TMilli>;
> interface Read<uint16_t> as ReadTemp;
> interface Read<uint16_t> as ReadHum;
> interface Read<uint16_t> as ReadVolt;
> interface Leds;
> interface LowPowerListening;
> }
> }
>
> implementation {
> message_t sendbuf;
> bool sendbusy;
> tmotesky_struct_t local;
> bool suppress_count_change;
>
> nx_uint16_t tUmbral;
> nx_uint16_t USuperiorTemp;
> nx_uint16_t UInferiorTemp;
> nx_uint16_t USuperiorHum;
> nx_uint16_t UInferiorHum;
> nx_uint16_t USuperiorTSR;
> nx_uint16_t UInferiorTSR;
> nx_uint16_t idTemp;
> nx_uint16_t envioEvento;
> nx_uint16_t envioInicial;
>
> // Uso de los LEDs para reportar comportamientos
> void report_problem() { call Leds.led0Toggle();}
> void report_sent() { call Leds.led1Toggle(); }
> void report_received() { call Leds.led2Toggle(); }
>
> event void Boot.booted() {
> local.interval = DEFAULT_INTERVAL;
> local.id = TOS_NODE_ID;
> USuperiorTemp=10000;
> UInferiorTemp=9000;
>
> if (call RadioControl.start() != SUCCESS){
> report_problem();
> }
>
> local.transmision = 0; /*inicia sin transmitir nada*/
> envioEvento = 0;
> envioInicial = 0;
> }
>
> void startTimer() {
> call Timer.startPeriodic(local.interval);
> }
>
> event void RadioControl.startDone(error_t error) {
> startTimer();
> }
>
> event void RadioControl.stopDone(error_t error) {
> }
>
> event message_t* Receive.receive(message_t* msg, void* payload, uint8_t
> len) {
> tmotesky_struct_t *omsg = payload;
>
> report_received();
> local.transmision = omsg->transmision;
> local.tipoUmbral = omsg->tipoUmbral;
> local.umbralSuperior = omsg->umbralSuperior;
> local.umbralInferior = omsg->umbralInferior;
> local.interval = omsg->interval;
> idTemp = omsg->id; //extrae ID anterior del msg recibido
>
> startTimer();
>
> if (omsg->count> local.count) {
> local.count = omsg->count;
> suppress_count_change = TRUE;
> }
> return msg;
> }
>
> void envio() {
> if (!sendbusy&& sizeof local<= call AMSend.maxPayloadLength()) {
> memcpy(call AMSend.getPayload(&sendbuf,sizeof(local)),&local,
> sizeof local);
> if (call AMSend.send(AM_BROADCAST_ADDR,&sendbuf, sizeof local)
> == SUCCESS)
> sendbusy = TRUE;
> }
> if (!sendbusy)
> report_problem();
>
> if (!suppress_count_change)
> local.count++;
>
> suppress_count_change = FALSE;
>
> if (call ReadTemp.read() != SUCCESS)
> report_problem();
>
> if (call ReadHum.read() != SUCCESS)
> report_problem();
>
> if (call ReadVolt.read() != SUCCESS)
> report_problem();
> }
>
> void MsgTipoUmbral(int tipoUmb) {
> if (tipoUmb == 1) {
> local.umbralSuperior = USuperiorTemp;
> local.umbralInferior = UInferiorTemp;
> }
> if (tipoUmb == 2) {
> local.umbralSuperior = USuperiorHum;
> local.umbralInferior = UInferiorHum;
> }
> if (tipoUmb == 3) {
> local.umbralSuperior = USuperiorTSR;
> local.umbralInferior = UInferiorTSR;
> }
> if (tipoUmb == 4) {
> USuperiorTemp = local.umbralSuperior;
> UInferiorTemp = local.umbralInferior;
> }
> if (tipoUmb == 5) {
> USuperiorHum = local.umbralSuperior;
> UInferiorHum = local.umbralInferior;
> }
> if (tipoUmb == 6) {
> USuperiorTSR = local.umbralSuperior;
> UInferiorTSR = local.umbralInferior;
> }
> }
>
> event void Timer.fired() {
> switch(local.transmision) {
> case 0 : call Leds.set(0);
> if (envioInicial == 0){
> envio();
> envioInicial = 1;
> }
> break;
> case 1 : envio();
> break;
>
> case 2 : MsgTipoUmbral(local.tipoUmbral);
> local.transmision=0;
> envio();
> break;
>
> case 3 : if(local.id == idTemp) {
> local.id = local.tipoUmbral;
> }
> break;
>
> }
> envioEvento++;
> }
>
> event void AMSend.sendDone(message_t* msg, error_t error) {
> if (error == SUCCESS)
> report_sent();
> else
> report_problem();
>
> sendbusy = FALSE;
> }
>
> event void ReadTemp.readDone(error_t result, uint16_t data) {
> if (result != SUCCESS) {
> data = 0xffff;
> report_problem();
> }
> local.Temp = data;
> }
>
> event void ReadHum.readDone(error_t result, uint16_t data) {
> if (result != SUCCESS) {
> data = 0xffff;
> report_problem();
> }
> local.Humedad = data;
> }
>
> event void ReadVolt.readDone(error_t result, uint16_t data) {
> if (result != SUCCESS) {
> data = 0xffff;
> report_problem();
> }
> local.Voltage = data;
> }
> }
> You are the experts, I am here to learn.
> Salu2, regards!!!
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help