Announcement

Collapse
No announcement yet.

RF300PC1 ADC readings

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • RF300PC1 ADC readings

    Good evening all,

    I am trying to get accurate ADC readings on an RF300PC1 on a proto board. I have a pullup resistor attached to Vcc, resistor/thermistor junction to GPIO3 (ADC input) and bottom end of the thermistor to Gnd. Since I got different readings when using the battery pack and the regulated 3.2v and I wanted the readings to be the same, I use this poke instruction, poke(-0xD1, 0x8), to set the ADC reference to Vdd. Doing that DOES keep the reading the same when using either power source but it is not what I expected.

    I have the data sheet for the thermistor I am using so I figured at room temperature, I should get around 195, not the 90 I was getting. The pullup I am using is 470K because after doing some calculations, that is what I came up with to get the thermistor into the mid range of the ADC output. Since that gave me unexpected readings, I replaced the thermistor with another 470k resistor. I would think that would give me something close to the center of the 0-1023 range, approximately 512, but I am getting 262. Then to be sure the high valued resistors weren't the problem, I changed them to 2.2k and that gave me 259, not much change.

    Does anyone have any suggestions as to why I don't get 512 when the input should be 1/2 Vcc?

    Thanks very much!

  • #2
    As a quick sanity check. Try applying a known voltage to the ADC (bench supply, etc...) and verifying the reading makes sense.
    sigpic
    Proven Solutions for the Internet of Things
    www.synapse-wireless.com

    Comment


    • #3
      Ok, I'll try that in the morning but I just checked GPIO3 with respect to GND with a digital volt meter and it reads 1.63V. Vcc is 3.25V.

      Comment


      • #4
        This could be due to the fact the pins is floating (ie not configured in your script).

        I would still proceed with trying 1 - a known voltage, 2- grounding the pin and making sure the ADC reads 0, 3- Tying the pin to Vcc and making sure the ADC reads 1023.
        sigpic
        Proven Solutions for the Internet of Things
        www.synapse-wireless.com

        Comment


        • #5
          It took me a while to get back to this but I figured out what is happening, but not sure why. In my startupEvent(), I use:

          poke(-0x00D1, 0x0c) #set ADC ref to Vcc

          It was after that where I realized all my readings were approximately 1/2 of what they should be. I thought, maybe the gain has been set to .5, so I peeked at the register and it was .5. So I added this to the startupEvent():

          poke(-0x00BC, 0x1B) #set gain to 1

          I still got readings 1/2 of what I expected. Then I stuck the above instruction directly before my readAdc() instruction inside my readTemp() function and I get the proper readings. So it appears that I can set the ref voltage source in the startupEvent() but have to set the gain immediately before the readAdc(). I have absolutely no idea how SNAP executes ADC reads. From my experience with the SiLabs C8051F930 (same processor), the ADC mux has to be configured sometime before the read and therefore, that must happen in SNAP immediately before every ADC read. How else could you read multiple ADC inputs? What I can't figure out is, 'when is the gain setting set back to .5', forcing me to reset it to 1?

          btw, this is all mostly intended as an fyi as to what I found, so don't waste a lot of time trying to figure this out.

          Thanks

          Comment


          • #6
            Thanks for sharing your results. Too often folks fix there issues behind the scenes and never post again.


            BTW, an interesting test would be to perform the same readings without either pokes (both setting the ADC reference and gain).
            sigpic
            Proven Solutions for the Internet of Things
            www.synapse-wireless.com

            Comment

            Working...
            X