We made digital & analog signals come out of our LED and put a digital signal in via our button, now we just have to input an analog signal. To do that we need to understand something called a potentiometer.
[picture of guitar knobs]
You’ve encountered potentiometers or “pots” before; their most common form is a knob; like the volume or tone control on a guitar.
However there are many kinds of resistors such as ones that work with light; called photoresistors and ones that work with temperature called thermistors.
But what’s going on internally? A potentiometer is just a resistor that is variable. Rather than being locked at one value, we can select how much resistance we want; in this case by rotating the knob. The labeled value on our potentiometer is 10,000 Ohms is the maximum resistance it can deliver.
wiping across a resistive material which determines the resistance.
[picture inside a pot]
By detecting the resistance on the arduino-end we can change use that to change the brightness of our light.
Hookin’ it up
A potentiometer like the one in our kit typically has 3 pins, two that determine the range of values, and one that is the value we control with our knob. In a knob like this it is typically referred to as a wiper. We’ll typically set our potentiometer to go from 0V/ground/GND to 5V, and then read the wiper.
[picture of pot with pins labeled]
For the circuit, we’ll use the same one that we used from the LED Fade example, except we’ll add a potentiometer to the mix. We’ll connect this to one of the Analog In pins (A0 - A5), because that’s what we need