This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Method to source a voltage to a variable resistor and get an accurate ADC measurement

Hi Folks,

Need some advice. We are sourcing voltage to a variable resistor from an output pin. We've configured this as a high ouput. The overall resistance of the POT ranges from 5K to 20K. We've noticed that the output voltage that the pin drives is lower than the battery voltage. The results from the wiper leg of the POT has error that is proportional to the voltage difference that we've seen between the battery and the Pin we are driving the pot.

Any advice on best practice for our design? I'd like to have a stable reference voltage to derive our ADC measurements. 

Thanks,

Rob

Parents
  • More information you will want to know:

    Part nrf52840, this is on a module from Fanstel, BC840M.

    We are driving our potentiometer with Pin 0.22, configured as S0H1

    The wiper leg of the pot goes to analalog pin Ain0

    Ground for everything on the board is from a coin cell battery GND tied to a ground plane.

    We see pretty accurate results when the potentiometer overall resistance is 10K or greater. We are having trouble when it's less than 10K. The lower resistance is causing a larger current draw from the output pin. 

  • Don't do this:

    //                        +--------------------
    //                        |    VDD
    //                        |   --#--
    //                        |     |                  
    //                        |     |                       
    //                        |     +-|                        
    //                        |       |--+                        
    //                        |     +-|  |
    //                        |     |    |
    //    #-------------------O-----#    0<-- P0.22
    //    |                   |     |    |
    //    |                   |     +-|  |
    //    |                   |       |--+
    //    |                   |     +-|
    //    |                   |     |
    //    |                   |     |
    //    |                   |   =====
    //    |                   |    ===
    //    |                   |     =
    //    |                   |
    //   +++                  |
    //   | |          AIN0    |   - Measure via ADC
    //   | |<--#--------#-----O-----#-------------#--> P0.02 ADC
    //   | |   |        |     |     |             |    Ref = VDD
    //   +++   |   100nF|     |     +-|           |
    //    |    |      -----   |       |<- P0.02 -----
    //    #----#      -----   |     +-|         -----
    //    |             |     |     |             |
    //    |             |     |     |             |
    //  =====         =====   |   =====         =====
    //   ===           ===    |    ===           ===
    //    =             =     |     =             =
    //                        | nRF52832
    //                        +----------------------------------

    Do this:

    //                        +--------------------
    //                        |    VDD
    //                        |   --#--
    //                        |     |                  
    //                        |     |                       
    //                        |     +-|                        
    //                        |       |--+                        
    //                        |     +-|  |
    //                        |     |    |
    //    #-------------------O-----#    0<-- P0.22
    //    |                   |     |    |
    //    |                   |     +-|  |
    //    |                   |       |--+
    //    |                   |     +-|
    //    |                   |     |
    //    |                   |     |
    //    |                   |   =====
    //    |                   |    ===
    //    |                   |     =
    //    |                   |
    //   +++                  |
    //   | |          AIN0    |   - Measure via ADC
    //   | |<-----------#-----O-----#-------------#--> P0.02 ADC
    //   | |            |     |     |             |    Ref = VDD
    //   +++       100nF|     |     +-|           |
    //    |           -----   |       |<- P0.02 -----
    //    |           -----   |     +-|         -----
    //    |             |     |     |             |
    //    |             |     |     |             |
    //  =====         =====   |   =====         =====
    //   ===           ===    |    ===           ===
    //    =             =     |     =             =
    //                        | nRF52832
    //                        +----------------------------------
    

    Spot the difference? That's my suggestion .. might be the cause of the issue; also ensure reference is set to Vdd.

  • We did the latter diagram. Your first diagram looks like the wiper is short circuited to ground somehow. I think our error is in not accounting for the source resistance for P0.22.

  • This was not clear in the question "resistance of the POT ranges from 5K to 20K"; in the second configuration the pot resistance does not change - the drive pin only sees a 20k load regardless of wiper position ignoring the input impedance of the ADC which is high.

    So the alternative is may be source impedance as seen by the ADC; wiper near ground or Vdd is low impedance, wiper near the middle of the pot means source impedance is closer to 10k. Check by increasing sample time.

    The fix may be to sample the voltage at the top of the pot, and take the ratio; this requires normally a second pin for that second ADC sample, but if a capacitor is placed from the drive pin to ground it may hold the drive voltage long enough to turn the drive pin around and do an immediate ADC sample to make the ratiometric measurement. The discharge will be constant so a correction for that measurement time decay can be made.

  • We may incorporate something like this or just drive it from the battery with an external switch. We designed that part out and hindsight should have kept it in. We got enamored with the part being able to source 5mA of current thinking it was just sourcing VCC from the battery directly without considering the source resistance of the driver. Simple change.

Reply Children
No Data
Related