Hi Daniel:
 Have you done all the init? Like wiring to the TempStdControl and calling init and start? Have a look at $TOSROOT/apps/Micasbverify/ for an example of how to use the temperature sensor. Also the light and temp sensor share the same pin, so you have to wait sometime before calling ADC1.getData(). I think there was a fix to ensure that there is enough time gap when photo and temp are used at the same time, you will have to check that by looking at the PhotoTemp code.

Hope that helps.

Raghu




Message: 1
Date: Wed, 7 Jun 2006 18:44:09 +0200
From: " Daniel Vill?n " <[EMAIL PROTECTED]>
Subject: [Tinyos-help] problems with temperature readings
To: " tinyos-help@Millennium.Berkeley.EDU"
        <tinyos-help@millennium.berkeley.edu>
Message-ID:
        < [EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

I am using a MICAz with an MDA300 to do temperature and light readings. I've
seen the posts about the problem of using the temperature sensor and the
radio because they share one pin. I also have seen the modified
PhotoTempM.nc module which is supposed to resolve the problem (look
../platform/micaz), I included in my project.
Now that I have done those changes, I'm trying to receive the the data and
this is what I get:

  01 BE 03 88 00

where 01 is the mote number, 03BE is the light reading and 0088 is the
temperature reading... I have more readings but they are almost the same.
The problem is that when I do the conversion for the temperature sensor, I
get a -10 C which is impossible because I'm into a room and it is very far
from the 30 C that we have now. Now I don't know if it is a problem of the
shared pin, or if it is a problem of the formula (Which I don't think it
is), or what is it?, there is something strange going on too, when I put my
hand over the light sensor, the light and the temperature reading
changes...both.
I attach a part of the program when I do the readings of the light and
temperature, maybe I need to change the way I do it in order to get a
correct temperature reading.

event result_t Timer.fired(){            // every time the timer fires it
has to make a reading of both sensors

        if (cont < 59) cont++;
        else cont=0;

        if (cont == 59) return call ADC2.getData();

        return SUCCESS;
    }

    async event result_t ADC2.dataReady(uint16_t data){         // reading
of temperature sensor as it is done in the tutorial


            atomic{
            data2 = data;
            }

       return  call ADC1.getData();

        }


    async event result_t ADC1.dataReady(uint16_t data) {    // reading of
the light sensor as it is done in the tutorial

            atomic{
            data1 = data;
            }


            atomic{
            //current
data                                                         // here I do
the arrengement of the data to send it
            ptrmsg->actual.nodo = TOS_LOCAL_ADDRESS;
            ptrmsg->actual.sensor1 = data1;
            ptrmsg->actual.sensor2 = data2;
            dada1++;
            ptrmsg->dada1 = dada1;
            }


        post envio
();                                                          // envio = send
, it goes to a post where the data is sended

        return SUCCESS;
    }

task void envio () {
        ptrmsg =  call SendMHopMsg.getBuffer(msgptr, &len);

        call SendMHopMsg.sendTTL(0x00,sizeof(datos), msgptr,0);

    }

I hope I was clear enough and somebody can help me


Daniel Villón V.
-----------------------------------------------------------
Departamento de Ingeniería Telemática.
Universitat Politècnica de Catalunya
-----------------------------------------------------------
C/. Jordi Girona 1-3
Modulo C3 Laboratorio 003
Barcelona CP 08034, España
Teléfono: +34 93 289 36 71
Celular:   +34 697 91 43 53
e-mail: [EMAIL PROTECTED]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20060607/e76a1935/attachment-0001.htm

_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to