Go Down

### Topic: Maximum Pull down resistor on analog pin (Read 9209 times)previous topic - next topic

#### wdl1908

##### Jul 17, 2011, 03:30 pm
What is the maximum resistor that can be used as a pull down on an analog pin.

The resistor will be switched with push buttons in parallel to a voltage divider.

#1
##### Jul 17, 2011, 07:02 pm
Quote
The resistor will be switched with push buttons in parallel to a voltage divider.

It's not clear (to me anyway) exactly what circuit this is, how about a schematic.

In general though for example a 150R resistor will draw about 30mA from the pin, this is probably as much as should be drawn, 20mA (with a 250R resistor) is better.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

#### retrolefty

#2
##### Jul 17, 2011, 07:25 pmLast Edit: Jul 17, 2011, 07:29 pm by retrolefty Reason: 1

What is the maximum resistor that can be used as a pull down on an analog pin.

The resistor will be switched with push buttons in parallel to a voltage divider.

Actually a pull-down or pull-up resistor is of no benefit for analog input pins, unless for example the driving signal is a open collector or open drain transistor which requires an external pull-up to establish the output voltage and source impedance.

What is required is that the source impedance of the external voltage divider presents a 10k ohm or lower impedance. Adding external pull-ups or downs to an existing voltage divider just changes the divider ratio thus upsetting the 'calibration' constant assumed only defined by the original external divider ratio.

What is required for your external mult-tapped voltage divider using manual switches to present the 'fixed' voltage taps for reading on the analog input switch, is proper sizing of all the resistors such that the source impedenace as seen by the analog input pin is always 10,000 ohms or lower.

Lefty

#### wdl1908

#3
##### Jul 18, 2011, 07:52 am

Actually a pull-down or pull-up resistor is of no benefit for analog input pins, unless for example the driving signal is a open collector or open drain transistor which requires an external pull-up to establish the output voltage and source impedance.

Yes that is the case.

What is required is that the source impedance of the external voltage divider presents a 10k ohm or lower impedance. Adding external pull-ups or downs to an existing voltage divider just changes the divider ratio thus upsetting the 'calibration' constant assumed only defined by the original external divider ratio.

If the ratio of one side of the parallel circuit and the other are large enough the difference is small enough not to be a problem.

Say you put 10k and 2.2M in parallel the resulting resistor value is 9999.995 with a tolerance of 5% this difference is non existent.

What is required for your external mult-tapped voltage divider using manual switches to present the 'fixed' voltage taps for reading on the analog input switch, is proper sizing of all the resistors such that the source impedenace as seen by the analog input pin is always 10,000 ohms or lower.

All the voltage dividers I have seen only use a part of the 5V supply. And the division is rarely even.

What I wanted to do is this

Code: [Select]

+5V
|   4
R
|   3
R
|   2
R              a_______ Analog Pin
|   1          |
R              Rp
|              |
GND         GND

R is 10k Rp is 2.2M

button are connected between a and the pins 1 to 4

Now the voltage value can be easily calculated by the program processing the input. Just divide by the number of buttons add some hysteresis and voila. I could add 12 buttons without the need to calculate every single resistor.

I find this much preferable than all the other solutions out there to get buttons working on analog pins.

If you want to add a button just add a 10k resistor. When you have to do that with all the other ways to construct a voltage divider when you want to add a button you have to recalculate all resistors to get an even spread.

Now the question is what would be the minimum current needed on the analog pin to make it read 0.

#### borref

#4
##### Jul 18, 2011, 12:11 pm

I find this much preferable than all the other solutions out there to get buttons working on analog pins.

Preference is subject to requirements and if you need to distinguish button/switches pressed simultaneously, some other scheme will be required. In your case the top button pressed will hide the others. This may be ok for some designs, but not all.

An issue with your circuit is that input impedance will be 2.2M with no buttons pressed and settling time for ADC will then be very long. For a small keypad, this may still be acceptable, but requires some clever coding on your part. Using the other analog input ports will not be practical in this context.

Quote

Now the question is what would be the minimum current needed on the analog pin to make it read 0.

Question is not making a lot of sense as we read voltage (not current) with ADC.

#### wdl1908

#5
##### Jul 18, 2011, 01:21 pm

An issue with your circuit is that input impedance will be 2.2M with no buttons pressed and settling time for ADC will then be very long. For a small keypad, this may still be acceptable, but requires some clever coding on your part.
Quote

How long are we talking about here?
I've tested this setup with 12 buttons and it seems to work fine. There is a hysteresis of 5% / level and this was done on a breadboard with lots of long wires I suspect it will do even better when on a PCB

Using the other analog input ports will not be practical in this context.
Quote

Can you elaborate on that statement?

#### borref

#6
##### Jul 18, 2011, 06:53 pm
If you keep the sum of the resistors at 10k or below (see post from retrolefty), you will be ok with instant samples of buttons. When the button is released however, you need to wait (and discard samples) until ADC settles at close to zero. You can calculate an estimate for time required as follows:

t = R * C * 14 = 2.2M * 14pF * 14 = 431us

This is the time required to discharge the ADC holding capacitor to 1/3 (1.67V). If you have 12 buttons, you need to get it down to about 5V/12/2 (208mV). Time required is then about 1.3ms. During this time, you need to continuously sample button state until you approach zero (208mV or less).

If you use the multiplexer to read from a different ADC channel, another 1.3ms (with continues sampling) must pass before you can trust sampled button state again.

#### wdl1908

#7
##### Jul 19, 2011, 08:06 am
BenF,

Thanks for the very good explanation. All those times fall within the 10ms debounce I had planned

Go Up