Skip to content

# Potentiometer

In this experiment you will learn what a poteniometer is and you can use it to find voltage ranges when microcontroller reads LOW and HIGH state on his digital input pins.

Table of contents

Voltage divider

General description

A voltage divider is a simple circuit which turns a large voltage into a smaller one. Using just two series resistors and an input voltage, we can create an output voltage that is a fraction of the input. Voltage dividers are one of the most fundamental circuits in electronics.

We may see it drawn a few different ways,

but they are always the same circuit. In this subsection we will denote the resistor closest to the input voltage $V_{in}$ as $R1$, and the resistor closest to ground as $R2$. The voltage drop across $R2$ is called $V_{out}$, and that is the divided voltage our circuit exists to make.

Generally speaking, formula used to calculate $V_{out}$ takes a form
$$V_{out} = \frac{V_{in}R_{2}}{R_{1}+R_{2}}$$

Why it is useful?

Many sensors in the real world are simple resistive devices. A photocell is one of a such variable resistor, which produces a resistance proportional to the amount of light it senses: the more light we provide the lower resistance of photocell is.

It turns out voltage is really easy for microcontrollers (at least those with analog to digital converters, ADC’s) to measure. Things are not so simple with resistance. But, by adding another resistor to the resistive sensors, we can create a voltage divider. Thus instead of measure resistance, we can measure voltage.Once the output of the voltage divider is known, we can go back and calculate the resistance of the sensor.

Consider the following schema

where the symbol of resistor with two arrows pointing to it is a symbol of photoresistor. Taking the photoresistor with resistance between 0kO in the full light and about 10kΩ in the dark accompanied by 10kO resistor, we will get 0.0V when there is full light and 2.88V in the full dark. If accompanying resistor has 1kO, we will get 0.62V when there is full light and 4.86V in the full dark.

 R1 Voltage in full light dark 10kO 0.2 2.88 1kO 0.62 4.86

Potentiometer

A potentiometer is a three-terminal resistor with a sliding or rotating contact (wiper):

that forms an adjustable voltage divider. If only two terminals are used, one end and the wiper, it acts as a variable resistor.

We can think of a potentiometer as a variable voltage divider. Images below show all the possible states of a potentiometer and voltage dividers corresponding to them (notice that in this case voltage input and ground doesn't matter, so we skipped this element in the picture as well as we reverse order of resistors which again doesn't matter -- after all, it's just a matter of the agreement, which one we will call $R1$ and wich one \$R2.)

Test idea

Take the Arduino board and make the following test

• Turn potentiometer to one of its final position.
• Use middle potentiometer's pin output signal as input signal for digital and analog Arduino's pins
• In Arduino
• read digital pin value and print HIGH if this pin is in HIGH state and LOW if is in LOW state
• read analog pin value and print voltage
• Change, not to fast, potentiometer position to oposite final position. Doing this, read and print digial and analog values (see previous step). Note when digital state will switch to HIGH when voltage is increased from 0V to 5V, and when digital state will switch to LOW when voltage is decreased from 5V to 0V.

Wiring

Code

Below tere is a code we can use to make this test.

Read an appropriate documentation if you don't know how function we used are working

Results

In my case

• when voltage is increased from 0V to 5V, digital state switches to HIGH for 2.7V
• when voltage is decreased from 5V to 0V, digital state switches to LOW for 2.16V.
 Top-left: Step 1, initial voltage about 0V, LOW state; top-right: Step 2; bottom-left: Step 3; bottom-right: Step 4, voltage about 2.7, HIGH state
film.mov
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6671246886253357, "perplexity": 1697.532430202398}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-49/segments/1669446710764.12/warc/CC-MAIN-20221130124353-20221130154353-00057.warc.gz"}