Project tutorial

Soft potentiometer tutorial © GPL3+

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

  • 1,247 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

A Microwave Interface for the IKEA Duktig Kids Kitchen

Project showcase by Myles Eftos

  • 1,328 views
  • 8 comments
  • 8 respects

Servo Signals and Characterization

by 3 developers

  • 1,187 views
  • 4 comments
  • 14 respects

Music Adaptive RGB LED with Arduino and Processing

Project in progress by ounane mohamed elfarouk

  • 1,032 views
  • 6 comments
  • 11 respects

Cellular IoT with Blynk & Hologram

by Moheeb Zara

  • 5,067 views
  • 9 comments
  • 19 respects

Monitoring Temperature Remotely with Blynk for Dummies

Project in progress by Cmtelesann

  • 1,242 views
  • 2 comments
  • 5 respects

How to Make a Customizable Punchable Keyboard Button

Project tutorial by Amal Mathew

  • 1,532 views
  • 4 comments
  • 4 respects
Add projectSign up / Login