Analog Input – Potentiometer

To introduce the analog input we are going to use a potentiometer. It’s sometimes referred as “pot” by people who don’t smoke weed.
In our kit we have a trimmer (think about the old radio knob) and a slider (think about a audio mixing console).

This is the symbol used in the schematics:

It looks like a resistor because it is a resistor, a variable one. The third pin (W in the scheme) is mechanically movable and correspond to the angle of the trimmer or the position of the slider.

This is the basic way to hook it up:

Potentiometers have 3 leads, the 2 one (usually in the middle) is the one to probe as analog input. The other two should be connected to +5 and mass.

Analog means continuous value as opposed to digital where you have 0 1, LOW HIGH, 0V +5V.
In the Arduino environment it’s an integer value between 0 and 1024.

Now try circuit 2

Note that Arduino has a special set of pin to detect analog inputs marked as A0, A1, A2 etc.

The orientation of the potentiometer will determine the relation between value and know/slider position, try to invert it and see what happens.

In this variable blinking exercise the pot is controlling the delay therefore the blinking speed.

delay(sensorValue);

sensorValue is a value between 0 and 1024 so the blinking will go from 0 delay (LED always on) to 1000ms of delay (1 second on, 1 second off).

Let’s try different potentiometers and sensors now!

Posted in

Post a comment