I'm cc'ing this back to the help list in case someone else
understands it...

Using a DBG() means you are running on a simulator, no?
In which case I think ADC readings are kind of arbitrary.

But one thing that could be going on is your mixing of
int and float in the calculation. You didn't send the
declaration of data_Temp, so I'm not sure exactly what
is going on with it. You could print both the original
and processed values to see if there's
a pattern.  Using floating point on the real
hardware is to be avoided if possible, so I would look
into doing a fixed point impl somehow.

I guess the intent of the display() thing is to show
the top 3 bits of a 10 bit value? I'm not clear why
you subtract it from 7 though...

MS

bouzayani walid wrote:
> Thanks Michael,
> 
> 
> My object is to display the true three values (T°, Humidity and Light 
> sensors) of Telosb sensors on an graphic user interface of my PC (via USB .
> 
> I used only one channel. but i can't use the three channels simultaneously.
> 
> The values (from 10 to 1005) are given from the ADC data with 
> command */ADC.getData()/*
> 
>  My conversion code is:
> 
> 
> /// ADC data ready event handler
> async event result_t ADC.dataReady(uint16_t data) {
> data_Temp= (data/4096*1.5 - 0.986)/0.00355;
> dbg(DBG_TEMP|DBG_USR1, "Temperature Value is %i\n", (int)data_Temp);
> 
> display(7-((data>>7) &0x7));
> return SUCCESS;/
> 
> 
> Thanks in advance
> 
> 
> 
>  
> ______________________________
> BOUZAYANI Walid
> Student Researcher
> CES Laboratory, ENIS Tunisia
> bouzayaniwalid2...@yahoo.fr
> GSM: (00216) 94 306 603
> 
> 
> ------------------------------------------------------------------------
> *De :* Michael Schippling <sc...@santafe.edu>
> *À :* bouzayani walid <bouzayaniwalid2...@yahoo.fr>
> *Cc :* tinyos-help@millennium.berkeley.edu
> *Envoyé le :* Mardi, 28 Avril 2009, 19h52mn 48s
> *Objet :* Re: [Tinyos-help] Temperature & humidity Values
> 
> Any thing is (im)possible with software...
> 
> You can look into the O'scope java code to find where values
> are converted for plotting and stick your conversion formula
> in there. I'm sure that exercise will lead you to the code
> that does a full channel display which you might clone in
> order to add a third channel. I suspect you will have to
> change the TOS message structure to include that third data
> stream, but that is not too difficult if you've been through
> the TOS tutorials.
> 
> I have some difficulty understanding what you are doing now.
> The included code doesn't send any data to the host. Presuming
> that you are sending in whatever you are working with, what are
> you using to receive on the host end? What exactly is producing
> values from 10 to 1005? Can you post your host side conversion
> code?
> 
> MS
> 
> bouzayani walid wrote:
>  > Hi,
>  >
>  > I'm working on tinyOS1.x with Telosb Mote. I'd like obtaining the 
> values of Temperature, Humidity and Light sensors.
>  >
>  > I got the Values of Temperature, but they are around 2880 in 
> oscilloscope and around 600 in cygwin screen(from 10 to 1005).
>  >
>  > When i use the formula (Oscilloscope values), the temperature is 
> around 19°C(It is logic). but I like display this values (19 °C)
>  > on cygwin screen. What can I DO?
>  >
>  > In fact, I'd display the values of Humidity and Light in the same 
> Oscilloscope.. Is it possible (with using three channels 0,1 and 2).
>  >
>  > This my code.
>  >
>  >
>  >
>  > implementation {
>  >
>  > // declare module static variables here
>  >
>  >
>  > /**
>  > * Module scoped method. Displays the lowest 3 bits to the LEDs,
>  > * with RED being the most signficant and YELLOW being the least 
> significant.
>  > *
>  > * @return returns <code>SUCCESS</code>
>  > **/
>  > // display is module static function
>  > result_t display(uint16_t value)
>  > {
>  > if (value &1) call Leds.yellowOn();
>  > else call Leds.yellowOff();
>  > if (value &2) call Leds.greenOn();
>  > else call Leds.greenOff();
>  > if (value &4) call Leds.redOn();
>  > else call Leds.redOff();
>  > return SUCCESS;
>  > }
>  > /**
>  > * Initialize the component. Initialize ADCControl, Leds
>  > *
>  > * @return returns <code>SUCCESS</code> or <code>FAILED</code>
>  > **/
>  > // implement StdControl interface
>  > command result_t StdControl.init() {
>  > return call Leds.init();
>  > }
>  > /**
>  > * Start the component. Start the clock.
>  > *
>  > * @return returns <code>SUCCESS</code> or <code>FAILED</code>
>  > **/
>  > command result_t StdControl.start() {
>  > return call Timer.start(TIMER_REPEAT, 500);
>  > }
>  >
>  > /**
>  > * Stop the component. Stop the clock..
>  > *
>  > * @return returns <code>SUCCESS</code> or <code>FAILED</code>
>  > **/
>  > command result_t StdControl.stop() {
>  > return call Timer.stop();
>  > }
>  >
>  > /**
>  > * Read sensor data in response to the <code>Timer.fired</code> event.
>  > *
>  > * @return The result of calling ADC.getData().
>  > **/
>  > event result_t Timer.fired() {
>  > return call ADC.getData();
>  > }
>  >
>  >
>  >
>  > /**
>  > * Display the upper 3 bits of sensor reading to LEDs
>  > * in response to the <code>ADC.dataReady</code> event.
>  > * @return Always returns <code>SUCCESS</code>
>  > **/
>  > // ADC data ready event handler
>  > async event result_t ADC..dataReady(uint16_t data) {
>  >
>  > dbg(DBG_TEMP|DBG_USR1, "Counter: Value is %i\n", (int)data);
>  >
>  > display(7-((data>>7) &0x7));
>  > return SUCCESS;
>  > }
>  >
>  > }
>  >
>  >
>  >
>  >  ______________________________
>  > BOUZAYANI Walid
>  > Student Researcher
>  > CES Laboratory, ENIS Tunisia
>  > bouzayaniwalid2...@yahoo.fr <mailto:bouzayaniwalid2...@yahoo.fr>
>  > GSM: (00216) 94 306 603
>  >
>  >
>  >
>  > ------------------------------------------------------------------------
>  >
>  > _______________________________________________
>  > Tinyos-help mailing list
>  > Tinyos-help@millennium.berkeley.edu 
> <mailto:Tinyos-help@millennium.berkeley.edu>
>  > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> 
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to