Robotale Slide Potentiometer Arduino Tutorial

Robotale Slide Pot Functional Description

Robotale Slide PotentiometerThis is actually two 5K potentiometers in one.   Each operates independently of the other.   In most applications it will only require three connections to your Arduino.

As a slide potentiometer, it can offer some intuitive benefits in to an operator interface.  For example, controlling up and down, forward and reverse, left and right, can be confusing when incorporating a rotary potentiometer.  Slide potentiometers, when positioned correctly, can lessen that confusion.

This particular slider has what is known as a logarithmic taper from the center position.   That is to say, the further you move from center (in either direction), the less the change in resistance per inch or mm of travel.   While logarithmic potentiometers are often used in audio control,  I have seen them used when controlling steppers as well…  especially when you want to slow the speed of a moving device as it approaches its limits.

Where to Find One

You can find these potentiometers at any of the following vendors:




Robotale 5K Potentiometer Pin Outs

As you view the drawing, it is important to note that both grounds and power inputs are the same electrical point.  The outputs however, are separated.

Robotale Slide Pot Pin Outs

Using a Potentiometer with an Arduino

Fundamentally this device is put to use by putting a voltage across the potentiometer and measuring the voltage across the wiper arm.   The close the wiper arm is to the source voltage, the greater the voltage drop between ground and wiper arm.

In the most basic implementation,  you will provide ground and 5 volts to the potentiometer.     The wiper arm will be connected to the analog channel of your choice.   From there, you implement a sketch that looks a lot like a Simple Arduino Voltmeter.

Using a Potentiometer With Arduino

Robotale Slide Pot Arduino Tutorial

Connect your Arduino to the Slide Potentiometer

This is a device that requires only three connections.  As mentioned above, one of those connections will be made to your analog channel.

Robotale Slide Pot Arduino Tutorial

Copy, Paste and Upload the Potentiometer Sketch

The sketch below is basically a voltmeter that measures the voltage dropped across the resistor at the wiper arm.    Notice how I expressed 1024 as 1024.0.   This is because I need to have what is known as a floating point number as a result of the division and the multiplication in the sketch.   Try changing 1024.0 to 1024 when you’re done.  You’ll see that you get zero as an output.

Robotale Potentiometer Sample Sketch
const int potIn = A0;

int RawValue= 0;
float Voltage = 0;
float Resistance = 0;

void setup(){  
  pinMode(potIn, INPUT);

void loop(){  
  RawValue = analogRead(potIn); 
  Voltage = (RawValue * 5.0 )/ 1024.0; // scale the ADC
  Resistance = 5000.0 * (RawValue/1024.0); //5000 Refers to the resistance of potentiometer
  Serial.print("Raw Value = " );  // shows pre-scaled value                    
  Serial.print("\t Voltage = "); // shows the voltage measured     
  Serial.print(Voltage,3); //3 digits after decimal point
  Serial.print("\t Resistance = "); // shows the voltage measured 
  delay(500);   // 1/2 sec so your display doesnt't scroll too fast

Verify Your Arduino Potentiometer Sketch Results

Open your serial monitor and see the output from your Arduino.  It should look something like what you see pictured below.   Move the potentiometer slider and notice how your values change.

Robotale Arduino Potentiometer Tutorial Output


  1. July 27, 2016
  2. exe July 24, 2016

Leave a Reply

Your email address will not be published. Required fields are marked *