Skip to main content

Grove - Slide Potentiometer


The Grove - Slide Potentiometer module incorporates a linear variable resistor with a maximum resistance of 10KΩ. When you move the slider from one side to the other, its output voltage will range from 0 V to the Vcc you apply. It connects to the other Grove modules through a standard 4-Pin Grove Cable. Three of the pins are connected to OUT (Pin 1), Vcc (Pin 3) and GND (Pin 4), while the fourth pin (Pin 2) is connected to a on-board green indicator LED. The LED is used to visually represent the resistance change on the potentiometer.



  • 30 mm long slide length
  • Linear resistance taper
  • Grove compatible
More details about Grove modules please refer to [Grove System](

Application Ideas

Here are some projects for your reference.

Arduino BoomBoxArduino BeatBox



Make it NOW!Make it NOW!


Voltage (DC)3.3V5.0V30V
Dimension24mm x60mm
Net Weight8.6g
Rotational life>15,000 cycles
Total resistance10KΩ
Stroke length30mm
Total resistance tolerance+/- 20%

Platforms Supported

ArduinoRaspberry Pi



The platforms mentioned above as supported is/are an indication of the module's software or theoritical compatibility. We only provide software library or code examples for Arduino platform in most cases. It is not possible to provide software library / demo code for all possible MCU platforms. Hence, users have to write their own software library.

Getting Started

As an Adjustable Resistor

As shown below, the Grove - Slide Potentiometer can be used as a simple slide potentiometer in any MCU controlled or stand-alone project.



Follow these steps to build a sample Grove circuit using this module but without using any microcontroller board:

  1. Connect the slide potentiometer module to the input side of your circuit (to the left of the power module). On the output side of the circuit, you may use a range of User Interface modules (Grove - Red LED, Grove - LED String Light, Grove - Mini Fan, Grove - Buzzer, Grove - Recorder etc.)

  2. Power up the circuit when complete.

  3. The slide potentiometer module can now be used to trigger an output. For example:

    • When used in conjunction with a Grove - Red LED output module, observe that the brightness of the LED increases as you move the slider from GND to Vcc. At Vcc, the resistance of the potentiometer is minimum and the LED burns the brightest. The same behavior can be seen when the slide potentiometer is used with the Grove - LED String Light module - the more voltage you apply by taking the slider towards the Vcc mark, the brighter the LED lights would become.
    • Similarly, you can use the slide potentiometer to vary the speed of your Grove - Mini Fan or the frequency with which your Grove - Buzzer module sounds
    • The slide potentiometer can also be used as an ON/OFF switch for any circuit. Take the slider to the Vcc position to switch it ON and move it down to GND to switch OFF a circuit.

In terms of choosing a power module, you can use either the Grove - USB Power module or the Grove - DC Jack Power module for building standalone Grove circuits.

As a Voltage Divider

Follow these simple steps to make the slide potentiometer module function as a voltage divider:


2.Connect the board to PC using USB cable.

3.Upload the following sample sketch.

int adcPin = A0; // select the input pin for the potentiometer
int ledPin = A1; // select the pin for the LED
int adcIn = 0; // variable to store the value coming from the sensor
void setup()
Serial.begin(9600); // init serial to 9600b/s
pinMode(ledPin, OUTPUT); // set ledPin to OUTPUT
Serial.println("Sliding Potentiometer Test Code!!");
void loop()
// read the value from the sensor:
adcIn = analogRead(adcPin);
if(adcIn >= 500) digitalWrite(ledPin,HIGH); // if adc in > 500, led light
else digitalWrite(ledPin, LOW);

4.Open the serial monitor. You should see some data from ADC.


5.Move the lever back and forth. The serial data will change correspondingly. When the output resistance exceeds a certain preset value, the on-board indicator LED will also light up.

As an HID Device

Slide Potentiometer can be an effective Human Interface Device (HID) and can be used, for example, in the radio controller of a Radio Controlled toy car. The picture below shows two Slide Potentiometers on the control panel - one to control the speed of the left wheel, and the other to control the speed of the right wheel of the toy car respectively. Now you can change the speeds of both motors and see the behavior. You will see that if you make the right wheel spin faster than the left wheel, the car will turn rightwards, and if you make the left wheel spin faster than the right wheel, the car will turn leftwards.


Play with Codecraft


Step 1. Connect a Grove - Slide Potentiometer to port A0 of a Base Shield.

Step 2. Plug the Base Shield to your Seeeduino/Arduino.

Step 3. Link Seeeduino/Arduino to your PC via an USB cable.


Step 1. Open Codecraft, add Arduino support, and drag a main procedure to working area.

If this is your first time using Codecraft, see also [Guide for Codecraft using Arduino](

Step 2. Drag blocks as picture below or open the cdc file which can be downloaded at the end of this page.


Upload the program to your Arduino/Seeeduino.

When the code finishes uploaded, slide the Slide Potentiometer, you will see sensor value displayed in the Serial Monitor. And if you slide excceed half of Potentiometer, the LED on it will goes on. 

Play With Raspberry Pi (With Grove Base Hat for Raspberry Pi)


  • Step 1. Things used in this project:
Raspberry piGrove Base Hat for RasPiGrove - Slide Potentiometer




Get ONE NowGet ONE NowGet ONE Now
  • Step 2. Plug the Grove Base Hat into Raspberry.
  • Step 3. Connect the Slide Potentiometer to A0 port of the Base Hat.
  • Step 4. Connect the Raspberry Pi to PC through USB cable.


For step 3 you are able to connect the slide potentiometer to **any Analog Port** but make sure you change the command with the corresponding port number.


 If you are using **Raspberry Pi with Raspberrypi OS >= Bullseye**, you have to use this command line **only with Python3**.
  • Step 1. Follow Setting Software to configure the development environment.
  • Step 2. Download the source file by cloning the library.
cd ~
git clone

  • Step 3. Excute below commands to run the code.
python3 0

Following is the code.

import math
import sys
import time
from grove.adc import ADC

class GroveSlidePotentiometer(ADC):
def __init__(self, channel): = channel
self.adc = ADC()

def value(self):

Grove = GroveSlidePotentiometer

def main():
if len(sys.argv) < 2:
print('Usage: {} adc_channel'.format(sys.argv[0]))

sensor = GroveSlidePotentiometer(int(sys.argv[1]))

while True:
print('Slide potentiometer value: {}'.format(sensor.value))

if __name__ == '__main__':

If everything goes well, you will be able to see the following result

pi@raspberrypi:~/ $ python3 0
Slide potentiometer value: 987
Slide potentiometer value: 988
Slide potentiometer value: 986
Slide potentiometer value: 8
Slide potentiometer value: 2
Slide potentiometer value: 0
Slide potentiometer value: 1
Slide potentiometer value: 0
Slide potentiometer value: 24
Slide potentiometer value: 0
Slide potentiometer value: 0
Slide potentiometer value: 11
Slide potentiometer value: 995
Slide potentiometer value: 999
Slide potentiometer value: 999
^CTraceback (most recent call last):
File "", line 66, in <module>
File "", line 62, in main

You can quit this program by simply press ++ctrl+c++.

:::notice You may have noticed that for the analog port, the silkscreen pin number is something like A0, A1, however in the command we use parameter 0 and 1, just the same as digital port. So please make sure you plug the module into the correct port, otherwise there may be pin conflicts. :::

Play With Raspberry Pi (with GrovePi_Plus)

 If you are using **Raspberry Pi with Raspberrypi OS >= Bullseye**, you have to use this command line **only with Python3**.

1.You should have got a raspberry pi and a grovepi or grovepi+.


  • Plug the sensor to grovepi socket A0 by using a grove cable.

4.Navigate to the demos' directory:

    cd yourpath/GrovePi/Software/Python/
  • To see the code
    nano   # "Ctrl+x" to exit #
import time
import grovepi

# Connect the Grove Slide Potentiometer to analog port A0
slide = 0 # pin 1 (yellow wire)

# The device has an onboard LED accessible as pin 2 on port A0
led = 1 # pin 2 (white wire)


while True:
# Read sensor value from potentiometer
sensor_value = grovepi.analogRead(slide)

# Illuminate onboard LED
if sensor_value > 500:

print "sensor_value =", sensor_value

except IOError:
print "Error"

5.Run the demo.

sudo python3

Schematic Online Viewer



Raspberry pi music server: A first step to Raspberry Pi project

Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...