Project tutorial
Soft potentiometer tutorial

Soft potentiometer tutorial © GPL3+

This tutorial will show you how to use the Soft Potentiomenter produced by plug and wear.  

  • 1,540 views
  • 0 comments
  • 0 respects

Components and supplies

Ard lilusb
Arduino LilyPad USB
×1
Soft potentiometer kit
×1

About this project

1. Introduction

The soft potentiometer is made of fabric and works like a normal potentiometer. It has a metal ring that you can slide and change the value that you Arduino reads.

2. Connect the potentiometer to the power supply

Connect the two ends of the potentiometer to the power supply. One to ground and the other to 5 V.

3. Connect the potentiometer to the board

Connect the moving part of the potentiometer to the analog input A5 of Arduino Lilypad.

4. How to read the potentiometer value

The Arduino can read the potentiometer value using the analogRead function. It will read a value between 0 and 1024 that depends on the position of the metal ring along the potentiometer. The value of the potentiometer will change the frequency of the LED blinking.

Here is the code:

int sensorPin = A5;    // select the input pin for the potentiometer
int ledPin = 13;      // select the pin for the LED
int sensorValue = 0;  // variable to store the value coming from the sensor
void setup() {
  // declare the ledPin as an OUTPUT:
  pinMode(ledPin, OUTPUT);
}
void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
  // turn the ledPin on
  digitalWrite(ledPin, HIGH);
  // stop the program for <sensorValue> milliseconds:
  delay(sensorValue);
  // turn the ledPin off:
  digitalWrite(ledPin, LOW);
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);
}

Code

Code snippet #1Arduino
int sensorPin = A5;    // select the input pin for the potentiometer
int ledPin = 13;      // select the pin for the LED
int sensorValue = 0;  // variable to store the value coming from the sensor

void setup() {
  // declare the ledPin as an OUTPUT:
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
  // turn the ledPin on
  digitalWrite(ledPin, HIGH);
  // stop the program for <sensorValue> milliseconds:
  delay(sensorValue);
  // turn the ledPin off:
  digitalWrite(ledPin, LOW);
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);
}

Comments

Similar projects you might like

Analog Textile Press Button Tutorial

Project tutorial by Arduino_Scuola

  • 1,549 views
  • 0 comments
  • 7 respects

Tubolar Stretch Sensor Tutorial

by Arduino_Scuola

  • 1,909 views
  • 0 comments
  • 6 respects

Using iShield Gauge with potentiometer

Project tutorial by Victor Carreño

  • 1,734 views
  • 3 comments
  • 7 respects

Arduino RFID Lock Tutorial

Project tutorial by Nick Koumaris

  • 9,220 views
  • 2 comments
  • 27 respects

Arduino Nano LCD Stopwatch Without Potentiometer

Project tutorial by TechWithZan

  • 6,527 views
  • 9 comments
  • 16 respects

Arduino Bluetooth Basic Tutorial

by Mayoogh Girish

  • 479,886 views
  • 49 comments
  • 284 respects
Add projectSign up / Login