A Soft-Circuit Potentiometer Makes Music

I recently received some e-textile components in the mail from an Italian company called Plug and Wear (www.plugandwear.com).  In the interest of full disclosure, I should state that the company had seen my past posts on e-textiles and sent some sample products free of charge.  Free or no, e-textiles are pretty cool, and I’ve been enjoying experimenting with the items they shipped.

Soft Circuit Elements
Soft circuit elements sent by Plug and Wear

I received the five different items shown at left.    I was particularly interested in the conductive tape, which comes in a range of bright colors.  I was hoping to use it in lieu of conductive thread for a colorful project, but needed to know its conductivity before determining what to do with it.

The level of documentation for the various items varies significantly on the company website, with no apparent information on the conductive properties of the tape.  However, connecting the conductive tape to a multimeter revealed a resistance of approximately  5400 Ohms/foot. This is significantly higher than standard conductive thread, which runs closer to 28 Ohms/foot.  Clearly the two are not directly interchangeable.  Instead, in any e-textile project, the conductive tape would function more like a resistor than a wire.

Plug and Wear clearly recognized this when they used the tape to create a soft-circuit potentiometer.  In a standard electric circuit, a potentiometer is just a variable resistor.  A soft circuit version of this electronic component can be created simply by running a current through the electric tape, and connecting a wire to various places along the tape.  This works because the tape’s resistance causes the voltage to drop linearly across its length.   Changing the position of the connection will yield different output voltages.

Setup for a Soft-Circuit Potentiometer
Testing a soft-circuit potentiometer. The red lead is at 5 V, the black is at ground, and the green connection at the ring outputs a voltage directly proportional to its position along the orange conductive tape.
Closeup of the variable connection to the soft-circuit pot. The small metal loop slides along the conductive tape while maintaining contact. The voltage is sampled via green clip attached to the larger loop.
Closeup of the variable connection to the soft-circuit pot. The small metal loop slides along the conductive tape while maintaining contact with it. The voltage is sampled via green clip attached to the larger loop.

The soft-circuit potentiometer provides the variable connection in the form of a metal ring which can slide along a length of conductive tape.  One end of the tape is connected to the high voltage and the other to ground.  A third connection is attached to the metal ring.  The voltage at the metal ring is directly proportional to its position along the tape.

I decided to use the soft-circuit potentiometer to control the tone produced by a small buzzer.  I had a LilyPad Simple Board and a LilyPad Buzzer lying around, so those became the basis for this project.

An Arduino LilyPad takes input from a soft potentiometer which determines the tone played on the buzzer.
An Arduino LilyPad takes input from a soft potentiometer which determines the tone played on the buzzer.
Soft potentiometer circuit.
In this circuit, the output of a soft potentiometer controls the tone of a buzzer.

Above are a picture and a diagram of the project set-up.  I was delighted to find out that Fritzing (see my previous post on this program) has a soft potentiometer in its list of parts, as well as all the two LilyPad boards I used, making the circuit diagram a snap.

The LilyPad simple has four analog ports labeled A2 through A5, and it is important to use one of those to measure the potentiometer readings.  The soft potentiometer output is hooked up to the LilyPad port A2.  Analog readings between 0 and 5 Volts are converted on a scale of 0 to 1023 on the Arduino.

To make the buzzer produce notes on the musical scale, I cribbed from Leah Buechley’s code here.  Additionally, the Arduino website has a simple tutorial that demonstrates reading voltage input from a potentiometer.  All that was left to do was connect the two programs to have input from the soft circuit potentiomenter determine the notes played by the buzzer.  The final code is at the bottom of the post.

Here is a video demonstration of the potentiometer/buzzer circuit in action.

Inside the program below, port A2 is polled for its analog value (between 0 and 1023).  This reading gets scaled to a number between 0 and 7, to play a musical note on the scale from C to B.

  Reads analog input from a potentiometer on pin A2, and converts the reading
  to a muscial note from a buzzer on pin 10.  
  Most of this code was adapted from the following two sources:
  (1) Arduino tutorial on analog input:         http://arduino.cc/en/Tutorial/AnalogInput
  (2) Leah Buechley's LilyPad buzzer tutorial:  http://web.media.mit.edu/~leah/LilyPad/07_sound.html

#define NUM_NOTES 8

int speakerPin = 10;  // output pin for speaker 
int sensorPin = A2;   // input pin for the analog potentiometer input
int sensorValue = 0;  // variable to store the value coming from the sensor

// beep function copied directly from Leah Buechley's tutorial at http://web.media.mit.edu/~leah/LilyPad/07_sound_code.html
void beep (unsigned char speakerPin, int frequencyInHertz, long timeInMilliseconds)     // the sound producing function
    int x;   
    long delayAmount = (long)(1000000/frequencyInHertz);
    long loopTime = (long)((timeInMilliseconds*1000)/(delayAmount*2));
    for (x=0;x<loopTime;x++)   

// notes are C, D, E, F, G, A, B - From Leah Buechley's tutorial
int notes[NUM_NOTES] = {2093, 2394, 2637, 2793, 3136, 3520, 3951, 4186};

void scale()
  for (int i = 0; i < NUM_NOTES; i++) {
    // Play each note for 500 milliseconds to make a scale
    beep(speakerPin, notes[i], 500);

void setup() {  
  // declare the speakerPin as an OUTPUT:
  pinMode(speakerPin, OUTPUT);
  // declare potentiometer pin as input
  pinMode(sensorPin, INPUT);
  // set the pulldown resistor to avoid spurious input
  digitalWrite(sensorPin, HIGH);
  // initialize serial communication at 9600 bits per second:
  // Play a scale at initialization so we know the buzzer is hooked up correctly

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
  // convert the sensor value to a musical note
  int interval = (int) (sensorValue*NUM_NOTES/1024.0);
  // output the sensor value for viewing/debugging
  Serial.print(", ");
  //Send the note to the speaker
  beep(speakerPin, notes[interval], 50);


1 thought on “A Soft-Circuit Potentiometer Makes Music

Leave a Comment