According to Ohm’s law, a resistor is an electrical component that controls or regulates the flow of current in an electronic circuit. Considering a given and fixed supply voltage, the lower the value of a resistor, the greater the flow of current will be.

Increasing or decreasing the resistance requires changes of the resistor itself. Instead, we can “alter” the resistance using a potentiometer.

A potentiometer assembled in a voltage divider topology can be used to control the voltage value read by a microcontroller (and thus, triggers actions). In order to read the potentiometer value on a microcontroller, we require three components.

1. MCU with ADC peripheral and its available input PINs
2. A resistor
3. A potentiometer

This section shows how to hook up a potentiometer to the Analog/Digital converter (ADC)  input of a microcontroller.

Consider a potentiometer that has three pins. The first two pins are connected together to form one end and the last pin will be at the other end.

As shown in the diagram:

• Connect the resistor ‘R1‘ to the potentiometer ‘P1‘.
• Ground the other end of potentiometer ‘P1‘.
• The circuit formed by R in series with P1 is known as “Voltage Divider”.
• Connect the junction between R1 and P1 to the ADC input pin of the MCU.

The voltage at the ADC PIN is defined by the following formula :

VADC = VCC x (a x P1 / ((a x P1) + R1))

Where,

a‘ is the potentiometer value between 0 and 1.

P1‘ is the full potentiometer value in Ohm.

A potentiometer position can be derived with the formula:

a = R1 x VADC / (P1 x (VCC – VADC))

Regarding consumption, you may want to choose high value with P1 and R1 as the current within the voltage divider is expressed as follow :

i = VCC / (R1 + P1)

Thus, a potentiometer is used with a voltage divider to provide variable voltages to the ADC pin. They are often used as volume controls in audio equipment, light controls in LED, and cheap rotary controllers in cars.