Re: [Tinyos-help] Adding precision to sensor data obtained

2011-06-14 Thread Mayank Gupta
Thanks again.

I am sensing all the three sensors available i.e. temperature , light
and humidity. I use the following formulas ,

temperature = (float)(-39.6 + 0.01*(float)val);

humidity =  (float)(-2.0468 + 0.0367*(float)val + 0.0159*(float)(val*val));

but when I use MsgReader tool to read the data, I always get
temperature as 29.0 or like that when I view it on PC and when I send
to the database, it automatically converts it into int and gives value
as 29.

Other thing is at the start the first value is always zero for all the
three sensors. I cannot understand how can I use these sensors to get
values and add some precision to it...

Regards,
Mayank

On Fri, Jun 10, 2011 at 7:00 PM, Michael Schippling sc...@santafe.edu wrote:
 Assuming that the readings you are getting are,
 as I suggested, the raw ADC values from 0-4095
 you can convert them to a voltage by multiplying
 by the ADC's reference voltage -- nominally 3.3v.
 So a 0 value is equal to 0 volts and a full scale
 4095 value is equal to 3.3v. The reading you get
 is some fraction in between those:

        (value / full-scale) * refVolts

 example, if your value happens to be 2000:

        (2000 / 4095) * 3.3 == 1.6117 volts

 I would take the last couple digits with a grain
 of salt because the system is usually pretty noisy,
 and I'm not really bright enough to figure out if
 the theoretical precision is 3 or 4 decimal points
 anyway.

 Now your sensor may need some calibration and scaling
 so the conversion you use will probably have a form
 like (Mx + B), where M is a scale factor and B is an
 offset, both of which you might derive from spec sheets
 or brute force measurements.

 What are you sensing anyway?
 MS


 Mayank Gupta wrote:

 Thanks for the help Michael. But again I am not really sure how to do
 that.
 Can you refer me to some tutorial  or reading where I can see how to
 actually code it.. Sorry but not really getting it.

 Regards,
 Mayank
 On Fri, Jun 10, 2011 at 5:13 PM, Michael Schippling sc...@santafe.edu
 wrote:

 Pretty much all sensors readings on TOS devices are
 integer values directly from the ADC -- some few, like
 Voltage, may be may be mangled for range and level
 but are probably also ints. IIRC the telosb has a 12
 bit converter so you should have 0-4095 as your values,
 which is a resolution of about .00025 per bit. You may
 convert that to floating point to about 4 decimal places
 if you like.

 MS

 Mayank Gupta wrote:

 Hi all,

 I am sending sensor readings from telosb mote to the pc and storing
 the data in mysql database. The problem I am facing is that I want
 data to be precise upto at least 2 decimal places but data in my
 database always comes out to be as integer. I have modified the mig
 generated file to push data into the database rather than show output
 on the screen.  I hope someone can guide me in the right direction so
 that I can get more precise value in my database.

 Regards,
 Mayank
 ___
 Tinyos-help mailing list
 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


[Tinyos-help] Adding precision to sensor data obtained

2011-06-10 Thread Mayank Gupta
Hi all,

I am sending sensor readings from telosb mote to the pc and storing
the data in mysql database. The problem I am facing is that I want
data to be precise upto at least 2 decimal places but data in my
database always comes out to be as integer. I have modified the mig
generated file to push data into the database rather than show output
on the screen.  I hope someone can guide me in the right direction so
that I can get more precise value in my database.

Regards,
Mayank
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] Adding precision to sensor data obtained

2011-06-10 Thread Michael Schippling
Pretty much all sensors readings on TOS devices are
integer values directly from the ADC -- some few, like
Voltage, may be may be mangled for range and level
but are probably also ints. IIRC the telosb has a 12
bit converter so you should have 0-4095 as your values,
which is a resolution of about .00025 per bit. You may
convert that to floating point to about 4 decimal places
if you like.

MS

Mayank Gupta wrote:
 Hi all,
 
 I am sending sensor readings from telosb mote to the pc and storing
 the data in mysql database. The problem I am facing is that I want
 data to be precise upto at least 2 decimal places but data in my
 database always comes out to be as integer. I have modified the mig
 generated file to push data into the database rather than show output
 on the screen.  I hope someone can guide me in the right direction so
 that I can get more precise value in my database.
 
 Regards,
 Mayank
 ___
 Tinyos-help mailing list
 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


Re: [Tinyos-help] Adding precision to sensor data obtained

2011-06-10 Thread Mayank Gupta
Thanks for the help Michael. But again I am not really sure how to do that.
Can you refer me to some tutorial  or reading where I can see how to
actually code it.. Sorry but not really getting it.

Regards,
Mayank
On Fri, Jun 10, 2011 at 5:13 PM, Michael Schippling sc...@santafe.edu wrote:
 Pretty much all sensors readings on TOS devices are
 integer values directly from the ADC -- some few, like
 Voltage, may be may be mangled for range and level
 but are probably also ints. IIRC the telosb has a 12
 bit converter so you should have 0-4095 as your values,
 which is a resolution of about .00025 per bit. You may
 convert that to floating point to about 4 decimal places
 if you like.

 MS

 Mayank Gupta wrote:

 Hi all,

 I am sending sensor readings from telosb mote to the pc and storing
 the data in mysql database. The problem I am facing is that I want
 data to be precise upto at least 2 decimal places but data in my
 database always comes out to be as integer. I have modified the mig
 generated file to push data into the database rather than show output
 on the screen.  I hope someone can guide me in the right direction so
 that I can get more precise value in my database.

 Regards,
 Mayank
 ___
 Tinyos-help mailing list
 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


Re: [Tinyos-help] Adding precision to sensor data obtained

2011-06-10 Thread Michael Schippling
Assuming that the readings you are getting are,
as I suggested, the raw ADC values from 0-4095
you can convert them to a voltage by multiplying
by the ADC's reference voltage -- nominally 3.3v.
So a 0 value is equal to 0 volts and a full scale
4095 value is equal to 3.3v. The reading you get
is some fraction in between those:

(value / full-scale) * refVolts

example, if your value happens to be 2000:

(2000 / 4095) * 3.3 == 1.6117 volts

I would take the last couple digits with a grain
of salt because the system is usually pretty noisy,
and I'm not really bright enough to figure out if
the theoretical precision is 3 or 4 decimal points
anyway.

Now your sensor may need some calibration and scaling
so the conversion you use will probably have a form
like (Mx + B), where M is a scale factor and B is an
offset, both of which you might derive from spec sheets
or brute force measurements.

What are you sensing anyway?
MS


Mayank Gupta wrote:
 Thanks for the help Michael. But again I am not really sure how to do that.
 Can you refer me to some tutorial  or reading where I can see how to
 actually code it.. Sorry but not really getting it.
 
 Regards,
 Mayank
 On Fri, Jun 10, 2011 at 5:13 PM, Michael Schippling sc...@santafe.edu wrote:
 Pretty much all sensors readings on TOS devices are
 integer values directly from the ADC -- some few, like
 Voltage, may be may be mangled for range and level
 but are probably also ints. IIRC the telosb has a 12
 bit converter so you should have 0-4095 as your values,
 which is a resolution of about .00025 per bit. You may
 convert that to floating point to about 4 decimal places
 if you like.

 MS

 Mayank Gupta wrote:
 Hi all,

 I am sending sensor readings from telosb mote to the pc and storing
 the data in mysql database. The problem I am facing is that I want
 data to be precise upto at least 2 decimal places but data in my
 database always comes out to be as integer. I have modified the mig
 generated file to push data into the database rather than show output
 on the screen.  I hope someone can guide me in the right direction so
 that I can get more precise value in my database.

 Regards,
 Mayank
 ___
 Tinyos-help mailing list
 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