Dear Michiel.

I've changed the configuration from:

const msp430adc12_channel_config_t Adc1 = {

      INPUT_CHANNEL_A0,
      REFERENCE_VREFplus_AVss,
      REFVOLT_LEVEL_2_5,
      SHT_SOURCE_ACLK,
      SHT_CLOCK_DIV_1,
      SAMPLE_HOLD_4_CYCLES,
      SAMPCON_SOURCE_SMCLK,
      SAMPCON_CLOCK_DIV_1
    };

To:

const msp430adc12_channel_config_t Adc1 = {
            INPUT_CHANNEL_A0,
            REFERENCE_AVcc_AVss,
            SAMPLE_HOLD_4_CYCLES,
            SHT_SOURCE_SMCLK,
            SHT_CLOCK_DIV_1,
            SAMPCON_SOURCE_SMCLK,
            SAMPCON_CLOCK_DIV_1,
            REFVOLT_LEVEL_1_5
        };

According your advice. And now I'm getting the values (raw data) inside
the correct margins (390-475). Right now when I'm measuring the air (with
the soil sensor) the telosb node is getting   452  : - )


... I have a doubt.

By his formula given:

Vin = ADC * Vref / 4096
X * Vbat = ADC * Vbat / 4096

Why you consider Vref = Vbat if the Vref = 1.5 and the Vbat = 3.0 V?
because: REFVOLT_LEVEL_1_5

Please would you tell me what is my error?


Thanks a lot for you answer and to share his knowledges!!!

I can't believe is working fine now!!!


Yours faithfully,

Alejandro.





> Hi! Please send your questions to the mailing list, too, so others might
> benefit. See below for (hopefully) an answer to your question.
>
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]]
>> Sent: maandag 16 april 2012 11:33
>> To: Michiel Konstapel
>> Subject: Re: [Tinyos-help] Error marging using REFVOLT_LEVEL_2_5 to
>> read a portADC
>>
>> Dear Michiel.
>>
>> Thanks a lot for your answer. I'm trying to measure a Soil probe
>> attached with a telosb mote. I'm sending 3V from the Exclusive Digital
>> I/O 2 (GIO2) telosb pin to the Soil probe. It is entering to the soil
>> probe as the excitation input, then the soil probe returns its sensor
>> value to the mote, this value is entering to the Analog Input 0 (ADC0)
>> in the telosb mote.
>>
>> I was reading that according to the soil probe manual it must receive
>> an excitation in the range of 2-5V and for 2V 2mA for 10ms
>> approximately. The value that the soil probe returns to the telosb is
>> in the ranges between
>> 10 and 50% of the excitation voltage, then is less of 3V.
>>
>> When I measure the soil probe when it is in the air, I must get values
>> in the ranges between 375-475.
>
> Against what reference? 2.5V, or against whatever you're using as the
> excitation voltage?
>
>> But when I put a pair of new batteries AA (3.0
>> V) the value I get is approximately of 570. But when I put a pair of
>> batteries used with 2.5 V  the measure is better I mean now is 470. For
>> this motive is my doubt.
>
> The reference voltage is generated from your supply voltage, so once your
> batteries are down to 2.5V, it won't be able to generate a 2.5V reference
> voltage anymore. I'm not sure what the minimum Vcc for the voltage
> generator is, you'd have to check the data sheet
> (http://www.ti.com/lit/ds/symlink/msp430f1611.pdf).
>
> To check your measurements, just measure the output of the soil sensor
> with a volt meter, and convert your ADC readings back to a voltage and see
> if they match:
>
> ADC = Vin / Vref * 4096
> Vin = ADC * Vref / 4096
>
> For example, your measurement of 470, with the 2.5V reference, would mean
> the input voltage was
> Vin = 470 * 2.5 / 4096 = 0.29 V
>
> If your volt meter tells you a very different value, something's wrong,
> somewhere.
>
> Since the soil probe has an output voltage that's relative to its
> excitation voltage, it's probably easier to use your battery voltage as
> the reference. To select that, use sref: REFERENCE_AVcc_AVss in your ADC
> config. Then, it'll work all the way down to 2V, and you can calculate the
> percentage output, X, directly, independent of what your actual battery
> voltage is:
>
> Vin = ADC * Vref / 4096
> X * Vbat = ADC * Vbat / 4096
> X = ADC / 4096
>
> For example, if you're reading 470 on the ADC, that's 470/4096 * 100% =
> 11.4%.
>
> Best,
> Michiel
>


_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to