2 Basic Questions

I have two basic questions that I hope someone can help me with. I have spent more than a few hours trying to find some clarity on these specific questions without luck, and with incredible frustration at my ineptitude.

  1. Multiple websites imply that the 'solution' to floating voltage in the use of switches is to incorporate pull-down or pull-up resistors. However, isn't the 'solution' just getting an Arduino to 'read' a closed circuit which in turn necessitates the use of such resistors?

  2. To do a basic analog read of a potentiometer, some illustrate the connection of potentiometers to Arduino's ground, analog in, and 5v; respectively. Others incorporate an inline resistor to ground.

Is the latter approach advantageous? The former approach works, but why doesn't it lead to a short circuit where the pot offers no resistance?

IE. 5v ----Pot offering no resistance-- Ground
I
Analog Pin

Especially compared to the following where leaving out the resistor causes a short (quite empirically - several times over)

5v ----Switch-----Pull Down Resistor ---- Ground
I
Analog Pin

I really hope someone can put me on the right track - these issues are killing me.

Possibly at the root of what you need to know: When you connect something to an Arduino input, be it digital or analog, you are EFFECTIVELY (in many respects) not connecting it to anything!

Put more scientifically, the input has a high resistance, so you can connect it directly to 5v or directly to 0 volts, and VERY little current will flow into or out of the input. (Ah! That's another point: Don't let the names "input" and "output" fool you.... electricity can flow in or out of either. In the case of inputs, very little flows. In the case of outputs a great deal can flow... enough to damage your Arduino if you make a bad connection....

An output set to "0" connected to 5v will fry things as electricity flows into the Arduino through the output.
An output set to "1" connected to 0v will fry things as electricity flows out of the Arduino through the output.

Even though very little electricity flows in or out of an input, ENOUGH flows for the Arduino to "know" what is connected.

===

Isn't the 'solution' just getting an Arduino to 'read' a closed circuit which in turn necessitates the use of such resistors?

I don't understand the question. Do a diagram? Even if crude, with characters.

What's hard about pull up/ pull down resistors? They work! Use them? (For now, you may want to just ignore the "fancy" alternative of "turning on the internal resistors")

More on feeding inputs from switches at....

One question per thread usually best, by the way. They're free... post lots!

Is the latter approach advantageous? The former approach works, but why doesn't it lead to a short circuit where the pot offers no resistance?

IE. 5v ----Pot offering no resistance-- Ground
I
Analog Pin
In your example above the pot always offers it's full rated ohm value (say 10k ohms) between +5vdc and ground, and therefore a constant .5ma current flow through the pot, regardless of it's position. If forms a variable voltage divider that is sensed by the analog input pin and can vary from 0-5vdc depending on wiper position. The input pin is very high input resistance and therefore draws no current to speak of. This is a proper input conditioning circuit.

Especially compared to the following where leaving out the resistor causes a short (quite empirically - several times over)

5v ----Switch-----Pull Down Resistor ---- Ground
I
Analog Pin

Is see no path that leads to a 'short circuit' of zero resistance? (edit: with or without the resistor) If switch is open, 0vdc is sensed by the input pin through the fixed resistor. If the switch is closed then +5vdc is sensed by the input pin and again if the pull-down resistor is 10k ohms, then .5ma of current will flow through the resistor continuously while the switch in closed. No current to speak of will flow into or out of the input pin. This circuit will work, but it's normally used for digital input pins rather then analog input pins as the voltage value can only be 0v or 5v. Leaving out the resistor only results in a constant 5v being sensed by the input pin if the switch is pressed, but no current of consequence will flow because of the very high input resistance of a input pin. However when the switch is not pressed a floating input of no value will be sensed by the input pin without the resistor wired to ground, hense a 'floating input' condition.

Both circuits are dealing with never having a case where there is nothing being wired or sensed by an input pin. A 'floating input' condition will cause false reading or erratic readings from either an analog or digital input pin.

Lefty

Is see no path that leads to a 'short circuit' of zero resistance?

OP did say that the short circuit only happens if the resistor is omitted.

OP did say that the short circuit only happens if the resistor is omitted.

And where would that short circuit path exist without the resistor? There would be no such high current path. If you or he meant if you replaced the resistor with a wire, then yes short circuit path when switch is closed, but just removing the resistor does not create a possible short circuit path, but rather just a floating input condition when the switch is open.

Lefty

@lefty
OK. I assumed (I know, silly me) that the question concerned something like this:
5V -- switch -- wire -- resistor -- wire -- ground.
Removing the resistor would result in the wires being connected directly from 5V to ground, when the switch was closed.

I see that you had a completely different interpretation, and that one is more likely correct.

It's why I like discussing things on the forum. Anyone can say "No, no, stupid, that's not right." If I'm the one making the stupid statements, I don't mind being corrected.

Thank you all so very much for your time, patience and promptness - understood. All I was missing was:

In your example above the pot always offers it's full rated ohm value (say 10k ohms) between +5vdc and ground,

Also, I was replacing the resistor with a wire and shorting my little blue companion, Arduino.

Just to confirm, however: Arduino and Processing, Potentiometer | Physical Computing 2010

The page and image (if it works) depict:

5v ------ Pot ------- Ground
I
I
Resistor
I
I
Arduino Input

The resistor is superfluous, right?

The resistor is superfluous, right?

Right.
However it is in a different place in the picture and your schematic.

The picture has it as:-
5v ------ Pot ------- Resistor ---- Ground
I
I
I
I
Arduino Input
It is still superfluous* but will limit the lowest reading
*(unless that's what you want)

It's why I like discussing things on the forum. Anyone can say "No, no, stupid, that's not right." If I'm the one making the stupid statements, I don't mind being corrected.

You are so correct. Physics works just fine, it's just us humans that try and screw it up from time to time.

Lefty

The resistor is superfluous, right?

Yes, but in that case it does need to be replaced with a wire. ;D

On a serious note be sure to identify the terminals on the pot correctly. usually the movable wiper terminal is the middle terminal, but that pot shown and yours MAYBE different, or maybe not!

Lefty

Once again thank you so much, individually. The amount of time ferreting around the internet you have saved me would be measured in weeks rather than anything less. What a wonderful community.

The link was the one thing that especially confused me in that the schematic which you correctly drew was accompanied with the text

'A potentiometer is a variable resistor. Between the two outer pins you will always measure the (maximum) value of the resistor, while the variable resistance is measure between the middle and an outer pin. That's where we connect a wire to measure the voltage. The pull-down resistor avoids a short circuit when the variable resistance is set to zero. The circuit on your breadboard should look something like this:'

Dud information that didn't tally with my limited knowledge of pull-downs and a few experiments.

That quote only applies if you are only using one end and the wiper of a pot.

It does not apply if you are connecting one end to a supplly, the other end to a ground and the wiper to your input.

Is that quote for every application of potentiometers, or specifically for an arduino input? If you had the wiper connected to, say, an LED then there would be an effective short circuit without the resistor.

Is that quote for every application of potentiometers, or specifically for an arduino input? If you had the wiper connected to, say, an LED then there would be an effective short circuit without the resistor.

Yes it can be depending on the voltage applied to the pot and the position of the pot's shaft. In that case the pot might burn open before the LED is destroyed. The key is that an LED does not act like a simple linear resistive load like a incandescent lamp. A led is a semiconductor, has more in common with a transistor then a resistor.

Once the LED 'sees' an applied voltage equal or greater then it's Vf rating (red leds are around 1.5 volt Vf) across it's two leads, it turns on fully and becomes effectively a near zero ohm resistor, or short circuit.

An Arduino input pin however acts like a resistor of many megohms of resistance, virtually no current can be driven into a input pin unless you exceed the 5 vdc voltage limit, as then internal clamping diodes turn on and short circuit the external voltage. But chip damage will follow in that case.

Lefty