# Make It Change: Potentiometers

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/061/055/medium800/components_photo-1529576590443-3b51f217368b.jpg?1536265481 DJ Candi by Bongani Ngcobo, license free via unsplash.com)

Our electronics talk to us through lights and displays. But how do we easily communicate back to our electronics. Ok, if touch screens don't count, the second and the oldest way to easily "tell" something to an electronics project is to turn a knob.

&nbsp;

Most often, that knob is usually connected to a variable resistor, or&nbsp;_potentiometer_&nbsp;in electrical-speak.

![components_562-00.jpg](https://cdn-learn.adafruit.com/assets/assets/000/061/740/medium640/components_562-00.jpg?1536858936)

The term potentiometer comes from the simple circuit shown below.

A voltage is placed across the outer, fixed terminals and taken from ground and the middle terminal which is connected to a _wiper_ (a movable arm on top of the resistor). At J1, the output terminals, you read with your meter a voltage from zero to the battery voltage (here 4.5 volts) which changes as you turn the shaft of the potentiometer. **Potential is another name for voltage** , and meter means measure - hence a _potentiometer_ is a way of measuring/changing a voltage.

This guide will help you understand the different types of potentiometers and how you may want to use them in your projects.

While the concepts in this guide can be used with ANY microcontroller or single board computer, they will be demonstrated using the Circuit Playground Express.

## Parts List
Featured
### Circuit Playground Express

[Circuit Playground Express](https://www.adafruit.com/product/3333)
 **Circuit Playground Express** is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and made it even better! Not only did we pack even more sensors in, we also made it even easier to...

In Stock
[Buy Now](https://www.adafruit.com/product/3333)
[Related Guides to the Product](https://learn.adafruit.com/products/3333/guides)
![A Black woman's manicured hand holds a round microcontroller with lit up LEDs.](https://cdn-shop.adafruit.com/640x480/3333-05.jpg)

Featured
### Panel Mount 10K potentiometer (Breadboard Friendly)

[Panel Mount 10K potentiometer (Breadboard Friendly)](https://www.adafruit.com/product/562)
This potentiometer is a two-in-one, good in a breadboard or with a panel. It's a fairly standard linear taper 10K ohm potentiometer, with a grippy shaft. It's smooth and easy to turn, but not so loose that it will shift on its own. We like this one because the legs are 0.2" apart...

Out of Stock
[Buy Now](https://www.adafruit.com/product/562)
[Related Guides to the Product](https://learn.adafruit.com/products/562/guides)
![Angled Shot of the Panel Mount 10K potentiometer (Breadboard Friendly)](https://cdn-shop.adafruit.com/640x480/562-03.jpg)

Featured
### Potentiometer Knob - Soft Touch T18 - Red

[Potentiometer Knob - Soft Touch T18 - Red](https://www.adafruit.com/product/2046)
_Oh say can you see_  
_By the knob's early light..._

Sorry - we thought that was clever. &nbsp;And while it wasn't really, this potentiometer knob definitely is. &nbsp;It's a 'soft touch' T18 knob that works great with our <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/2046)
[Related Guides to the Product](https://learn.adafruit.com/products/2046/guides)
![Group Shot of the Various Color Options to the Potentiometer Knob - Soft Touch T18 - Red.](https://cdn-shop.adafruit.com/640x480/2046-07.jpg)

Featured
### Short Wire Alligator Clip Test Lead (set of 12)

[Short Wire Alligator Clip Test Lead (set of 12)](https://www.adafruit.com/product/1592)
Connect this to that without soldering using these handy mini alligator clip test leads. Approximately 4.5" overall cables with alligator clip on each end, color coded. You get 12 pieces in 6 colors. Strong and grippy, these always come in handy! We often use these in conjunction with a...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1592)
[Related Guides to the Product](https://learn.adafruit.com/products/1592/guides)
![Top-down view of 6 pairs of short wire alligator clips.](https://cdn-shop.adafruit.com/640x480/1592-00.jpg)

If you'd like to work with a slide potentiometer, this 3.5 cm 10K linear model is nice. As usual with potentiometers and resistors, there are many types. This one is $1.29/each in single quantities at the time this guide was written from [digikey.com](http://www.digikey.com).

### Part: Digi-key Slide Potentiometer
quantity: 1
10 kOhms 0.1W, through Hole Slide Potentiometer Top Adjustment Type, 20 mm adjust, 35 mm long
[Digi-key Slide Potentiometer](https://www.digikey.com/products/en?keywords=PTA2043-2015CPB103-ND)

# Make It Change: Potentiometers

## Connections

![](https://cdn-learn.adafruit.com/assets/assets/000/061/342/medium800/components_cpx-potentiometer_bb.png?1536594404)

The circuit above shows the connections for hooking a potentiometer to a Circuit Playground Express board. The center terminal of the potentiometer (the wiper) is connected to pad **A1** although it could also be connected to pads **A2** through **A7**. We tend to skip **A0** as that is the analog output pin for sound and many potentiometer projects are related to sound for volume control, varying the tempo, and other sound-related features.

The value of the potentiometer is not crucial. The part suggested is the [Adafruit 10 kilo-ohm (KΩ) model](https://www.adafruit.com/product/562 "10K Potentiometer") but other values should give similar results. It is suggested avoiding under 1000 ohms and over a mega-ohm to get the current flow in a good range. If you decide to use a breadboard instead of alligator clips, most Adafruit potentiometers are breadboard friendly (look in their description to make sure).

[See the last page](https://learn.adafruit.com/make-it-change-potentiometers/types-of-potentiometers-avalable) on what types of potentiometers are available out in the wild if you have specific requirements.

# Make It Change: Potentiometers

## MakeCode

Reading a potentiometer value takes one analog pin on a microcontroller. Analog pins read in a voltage and provide a value based on the voltage it reads. The number depends on the accuracy of the analog to digital conversion..

The basic code to read the value in MakeCode is shown below:

![](https://cdn-learn.adafruit.com/assets/assets/000/061/372/medium800/components_makecode-analogread.jpg?1536614568)

This code reads the analog pin **A1** (it can be changed from A1 to A7 for Circuit Playground Express) and the result is put in a variable called value. The number ranges from 0 (corresponding to 0 volts) at full counterclockwise to 512 (1.65 volts) at the center point to 1023 (3.3 volts) at the far clockwise point.

This code would be more useful if we could see the reading. The following code, Circuit Playground-specific, lights the LEDs from 0 to 9 based on the reading from the potentiometer and the `analog read pin`:

![](https://cdn-learn.adafruit.com/assets/assets/000/061/376/medium800/components_makecode-analogread-2.jpg?1536615417)

[Open this example in MakeCode](https://makecode.com/_hfuJFF9s4H0F)
This code will light the Circuit Playground Express LEDs proportional to the travel of the potentiometer wiper.

Also if you have console capability (Windows 10 MakeCode App), you can see the value printed out, shown below.

![](https://cdn-learn.adafruit.com/assets/assets/000/061/772/medium800/components_makecode.jpg?1536863308)

## Changing Music
The second example varies a tone on the Circuit Playground Express speaker depending on the value read from the potentiometer:

![](https://cdn-learn.adafruit.com/assets/assets/000/061/463/medium800/components_makecode-analogread-3.jpg?1536689930)

[Open this example in MakeCode](https://makecode.com/_bLqhDw2PvE0x)
Warning: 

You will find this example somewhat hard on the ears. The potentiometer will set the tone value from 0 to 1023 hertz - the volume will cut off at a value more than zero. And the values will not often be perfect musical note values. You can change 1/8 to other values for interesting effects.

# Make It Change: Potentiometers

## CircuitPython

![](https://cdn-learn.adafruit.com/assets/assets/000/061/741/medium800/components_robotics___cnc_circuitpython_blinka-small.png?1536859346)

CircuitPython is a programming language based on Python, one of the fastest growing programming languages in the world. It is specifically designed to simplify experimenting and learning to code on low-cost microcontroller boards. You can learn more about CircuitPython [in this guide](https://learn.adafruit.com/welcome-to-circuitpython).

CircuitPython is easiest to use within the Mu Editor. If you haven't previously used Mu,&nbsp;[this guide will get you started](https://learn.adafruit.com/welcome-to-circuitpython/installing-mu-editor). Mu is available for PC, mac, and Linux and it has some very handy features we'll use.

## Analog Reads

The CircuitPython `analogio` module provides the analog pin functions comparable to MakeCode `analog read block` and Arduino `analogRead` function.

Save the following program to your Circuit Playground Express **CIRCUITPY** drive as **code.py**.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Make_It_Twist_Potentiometer/potentiometer-print/code.py

`AnalogIn` creates an object, here called `potentiometer`, on pad A1 on Circuit Playground Express. The `while` loop indefinitely prints out the value of the potentiometer object to the Serial connection then waits a bit.

Opening the **Serial** window in Mu (button circled in picture below), you will see that the range of values returned from `AnalogIn` is much higher in CircuitPython: 0 to 65535 (was 65520 before CircuitPython 8.0.0). Take that into account when scaling or mapping values to a different range for display, etc.

![](https://cdn-learn.adafruit.com/assets/assets/000/061/419/medium800/components_sensors_mu-buttons.png?1536681399)

In Mu, you can press the **Plotter** button to see a plot of the values. As you turn the knob of the potentiometer, the values change.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/061/746/medium800/components_cp-1.jpg?1536859674)

## Display on the Circuit Playground Express NeoPixels

Any string of NeoPixels makes a great indicator for the value of a potentiometer. In the "old days" they would put markings on the case to tell you the amount you had turned the knob. Now you can do this electronically. A [stick of NeoPixels](https://www.adafruit.com/product/1426) or a [ring of NeoPixels](https://www.adafruit.com/product/1463) works great.

If you are using the Circuit Playground Express, the built-in NeoPixels are perfect as an indicator. The code is shown below.

Save the following program to your Circuit Playground Express **CIRCUITPY** drive as **code.py**.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Make_It_Twist_Potentiometer/potentiometer-neopixels/code.py

You can change the neopixel.NeoPixel call to reference an external strip or ring of pixels for your board and the number of pixels being addressed. `NUMPIXELS` should be changed to the number you have.

![](https://cdn-learn.adafruit.com/assets/assets/000/061/754/medium800/components_20180913_133050.jpg?1536860026)

Hopefully this has given you an idea how to read a potentiometer in CircuitPython and use the value in your project.

# Make It Change: Potentiometers

## Arduino

If you are new to Arduino IDE programming, see [this guide](https://learn.adafruit.com/lesson-0-getting-started?view=all). If you are familiar with Arduino but not on the Circuit Playground Express, see [this guide](https://learn.adafruit.com/adafruit-circuit-playground-express/arduino).

Reading analog pins is built into the Arduino environment, available as the standard function call `analogRead`. The simple sketch below reads the value of a potentiometer attached to the pin defined by `PIN`. For Circuit Playground Express this is `A1`, but it could be any analog pin.

![](https://cdn-learn.adafruit.com/assets/assets/000/061/755/medium800/components_arduino-1.png?1536860384)

## Display to Serial

The following is a simple program that reads a potentiometer connected to A1 and displays that value to the Arduino Serial console. The sample output is shown above.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Make_It_Twist_Potentiometer/analog-read/analog-read.ino

## Display on NeoPixels

As in previous examples, using a potentiometer on a microcontroller, either the Circuit Playground Express or another board allows use of NeoPixels. External pixels are fine. The code below uses the onboard pixels on a Circuit Playground Express to display the value.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Make_It_Twist_Potentiometer/potentiometer-neopixels/potentiometer-neopixels.ino

Circuit Playground Express NeoPixels are on digital pin 8. The analogRead reads the potentiometer on pin A1.

![](https://cdn-learn.adafruit.com/assets/assets/000/061/756/medium800/components_20180913_133050.jpg?1536860421)

# Make It Change: Potentiometers

## Types of Potentiometers Available

![](https://cdn-learn.adafruit.com/assets/assets/000/061/393/medium800/components_mixer-mitchell-leach.jpg?1536675868 A mixer with various panel mounted twist and slide potentiometers. Credit Mitchell Leach @mitchellleach free via unsplash.com)

There are probably at least as many types of potentiometers as there are resistors. Potentiometers for all types of purposes. This page dives in deeper to let you know many of the types you'll find available.

## Potentiometer Values
Exactly like normal, fixed resistors, potentiometers are rated for a maximum resistance measured in Ohms. Often it is in thousands of Ohms (1000 = 1K), or millions of Ohms (1,000,000 = 1000K = 1M megohm).

For reading varying analog voltage readings like in this guide, 10K to 100K Ohm potentiometers are ideal. Be aware there are many different values available from resellers.

![components_562-00.jpg](https://cdn-learn.adafruit.com/assets/assets/000/061/757/medium640/components_562-00.jpg?1536860516)

## Physical Size

Not all potentiometers are the same physical size. Most often the size relates to the power capacity of the potentiometer but not always.&nbsp;

If you are breadboarding a circuit, look for potentiometers that are **breadboard friendly** meaning the terminals fit a 0.1" grid of pins. [Adafruit sells many breadboard friendly potentiometers](https://www.adafruit.com/?q=breadboard%20friendly%20potentiometer&p=1).

&nbsp;

For other uses, you will want to measure the space you have in your project or project enclosure to see if your planned potentiometers fit. Also consider ergonomics, will the potentiometer be placed to be easy for the user?

![components_20180913_135139a.jpg](https://cdn-learn.adafruit.com/assets/assets/000/061/760/medium640/components_20180913_135139a.jpg?1536861636)

Potentiometers made to be mounted on an enclosure are called **Panel Mount Potentiometers**. They come with a nut to hold the potentiometer to the panel. The shaft most often makes accomodation for a knob to move the shaft.

[Adafruit sells potentiometers that are both breadboard friendly for prototyping and panel mountable](https://www.adafruit.com/?q=breadboard%20friendly%20panel%20mount%20potentiometer) for making a finished project easily. The best of both worlds for Makers.

## Rotary vs. Slider (Twist vs. Straight)
The most common potentiometers have a knob or shaft of some sort and and you twist the knob to change the value.

&nbsp;

Sliders, straight running potentiometers, move along a rectangular track to move only up and down. They are often used for audio mixing and lighting control.

![components_slide.jpg](https://cdn-learn.adafruit.com/assets/assets/000/061/764/medium640/components_slide.jpg?1536861970)

## Linear Taper vs. Logarithmic Taper
Getting more exotic. Most potentiometers for regular use are linear taper potentiometers. The value of the resistance varies linearly as you adjust it, from 0 to 100% of the adjustment. In the examples in this guide, this gives a nice, even set of numbers and pixels as the potentiometer is adjusted.

&nbsp;

In some circuits/projects, a different type of resistance is better. For example, the human ear doesn't perceive sound linearly but rather logarithmically. So some audio applications and other circuits use potentiometers that vary the resistance logarithmically to mechanically vary the resistance to a log scale. They still give 0 to 100% of the value, just not in a "twist 10 degrees = x" amount of resistance through the whole adjustment range.

![components_linear.jpg](https://cdn-learn.adafruit.com/assets/assets/000/061/766/medium640/components_linear.jpg?1536862232)

![components_log.jpg](https://cdn-learn.adafruit.com/assets/assets/000/061/769/medium640/components_log.jpg?1536862316)

[Adafruit sells potentiometers](https://www.adafruit.com/?q=potentiometer) with analog and logarithmic tapers - when you are browsing the catalog, be aware of this distinction.

You want to ensure you use the correct type of potentiometer for your application. If you are unsure, go with linear and you can substitute later.

## Dual, Stacked and Switched Potentiometers
Some applications, such as audio, benefit from adjusting two potentiometers via one shaft. Those are called **dual potentiometers**. More rarely there could be three or more stacked on one shaft. These come in linear and logarithmic tapers.

&nbsp;

Some potentiometers come with an on/off switch mounted on the back of either a single, dual, or stacked potentiometer. This is great for using the same knob to both turn on a circuit and adjust parameters.

![components_Untitled.png](https://cdn-learn.adafruit.com/assets/assets/000/061/770/medium640/components_Untitled.png?1536862413)

## Fixed or Not?

You may see potentiometers on circuit boards rather than on a panel for user control. These most often are usually left in one place, maybe adjusted during calibration of a circuit. These are called fixed potentiometers as they keep a fixed value unless you open things up and tweak them. They may be adjustable via finger or screwdriver.

It seems strange to fix a value of an adjustable device but it does make things handy for tweaking things on an irregular basis.

![](https://cdn-learn.adafruit.com/assets/assets/000/061/771/medium800/components_20180913_141704.jpg?1536862827 A non-surface mount trim multiturn potentiometer, probably panel mount)

## Single or Multi Turn

Most potentiometers adjust in a single motion from one extreme&nbsp; to the other (0 to 100%). There are some potentiometers, usually smaller ones inside a circuit) that can turn more than the standard amount, they can be adjusted (usually via screwdriver) over multiple turns of the wiper shaft. They provide a greater range than single turn potentiometers, providing greater accuracy. Most often they are not adjusted often, maybe during a circuit's calibration.

## Materials

Like regular resistors, most potentiometers use a carbon composition to provide the resistance. The potentiometer will be rated for a certain power capacity, the voltage times the amperage it can handle, measured in Watts.&nbsp;

For hobby applications, low wattage potentiometers should be fine although if you are making something for sale or production, checking the wattage is necessary.

You may find potentiometers made of other types of materials: ceramic/metal (cermet), conductive plastic, or wire wound. Wire wound resistors usually are rotary and you might feel the individual wires as you turn the knob. Wire wound is most often used for high power/wattage applications or potentiometers with a small resistance.


## Guide Products

### Circuit Playground Express

[Circuit Playground Express](https://www.adafruit.com/product/3333)
 **Circuit Playground Express** is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and made it even better! Not only did we pack even more sensors in, we also made it even easier to...

In Stock
[Buy Now](https://www.adafruit.com/product/3333)
[Related Guides to the Product](https://learn.adafruit.com/products/3333/guides)
### Panel Mount 10K potentiometer (Breadboard Friendly)

[Panel Mount 10K potentiometer (Breadboard Friendly)](https://www.adafruit.com/product/562)
This potentiometer is a two-in-one, good in a breadboard or with a panel. It's a fairly standard linear taper 10K ohm potentiometer, with a grippy shaft. It's smooth and easy to turn, but not so loose that it will shift on its own. We like this one because the legs are 0.2" apart...

Out of Stock
[Buy Now](https://www.adafruit.com/product/562)
[Related Guides to the Product](https://learn.adafruit.com/products/562/guides)
### Potentiometer Knob - Soft Touch T18 - Red

[Potentiometer Knob - Soft Touch T18 - Red](https://www.adafruit.com/product/2046)
_Oh say can you see_  
_By the knob's early light..._

Sorry - we thought that was clever. &nbsp;And while it wasn't really, this potentiometer knob definitely is. &nbsp;It's a 'soft touch' T18 knob that works great with our <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/2046)
[Related Guides to the Product](https://learn.adafruit.com/products/2046/guides)
### Short Wire Alligator Clip Test Lead (set of 12)

[Short Wire Alligator Clip Test Lead (set of 12)](https://www.adafruit.com/product/1592)
Connect this to that without soldering using these handy mini alligator clip test leads. Approximately 4.5" overall cables with alligator clip on each end, color coded. You get 12 pieces in 6 colors. Strong and grippy, these always come in handy! We often use these in conjunction with a...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1592)
[Related Guides to the Product](https://learn.adafruit.com/products/1592/guides)

## Related Guides

- [Adafruit Circuit Playground Express](https://learn.adafruit.com/adafruit-circuit-playground-express.md)
- [Chinese Dragon Puppet with Motion-Reactive Flame Effect](https://learn.adafruit.com/chinese-dragon-puppet-with-motion-reactive-flame-effect.md)
- [Make It Pulse](https://learn.adafruit.com/make-it-pulse.md)
- [Automatic Cat Treat Dispenser](https://learn.adafruit.com/automatic-cat-treat-dispenser.md)
- [Pearl's Gem Weapon – Steven Universe](https://learn.adafruit.com/pearl-s-spear-steven-universe.md)
- [The MonkMakes Plant Monitor and CircuitPython](https://learn.adafruit.com/monkmakes-plant-monitor-and-circuitpython.md)
- [Stumble-Bot](https://learn.adafruit.com/stumble-bot-with-circuit-playground-and-crickit.md)
- [Crickit Harmonic Drawing Machine](https://learn.adafruit.com/crickit-harmonic-drawing-machine.md)
- [The Tilt Trumpet](https://learn.adafruit.com/the-tilt-trumpet.md)
- [Buttermilk Boat with Circuit Playground Express](https://learn.adafruit.com/boat-with-circuit-playground-express.md)
- [Glowing Neopixel Resin River Table](https://learn.adafruit.com/glowing-neopixel-resin-river-table.md)
- [RGB & HSV NeoPixel Dialer](https://learn.adafruit.com/rgb-hsv-neopixel-dialer.md)
- [Professor Bubbleton’s Breathing Head in a Jar](https://learn.adafruit.com/professor-bubbleton-s-breathing-head-in-a-jar.md)
- [3D Printed Heel Clips](https://learn.adafruit.com/3d-printed-heel-clips.md)
- [UFO Flying Saucer with Circuit Playground Express](https://learn.adafruit.com/ufo-circuit-playground-express.md)
- [Crawling Baby Sea Turtle Robot](https://learn.adafruit.com/baby-turtle-makecode.md)
