B4R Question Technical question ADC pin/ Potentiometer

Beja

Expert
Licensed User
Longtime User
To interface a pot to an Arduino analog pins, you need to connect all 3 pins (Vcc, Gnd and the center pin..
Why is that necessary? Isn't Vcc and the center pin enough to send a variable voltage to the analog pin"
In the image below, why A and not B?

quiz8.png
 

Cableguy

Expert
Licensed User
Longtime User
Electronic wise both are correct, and to me a single (pot center pin) pin to the Arduino is enough. Still if you plan to use the pot as a positive/negative and mesure tension drop, the you need the 3 pins to the arduino.

PS I keep forgetting that we refer to the whole board when we say Arduino. To me an Arduino pin is a usable I/o pin. Vcc and gnd are power pins from/to the board and not directly from the atmega.

In the 3 pin configuration, the analogue will read from vcc to gnd, in the 2 pin, the minimum value is as open pin, which may result in a non-zero value
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
A. This is a voltage divider. You need the three connections to get a voltage between 0 to Vcc.
B. Here you put a variable resistor between Vcc and Signal. You will get always Vcc as the input.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
A. This is a voltage divider. You need the three connections to get a voltage between 0 to Vcc.
B. Here you put a variable resistor between Vcc and Signal. You will get always Vcc as the input.
What he said
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
A. This is a voltage divider. You need the three connections to get a voltage between 0 to Vcc.
B. Here you put a variable resistor between Vcc and Signal. You will get always Vcc as the input.

Thanks Cableguy and Klaus.. (alphabetical)
Hi Klaus,
Is that because A0 is internally connected to Vcc?
 
Last edited:
Upvote 0

Beja

Expert
Licensed User
Longtime User
Then how about if the pot two points are connected between Gnd and A0?
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Then how about if the pot two points are connected between Gnd and A0?
Then you mesure nothing, ADC needs a reference voltage, usually it's internal.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Is that because A0 is internally connected to Vcc?
No!
Look carefully at the sketch!
You are connecting Vcc to Signal via a variable resistor, the resistor value will vary between 0 and the nominal value of the potentiometer.
This means that you will read the max value.
Then how about if the pot two points are connected between Gnd and A0?
You will read 0, because you are connecting A0 to Gnd via a resistor.
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
No!
Look carefully at the sketch!
You are connecting Vcc to Signal via a variable resistor, the resistor value will vary between 0 and the nominal value of the potentiometer.
This means that you will read the max value.

You will read 0, because you are connecting A0 to Gnd via a resistor.

Thanks Klaus
I wish I knew the internal circuitry of this A0 pin.
I am thinking with the discreet ADC in mind, from the old good time of TTL LSI ICs.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I wish I knew the internal circuitry of this A0 pin.
Well, for me, even if I don't know the internal circuit of the analog input.
I know that it's an analog input and I have to provide a voltage, taking care of the maximum voltage beeing supplied.
This can be provided by a sensor, or for testing with a potentiometer, and in this case it must be voltage divider.
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
Well, for me, even if I don't know the internal circuit of the analog input.
I know that it's an analog input and I have to provide a voltage, taking care of the maximum voltage beeing supplied.
This can be provided by a sensor, or for testing with a potentiometer, and in this case it must be voltage divider.

Indeed I believe you Klaus, only trying to understand..
Assuming that a voltage level follows the variable resistor, then I expect if a var's two adjutant legs connected to Vcc and A0 then the input of A0
should vary as well.So no need for the third leg.

varsistor.png


Correction:
More resistance when turned counterclockwise
 
Last edited:
Upvote 0

kolbe

Active Member
Licensed User
Longtime User
Inputs are high impedance, something on the order of Mohms. The ATmega328P states 100 Mohms. So this means that you (@Beja) are correct the voltage does change but... in a negligible way so Klaus is correct too. A few nano amps through a 10K resistance isn't much of a voltage drop.

Hope this helps.
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
Inputs are high impedance, something on the order of Mohms. The ATmega328P states 100 Mohms. So this means that you (@Beja) are correct the voltage does change but... in a negligible way so Klaus is correct too. A few nano amps through a 10K resistance isn't much of a voltage drop.

Hope this helps.

How can I say that if one can dim and brighten an LED with potentiometer?
 
Upvote 0

kolbe

Active Member
Licensed User
Longtime User
A potentiometer will limit the current that flows through a LED provided you are above the threshold voltage. A higher resistance means less current, ohm's law, less light emitted. The LED when above the threshold voltage has almost no resistance... the exact opposite in the case above with a input on the ATmega328P. FWIW, the best way to control on LED is with PWM and not a potentiometer as you could easily overdrive the LED if the resistance drops to far.
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
the best way to control on LED is with PWM and not a potentiometer as you could easily overdrive the LED if the resistance drops to far

Thanks but I don't want to dim LED with that simple arrangement.. Just wanted to show an LED can be dimmed and brightend with only 2 legs of the pot. It doesn't matter if it burns at max current.
Ok forget about the LED. Use a voltvoltmeter and put the Gnd probe on the pot center pin and the positive probe on a dc power supply.. Then move the pot wiper and watch the volt varies.
The question is, when applying connecting the center pin to A0 then it should also read a varying volt. Right?
 
Last edited:
Upvote 0

kolbe

Active Member
Licensed User
Longtime User
Use a voltvoltmeter and put the Gnd probe on the pot center pin and the positive probe on a dc power supply.. Then move the pot wiper and watch the volt varies.
The question is, when applying connecting the center pin to A0 then it should also read a varying volt. Right?

Sorry but I don't think this discussion is going anywhere. What you are really doing and asking isn't clear to me. I'll just end with this.

In your diagram in post #1, A is the normal way of using a potentiometer as A0 (set to an input) will see the voltage vary because you have a voltage divider. In B what you have electrically is dependent on how you set up A0. If it's an input the circuit is still equivalent to a voltage divider but the arduino input is a very large resistor to ground which will only produce a very small voltage change as the pot is turned, unless the pot value is in the mega ohms. Maybe you are seeing something else as you are dealing with the complex internal circuitry of the microprocessor to complete the circuit which could vary depending the state of the microprocessor.

Think of it this way, in B you need a ground to complete the circuit or else no current and just Vcc. How is that done in B is the question and will determine the results and is complex as it is happening through the microprocessor's many components that can vary depending on the state of each.
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
The ground serves as a zero reference where voltage is measured from. Imagine the ground is not connected and floats to let's say 2V and VCC is 5V. Now the voltage range will only be 3V and not 5V as when the pot is connected to ground.
 
Upvote 0

advansis

Active Member
Licensed User
Longtime User
If you connect the A0 PIN (don't know if that particular pin has this feature) with the internal pullup resistor, you can measure the voltage variation while rotating the knob. But the value depends on the global resistance of your potentiometer and will be not precise. If you are interested, I will post an explaining drawing
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
If you are interested, I will post an explaining drawing

Sure I am,
With ADC8080 for example.. I could use both, the three pins and only two pins.. but I shouldn't apply more then VCC, the
chip knows the range because it is its own power supply. That was 35 years ago and still my memory may be misleading.
 
Upvote 0
Top