Author Topic: Question about potentiometers as voltage dividers  (Read 2838 times)

0 Members and 1 Guest are viewing this topic.

Offline little_carlosTopic starter

  • Regular Contributor
  • *
  • Posts: 133
Question about potentiometers as voltage dividers
« on: April 15, 2016, 06:03:16 am »
Whats the difference of using a 1k, 100k, 50k or 1M or bigger pot as a voltage divier? (apart from the resistance value)
Im asking this, because i did a pwm control using a pot with a pic, and conecting the pot to the adc, i noticed that using small values like 1k pot give much more accuracy in the control than using 100k, which is pretty awful
can someone explain me what is happening here?
 

Offline Kilrah

  • Supporter
  • ****
  • Posts: 1852
  • Country: ch
Re: Question about potentiometers as voltage dividers
« Reply #1 on: April 15, 2016, 06:29:03 am »
The ADC has a tiny sampling cap that must be charged/discharged to the voltage you want to measure - the higher the impedance of your source the longer it will take.

But normally if the wiper is jsut connected straight to the ADC input you shouldn't be seeing any difference in those ranges. It suggests you're doing something wrong, either in the circuit or in the PIC (having an internal pullup enabled on the pin for example).
 

Offline ade

  • Supporter
  • ****
  • Posts: 231
  • Country: ca
Re: Question about potentiometers as voltage dividers
« Reply #2 on: April 15, 2016, 07:02:09 am »
Or maybe they are different kinds of pots... e.g., 1k linear vs. 100k log or anti-log.
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4208
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Question about potentiometers as voltage dividers
« Reply #3 on: April 15, 2016, 08:05:20 am »
We need to know what else your potential divider is connected to. Is its output just attached to the ADC, or are there any other components involved?

Do you have a capacitor between the ADC pin and ground? And is it physically as close to the ADC as it can possibly be, with the shortest possible wires?

Every time an ADC takes a sample, there's a small capacitor inside the PIC which must first be charged to the same voltage as you're looking to measure. This capacitor is part of a sample-and-hold circuit, which is required in order to ensure the ADC sees a constant voltage throughout the conversion process even if the external signal is changing.

Charging up this capacitor takes time, and during this time, the ADC input draws a little current from whatever source it's sampling. On a scope you'll see this as a small negative spike on the signal each time a sample is taken, and the size of this spike depends on the source impedance of the signal you're measuring.

With a high value pot, the spike will be larger than with a low value one.

For an input which changes as slowly as a pot, normal practice is to put a much larger capacitor (somewhere around 100nF to 1uF should do) right next to the ADC input. This capacitor supplies the brief current spike required by the sample-and-hold circuit without affecting the dc accuracy of the system.

Signals that change faster require a different approach, usually an active buffer right by the ADC - but you don't need one for this.

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: Question about potentiometers as voltage dividers
« Reply #4 on: April 15, 2016, 11:27:43 am »
Some A/Ds buffer the sampling cap so that its charge cycle effects do not
appear at pin. Then Hi Z pots incur offsets due to bias current of the buffer.
Also Hi Z nodes are subject to stray pickup, C coupling, of other signals
on board and in the environment. Take a scope with a 10X probe, hold the
probe tip, and observe the pickup that occurs from mains in the building.

Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14080
  • Country: de
Re: Question about potentiometers as voltage dividers
« Reply #5 on: April 15, 2016, 11:54:30 am »
The PIC µCs usually specify a maximum impedance of something like 2-10 K for the signal source. So if the signal source is higher impedance the errors can get larger.

The pot output impedance is highest at the center, giving 1/4 of the pot value for the output impedance. So the 100 K pot is already a little on the high side for the ADC input. It gets better with an added 10-100nF capacitor to GND.

In addition the high resistance circuit is more sensitive to capacitive coupled hum (e.g. 60 Hz).





 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: Question about potentiometers as voltage dividers
« Reply #6 on: April 15, 2016, 02:25:43 pm »
16F877 datasheet section 11.1 (page 114) says 10k maximum driving impedance.  Always go to the source!
http://ww1.microchip.com/downloads/en/DeviceDoc/30292D.pdf

So, the pot needs to be smaller than 40k and, without looking, I imagine 10k is the closest standard value.

The concern with smaller values is wasted power, the concern with larger values is noise pickup.  Adding a capacitor at the pin is always a good idea.  Something like 0.1 ufd might be adequate.

If there is a circuit driving the AD input that has high output impedance, it is often necessary to add an op amp voltage follower.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19345
  • Country: gb
  • 0999
Re: Question about potentiometers as voltage dividers
« Reply #7 on: April 17, 2016, 09:34:05 am »
We need to know what else your potential divider is connected to. Is its output just attached to the ADC, or are there any other components involved?

Do you have a capacitor between the ADC pin and ground? And is it physically as close to the ADC as it can possibly be, with the shortest possible wires?

Every time an ADC takes a sample, there's a small capacitor inside the PIC which must first be charged to the same voltage as you're looking to measure. This capacitor is part of a sample-and-hold circuit, which is required in order to ensure the ADC sees a constant voltage throughout the conversion process even if the external signal is changing.

Charging up this capacitor takes time, and during this time, the ADC input draws a little current from whatever source it's sampling. On a scope you'll see this as a small negative spike on the signal each time a sample is taken, and the size of this spike depends on the source impedance of the signal you're measuring.

With a high value pot, the spike will be larger than with a low value one.

For an input which changes as slowly as a pot, normal practice is to put a much larger capacitor (somewhere around 100nF to 1uF should do) right next to the ADC input. This capacitor supplies the brief current spike required by the sample-and-hold circuit without affecting the dc accuracy of the system.

Signals that change faster require a different approach, usually an active buffer right by the ADC - but you don't need one for this.
Just a couple of points:

1) It works both ways. The capacitor in the sample and hold circuit will discharge back into the input source when the input voltage is reduced, causing it to rise slightly. Therefore if the input signal is falling, there will be tiny positive spikes when a sample is taken.

2) If the input voltage is stable then the voltage on the sample and hold capacitor will reach an equilibrium over time, so this could potentially be solved with software, for a DC signal. Keep sampling the ADC until the signal  changes less than a couple of counts, then you have the correct value. Of course, this will only work for an ADC, reading only one channel. If it's multiplexed, then the sample and hold capacitor will be charging/discharging as the ADC is switched from one channel to another, so it won't work.

2) You mention PICs, yet the original poster hasn't specified an MCU. Presumably you've made this assumption because you're most familiar with PICs and they're quite common on the hobbyist scene but without knowing the exact MCU the original poster is using, it's difficult to say what's going on.
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4208
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Question about potentiometers as voltage dividers
« Reply #8 on: April 17, 2016, 10:11:21 am »
2) You mention PICs, yet the original poster hasn't specified an MCU. Presumably you've made this assumption because you're most familiar with PICs and they're quite common on the hobbyist scene but without knowing the exact MCU the original poster is using, it's difficult to say what's going on.

i did a pwm control using a pot with a pic
 
The following users thanked this post: Kilrah

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19345
  • Country: gb
  • 0999
Re: Question about potentiometers as voltage dividers
« Reply #9 on: April 17, 2016, 11:13:27 am »
Oh, sorry I missed that. Still, there are a wide range of different PICs so the specific part number would help.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf