Analog Read Serial

Just a very noob qiestion.

In the Analog Read Serial tutorial, I am not quite sure how the current flows.

There is a circuit 5V to GND. And when I turn the pot, does that change the current flow to the A0 pin? Or is the 10K of the pot always there? I mean, if I have no resistance at all, I create a short circuit, which is no good. I am confused. What is the middle pin of the pot realy doing? I get it there is a change of value and the A0 pin and program translates it from 0 to 1023. Just help me visualize the electron flow.

Thank you.

When the I/O pins on an Arduino are set as INPUT they have a very high impedance and draw very little current. So when you are using an analog pin to measure the voltage on a pot it draws negligible current no matter what voltage is on the pot's slider pin.

It is only when the I/O pins are set as OUTPUT that you risk overloading them if you, for example, connect a LOW pin to 5v or a HIGH pin to GND.

...R

The current is always running through the pot. With 5V across a 10k pot the current is 0.5 mA (I=V/R).

The slider divides the pot into two resistors: R1 = 10kx and R2 = 10k(1-x) where x is a value from 0 to 1. The voltage across R1 (the part connected to Ground) is 5V * R1/(R1+R2). Note: R1+R2 is always 10k. When x=0 the slider is at the Ground end of the pot and the voltage across R1 is 0 (5V* 0/10k). When x=1 the slider is at the 5V end of the pot and the voltage across R1 is 5V (5V * 10k/10k). At 1/4 of the way you get R1 = 2.5k and R2=7.5k. 5V * 2.5k/10k = 1.25V on the slider. The A/D reports that 1.25V as 256 (1/4 of 1024)

Thank you both for your explanations. The obvious is sometimes just not that obvious. It's easy to just connect all parts and know what the code is doing, but not being able to see current and graps the interaction between the Arduino and additional circuits. I am having fun, more and more, every day.

What is the middle pin of the pot realy doing?

It is acting as a tap part way down the length of a resistor. When positioned at the center the track to the left of it is the same length as the track to the right of it and so the resistance of the two tracks is the same.
If the pot is 10K then the resistance to the middle pin to either end is 5K.

Just help me visualize the electron flow.

The common analogy is the old water pipe analogy -

Voltage (sometimes called "potential") is similar to water pressure. The voltage is always there (under "normal conditions") whether current (water) is flowing or not. You can measure voltage with a multimeter (or with the Arduino) and almost no current flows.

With higher voltage (water pressure) more current (water) flows.

A skinny pipe or a water valve turned part way on "resists" and reduces water flow similarly to how resistance or impedance resists or reduces electrical current flow.

The analogy is NOT perfect... The biggest difference is that if you cut a pipe, resistance goes to zero and lots of water flows out all over the place. If you cut a wire, resistance goes to infinity and no current flows.

Also, zero water resistance doesn't damage anything (unless there is a flood :wink: ) whereas zero electrical resistance (a short) can fry your electronics.


When John is explaining how a pot works, he's describing a variable [u]Voltage Divider[/u].

[u]Ohm's Law[/u] describes the relationship between voltage, current, and resistance, and if you understand Ohm's Law, you an apply it to a voltage divider to understand how a voltage divider works if you also know that the current through (two or more) series resistors is the same in both resistors (just as the water current through two series pipes would be the same).

Just help me visualize the electron flow.

You don't need to worry about this right now but I'm going to mention one picky detail... In the field of electronics we use "conventional current flow" where the current flows from positive-to-negative, which is logical... high-to-low. But, The electrons actually flow the opposite direction. The early scientists got the + & - terminals on a battery labeled wrong (before they knew about electrons), and in the field of electricity/electronics it was never changed...

If you take an electronics class, you'll learn that current flows positive-to-negative. If you take a physics or chemistry class, you'll learn that electrons flow negative-to-positive.