1

Background

I've dabbled in electronics since my parents gave me a 150-in-1 kit in the 1970's but never had formal training. My dad repaired Honeywell mainframes so taught me to solder when I was 8. I have a decent set of equipment like irons, parts, meters, etc. and realize I know enough to be dangerous, which is why I avoid mains-powered stuff. I'm not a newbie but am all too aware of the many holes in my knowledge. I'm doing this for fun and in a way that allows for failures to be expected, cheap, and educational.

Project

I have a WS2812b LED strip connected to an Arduino Uno and am using various animation libraries to drive it. The goal is to move to a pro mini once the hardware is more settled and use it for creative lighting inside my house or garage. I started with just the strip and let it display different animations in a sequence based on time but then wanted to attach a button which would advance to the next animation. After implementing debouncing it worked fine and I moved on to adding a potentiometer to select the speed of the current animation; increasing or decreasing the delay between each 'frame'. Of interest here is I was using old pots (panel mount not for typical board use - hence I had to solder wires to them just to use them in any configuration) and not doing any ohms law calculations, just hooking up the hardware and tuning the values for mapping the detected voltage to the desired delay by checking printed output from the serial monitor.

I'm happy with the general setup when using a breadboard but when I went to solder something more permanent on perfboard I ran into a problem; the speed control wouldn't work. I'm sure the first pot I used was 10k but when I checked it with the meter it registered as completely open so I figured I had blown it. Thinking that I needed to control the current I read posts like this one and this one about limiting current I felt better and proceeded to replace the pot with a 25 ohm version thinking that the only difference would be in calibrating the values for mapping the detected voltage to the desired delay. The behavior I got was randomly fluctuating values for the delay and when I hooked up the prototype using USB to my laptop I could see that the analogread() values were fluctuating wildly within a range even when I wasn't manipulating the pot yet nothing I did could get it to be consistent. My first thought was that there was a problem with ground so I rechecked the connections but they all tested fine, including still reading 25 ohms along the outside terminals and varying values on the wiper consistent with rotating it along its path from end to end. When I gave up on my protoboard and returned the circuit back to the breadboard I replaced the full size pot with a 10k small one meant for breadboards and the speed control works again. This leads to my question.

Question

Is there a minimum value for a potentiometer connected to an analog input of an arduino, or is it more likely that there was an issue with my soldering job on the protoboard? I don't have a picture of the board because I've already desoldered components from it but I can tell you that it was my first attempt at perfboard soldering and it would not win any prizes, sort of the 'face only a mother could love' sort of thing. If it matters, I was using analog input A2.

  • if you have all 3 legs connected (vcc, gnd, a2) anything above 100r should work within the current limits of the MCU, though 10k is probably ideal in terms of accuracy and low current draw. 5v into 25r is 200ma; 10X what the MCU wants to provide. – dandavis Mar 27 '18 at 19:16
1

Assuming you wired it correctly (ie. you put the wiper to the analog input) your first setup looked like this:

25 ohm pot

Your big problem here is the current flow through the pot. Using Ohms Law the current would be:

I = V / R
I = 5 / 25
I = 0.2A  (200 mA)

That is too much to be drawing from the 5V pin and it could easily drag down the voltage to the rest of the board. Also the power would be:

W = I * V
W = 0.2 * 5
W = 1W

One watt is a lot to put through a pot, and you may well have burned the track inside it.


So, if I included a 10k resistor on either side of the pot that should address the current issue but it leaves the question of whether the remaining 25-ohm range is too small for the ADC to register distinct values, ...

The 10k resistor will stop the current problem, but now the range in the voltage divider will be ridiculously small. The setup will now look like this:

Pot with resistors

Unfortunately the range you are going to read with the analog input is going to be (voltage divider formula):

Vout = Vin * (R2 / (R1 + R2))

With the wiper at one end R1 will be 10000 and R2 will be 10025 and with the wiper at the other end it will be vice-versa. So the voltage you get will be:

Vout = 5 * (10000 / (10025 + 10000))
Vout = 5 * 0.499
Vout = 2.497

Or:

Vout = 5 * (10025 / (10025 + 10000))
Vout = 5 * 0.501
Vout = 2.503

In other words you will always be reading about 2.5V and therefore your analog read will always return around 512, which won't be much use to you.


I'm going with a larger value pot (10k or 25k) ...

That sounds like a sensible value. A 10k pot will only draw:

I = V / R
I = 5 / 10000
I = 0.5 mA

That is a reasonable current draw and the analog input will still read it fine.


As Majenko points out in his answer you don't want a whole lot more than that resistance because of the optimal input impedance of the ADC converter (10k). A very high resistance would mean only a small current would flow into the analog input pin.


How to use your 25 ohm pots

If you want to use your existing 25 ohms pots because of their physical appearance, then a small resistor in series could reduce the current to a reasonable amount and still give a good reading range. For example, 330 ohms on the "high" side (and nothing between the low side and ground).

Vout = 5 * (330 / (355 + 330))
Vout = 5 * 0.193
Vout = 0.963

Or:

Vout = 5 * (355 / (355 + 330))
Vout = 5 * 0.581
Vout = 2.591

That is now going to give you a reading between 0.96V and 2.59V which, whilst not the full range of 0V to 5V should give you reasonable differentiation as you turn the pot. And the current through it would be:

I = V / R
I = 5 / 355
I = 0.014A (14 mA)

Thus the power would be:

W = I * V
W = 0.014 * 5
W = 0.070 (70 mW)

References

1

Most potentiometers take the form of a 3-terminal device, where the two outside terminals are a fixed resistor and the middle terminal adjusts the tap from one extreme to the other.

schematic

simulate this circuit – Schematic created using CircuitLab

In this configuration, you end up creating a simple voltage divider. You should pick the potentiometer's voltage such that the fixed portion does not draw more current than necessary, regardless of the tap position. (The arduino's analog input itself does not draw any significant current really.)

If you use a 1k pot, then the current always flowing from 5V to ground is 5mA, which should not tax the Arduino's voltage regulator too much. If you used a 100 ohm pot, then the current would be 50mA -- not likely to damage things, but certainly more than is necessary just to operate a voltage divider.

If you use a 1M-ohm pot, then you are working with 5 micro-Amps, and at that low current, noise from the power supply starts to interfere with your analog readings.

As for your actual setup, it really depends on how you had it wired, etc.

1

There is no lower limit on the value of a potentiometer that you can use with the Arduino, however the lower the resistance the more current it will pull from the power supply and, if it's too low a resistance and isn't rated for a high enough power, could burn out and catch on fire.

There is, however, an upper limit on the resistance of a potentiometer that you can use.

As a general rule of thumb the output impedance of what you connect to an ADC should be no more than around a tenth of the input impedance of the ADC. On the Arduino the ADC has around a 1MΩ input impedance, so you shouldn't connect anything with more than around 100kΩ output impedance.

For a potentiometer (well, for any voltage divider) the output impedance is the value of the two halves of the resistance in parallel. For a 10K potentiometer with the wiper set right in the middle that's 5K for each half, so the formula is:

     R1 * R2   5000 * 5000
Ro = ------- = ----------- = 2500Ω
     R1 + R2   5000 + 5000

As you can imagine that's the maximum output impedance at that point. For example, if you adjust it so it's 9000Ω and 1000Ω it works out as:

     R1 * R2   1000 * 9000
Ro = ------- = ----------- = 900Ω
     R1 + R2   9000 + 9000

So from that you can interpolate that the maximum value potentiometer you can reliably use would have an output impedance of 100kΩ, which is (100000/2500) 40 times more than the 10kΩ one, so 400kΩ is really the maximum you can use.

The main reason for this limit is that the ADC's front-end is a capacitor, and that capacitor has to charge up to the voltage of the input. That charge time is limited by the current available to flow into the pin, and with too high an output impedance the current available is too low and the capacitor can't charge to the right voltage in the limited acquisition time of the ADC.

The datasheet itself speaks of the output impedance limit:

The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less. If such a source is used, the sampling time will be negligible.

So they don't recommend anything more than 10kΩ, which equates to a maximum of 40kΩ for the potentiometer's resistance.

0

The Analog Digital Converter (ADC aka analog input) has only a small capacitance, which has to be loaded to do a measurement. This is normally no problem, even with high resistance potentiometers. Also - if you are using the potentiometer correctly - it is very unlikely, that you have blown it (with 5V supply voltage there is only a current flow of 0.5mA through a 10k potentiometer). The current that flows in the ADC is also very small.

The point in using a potentiometer for providing analog input is, that the total resitance is always the same, regardless of the position. See this schematic:

schematic

simulate this circuit – Schematic created using CircuitLab

Both voltage dividers have the same total resistance (10kOhm). If you set the position of the potentiometer to the middle, they have exactly the same output: 2.5V. Moving the slider of the potentiometer is the same as taking some of the resistance from one of the resistors on the right and adding it to the other. So a potentiometer is a variable voltage divider. Normally you want the current, that flows through this voltage divider to be small, because it would be only wasted to heat the resistor strip. If you are using a potentiometer with 25 Ohm total resistance while having a 5V power supply, the current trough it would be 200mA, which is pretty much. And if your power supply cannot give you that much, your application will get really instable.

So I see 2 possible problems:

  1. You used the potentiometer the wrong way, or
  2. You made a soldering mistake

EDIT:

From your comment I read, that you are not familiar enough with the rules, how a voltage divider really works. So I will try to explain a bit more.

A potentiometer looks like this on the inside. It consists of one strip of a resistive material. Each side of the strip is connected to one of the outer pins. The full length of the strip has a constant resistance, say 10kOhm for now. The knob of the potentiometer is connected to a contact, that slides over this resistive strip, making electrical contact with it. When you measure the resistance between one of the outer pins and this middle contact, you get a resistance that is dependent on the position of the contact.

Let's say, we want to measure the resistance between the left contact and the middle contact (the slider). If the slider is very close to the left pin, the resistance we measure is very small, since there is only very few resistive material between the contacts. As we move farer away from the left side of the strip, the measured resistance gets bigger.

At the same time (when we are moving away from the left side of the strip) we are moving towards the right side of the strip, essentially decreasing the resistance between the middle contact and the right side of the strip.

Now we have to do some maths: Ohm's Law states that voltage is resistance multiplied by current

U = R * I

We connect the outer pins of the potentiometer to our 5V power supply and to ground. So U = 5V. And we know the total resistance between these pins: 10 kOhm. To get the current, that flows through our potentiometer, we reform the above formula to

I = U / R

Using the above values we calculate the current through the potentiometer to be 0.5mA. The current through the first part of the resistor strip (say from left to the middle contact) is the same as in the second part (from middle contact to right), as the current has nowhere else to go.

Now we position the middle contact exactly in the middle of the resistive strip. This means that you have half of the total resistance on each side: 5 kOhm. In electrical circuits the voltage is always measured in reference to ground. So here only the ground side matters for the rest of the calculation. We again need Ohm's Law:

U = R * I = 5kOhm * 0.5mA = 2.5V

As we want to read this with an Arduino (which uses a 10 bit ADC --> values in the range of 0 to 1023) we get about 512. (This may vary a bit because of fluctuations and distortion)

When we position the middle contact at the ground end of the resistive strip, we have a ground-side resistance of about 0 Ohm. So we get 0V at the middle pin and a ADC value of about 0.

When we position the middle contact at the 5V end of the resistive strip, we have a ground-side resistance of about 10 kOhm. Using Ohm's Law we get 5V at the middle pin, which translates to an ADC value of about 1023.

Changing the position also changes the ratio of the resistance on ground-side and 5V-side of the strip. But when you (as said in your comment) just add big resistors to both sides of the 25 Ohm potentiometer, you will only we able to control this really small part of the total resistance. So this will not work.

Note: Not every potentiometer has a linear changing resistive strip. Some have a logarithmic or exponential changing strip.

  • So, if I included a 10k resistor on either side of the pot that should address the current issue but it leaves the question of whether the remaining 25-ohm range is too small for the ADC to register distinct values, or is the ADC still sensitive enough? I'm going with a larger value pot (10k or 25k) anyway but I'm still interested in understanding what happened when I used the 25r one. – Kelly S. French Mar 27 '18 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.