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

Reply via email to