# B4R QuestionTechnical question ADC pin/ Potentiometer

#### Beja

##### Expert
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?

##### Active Member
Longtime User
The value of the internal pullup resistor (Rup) is around 20k.
In A0 you will find (voltage divider Rx/Rup):

Vx=Vcc*Rx/(Rx+20k)

So you will never obtain the full-range voltage (0-5 Volts), but less than 5V, depending on the maximum value of the resistance of the potentiometer.
For example, considering the formula, with Rx at its maximum,
- if you have a 1k potentiometer, the range will be 0-0.2V
- if you have a 20k potentiometer, the range will be 0-2.5V
- if you have a 100k potentiometer, the range will be 0-4.16V

When the knob is versus the ground, you will always find a value close to 0V (it depends on wiring resistance)
Usually the free wire of the potentiometer is connected to the central one: this reduces noise for large resistors and reduces glitches dued to mechanical defects.
Without external power supply, you will never burn your pin, for sure...

Hope this helps

#### Attachments

• Arduino.png
9.5 KB · Views: 180

#### Beja

##### Expert
Longtime User
The value of the internal pullup resistor (Rup) is around 20k.
In A0 you will find (voltage divider Rx/Rup):

Vx=Vcc*Rx/(Rx+20k)

So you will never obtain the full-range voltage (0-5 Volts), but less than 5V, depending on the maximum value of the resistance of the potentiometer.
For example, considering the formula, with Rx at its maximum,
- if you have a 1k potentiometer, the range will be 0-0.2V
- if you have a 20k potentiometer, the range will be 0-2.5V
- if you have a 100k potentiometer, the range will be 0-4.16V

When the knob is versus the ground, you will always find a value close to 0V (it depends on wiring resistance)
Usually the free wire of the potentiometer is connected to the central one: this reduces noise for large resistors and reduces glitches dued to mechanical defects.
Without external power supply, you will never burn your pin, for sure...

Hope this helps

Thanks advansis for the detailed description. indeed it helps and it's more clear now. But it seems my application may not work on this setting because my
sensor only has 2 wires, and I think the only solution is to use Peter Simpson's example of water sensor because it's similar in this case. In other words, to use a brake-out module.

##### Active Member
Longtime User
Thanks advansis for the detailed description. indeed it helps and it's more clear now. But it seems my application may not work on this setting because my
sensor only has 2 wires, and I think the only solution is to use Peter Simpson's example of water sensor because it's similar in this case. In other words, to use a brake-out module.

You can use your 2wires sensor: my schema uses a 3wires and transforms it in 2wires

#### Beja

##### Expert
Longtime User
You can use your 2wires sensor: my schema uses a 3wires and transforms it in 2wires

I don't get it.. Say I have that same water sensor with two wires.. How am I going to use your solution? The sch in image above can't do the job. I would appreciate it if you kindly sent another image.

#### Beja

##### Expert
Longtime User
Finally
I thank all who tried to help
And in the process I learned a lot from you guys.
The secret recipe was the breakout board that took care of the voltage divider. I just tested and replaced the water sensor with a 100k potentiometer.. It worked like a charm.

#### Beja

Longtime User

##### Active Member
Longtime User
Well done. Forgive me for not responding before... Your module seems an amplifier.
You can also use the attached schema. The value of Rup should be 1k or more (not less otherwise the circuit will waste a lot of energy).
Put a ceramic capacitor in series with your probe, to reduce noise. Disable the internal pullup resistor.
The formula for calculating your resistance is the same Vx=Vcc*Rx/(Rx+RUp) where Rx is your resistance and Vx is the value read on A0

#### Attachments

• Arduino.png
8.5 KB · Views: 176
Last edited:

#### Beja

##### Expert
Longtime User
Well done. Forgive me for not responding before... Your module seems an amplifier.
You can also use the attached schema. The value of Rup should be 1k or more (not less otherwise the circuit will waste a lot of energy).
Put a ceramic capacitor in series with your probe, to reduce noise. Disable the internal pullup resistor.
The formula for calculating your resistance is the same Vx=Vcc*Rx/(Rx+RUp) where Rx is your resistance and Vx is the value read on A0

Did you cancel the internal pullup and replace it with external one?

##### Active Member
Longtime User
Yes, RUp Is the external pullup

#### Chris Tyrie

##### Member
Longtime User
But what if i have 3 metal pots, a microwave oven, and non-dairy creamer? What happens then?

(Chris stumps the band yet again)

Replies
1
Views
240
B4R Question use inline C
Replies
2
Views
886