huh...I'd better go look at the code and schematic for the acutal Vref..
I should already know this, but I've not been concerned with accuracy
in my conversions...

But the interpretation of the formula is incorrect. The formula is the
same as the one I sent. Vport is the acutal analog voltage at the
converter input (not the binary output (ADC) which is written as (2^6-1)).
Effectively it's the ratio of the input to Vref times the max for the
number of bits of conversion. Mica's have 10bit converters so that's 1024.
I don't know where the 2^6 comes from...maybe an older device with 6 bit
converters, or a typo.

In any case the maximum voltage on the pin is speced at something around
Vcc + 1 or there-abouts. I stand by the assertion that the max input reading
is _close_ to the Vref because that's how successive approximation converters
work...I will spend a bit of time looking into what Vref actually is...

MS

TEAM X wrote:
Thanks for the help, I will take a look at your code. But I just want to put this out there.
According to the comments in tos/platform/mica2/ADCREFM.nc :

/*  OS component abstraction of the analog to digital converter using a
 *  fixed reference input.  I assumes the presence of a TOS_ADC_BANDGAP_PORT
 *  to provide that referenced reading. This module was designed to
 *  accomodate platforms that use varying/unstable ADC references. It also
* works around limitations where the measured variable cannot be larger than
 *  the actual ADC reference
 *
 *  The conversion result is given by the equation:
 *
 *         ADC = (Vport * 1024) / Vref
 *
* Where Vport can be between zero and (2^6-1)*Vref (I.E. Vport CAN be larger
 *  than Vref)
 *
 *  Note: On the ATmega128, Vref (using this module) is 1.23 Volts
 */

(2^6-1)=63
63*1.23 = 77.49

This is obviously incorrect, so I would to know what the real range of inputs on the ADC is if anyone knows.

Thanks again,
Joe

On 2/3/06, * Michael Schippling* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    There are some examples of using the ADC component directly in my huge
    bolus of code at:   http://www.etantdonnes.com/Motes/robocode.tar.gz
    Most likely you have not made the ADC and input so you are converting
    the equivalent of a logic 1...

    The only special sensorboard stuff is that they switch on internal
    sensors (photo,temp) using digital outputs from some specific pins
    and then make sure to switch the ADC to the right channel. The code
    should work pretty well without the SB attached. You should be able to
    connect your input to ADC1 and use the Photo component to get started.

    I'm a little confused by your math...basically Vref is the Max voltage
    and 0 is the Min. I think it should be   ADC =  (Vin / Vref) * 1024
    where 1024 is the maximum reading from a 10 bit converter. Also I
    believe
    Vref is the supply voltage or very near, so 3 volts.

    MS


    TEAM X wrote:
     > Hi,
     >
     > I'm trying to connect some components to the ADC channels on a
    Mica2.  I am not using the Crossbow sensorboards, but all of the
    code examples I have seen are using this sensorboard.
     > The only ports I have connected are the ADC channel (ADC3) and
    ground. No matter what voltage I put on the input channel, I get a
    very large value (>32000) as the input for the ADC.  Am I missing
    something?
     >
     >
     >
     > Does anyone have an example of code for the ADC that does not use
    a Crossbow sensorboard?
     >
     > On a related issue,
     > ADC=(Vin / 1024) * Vref
     > Where Vin can be between 0 and (2^6-1)*Vref and Vref is 1.23 V.
     >
     >
     > Does this really mean that the ADC can take in voltages of up to
    80V.  I find that hard to believe.
     >
     > Thanks very much,
     > Joe
     >
     >
     >
    ------------------------------------------------------------------------

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


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

Reply via email to