The Clamshell Stompbox




Introduction: The Clamshell Stompbox

About: I'm an artist and associate professor at Columbia College Chicago, where I teach audio and electronic art. I make sound art, kinetic sculpture, and knitted circuits. Find my work online at ...

This is a DIY variable resistor I created as an interface for live performance-- like a stomp box. I designed it as a project my audio students could build with materials we already have in the classroom.

The result is a variable resistor that can be triggered with just a little pressure from hands or feet. Resistance ranges from 0 to about 18k ohms, and it's very sensitive to slight changes in pressure. (With no pressure, resistance is infinite.)

With an Arduino, the clamshell's big jumps in resistance can work as an on/off switch-- perfect for foot-powered control! Depending on the code, you can use it as a toggle switch or a momentary switch. And as a stompbox, it's flat and quiet (unlike metal stompswitches).

clamshell CD case
adhesive-backed copper foil
hot glue
wire (22 AWG)
craft foam
plywood board (cardboard could also work)
10k resistor (approximately)

glue gun
box cutter
hole punch (or use the box cutter)
drill (optional)
soldering work station (soldering iron, helping hands, goggles, etc.)
test leads

Step 1: The Clamshell Variable Resistor

Two holes punched on the same side of the case provide an exit for two wire leads, and prevent the case from crushing the wires.
The wire leads are soldered to two identical flag-shaped pieces of copper foil stuck to the insides of the case (on opposite sides). When the case is closed, the "tails" of foil extend up opposite sides, not touching (very important).

(I didn't take pictures while modifying the clamshell case so I'm hoping you can follow from the photos of the finished piece. I've included a suggested order of steps, later on.)

Step 2:

One of the foils has a backing of craft foam between the foil and the plastic, which fills the air gap inside the case, so the rectangles of foil touch once the case is closed.

To create the variable resistance, I've taped a rectangle of velostat over each foil piece. The tape acts as a hinge-- I can fold it back if I want to decrease the resistance.

With the case closed, the clamshell can take a fair amount of stomping, just stay off the wire and solder points. (Attaching it to the board in a later step provides protection for the wire and solder points.)

Step 3: Suggested Steps for Making the Clamshell

Ready to make it yourself?
Here's a suggested order of steps:

1. Mark and cut holes for the wire leads.

2. Measure the distance from the sensor area to the holes. This should be the length of your tail.

3. Cut the foil. The rectangles on mine are 2" x 1". The tails are 1/4" wide and 2" long.

4. Tin and solder a piece of stranded wire to the end of each tail. Length is up to you.

5. Take the backing off the first foil and affix it to the clamshell. The solder will probably have killed the adhesive underneath it, so put some hot glue on that part to hold it down.

6. Cut one rectangle of craft foam and two rectangles of velostat. Each piece should be about 1.5" x 2.5".

7. Glue the craft foam opposite of the glued first foil. Attach the second piece of foil with the rectangle on top of the foam.

8. Use clear tape to affix a rectangle of velostat over each foil.

9. Thread the wires through the holes, smooth the velostat over the foil, close the case, and you're done. (With this part, anyway.)

10. If you've got a multimeter, I suggest hooking it up to the leads at this point to check the resistance.

Step 4: Protecting the Wires

To make the clamshell stompbox "stomp proof", I wanted to lay it over a flat surface with channels cut for the wires to run through.

I grabbed a piece of scrap plywood, and enlisted a little help on the woodworking. Here's what we did:

First Dan marked the midpoint of the wood along one edge, and lined the midpoint of the clamshell up with it. (This one already had a handy dimple at the midpoint.) He opened the clamshell, so the side with the two holes in it was against the wood, then marked the holes in the wood.

Step 5:

With a square rule, he drew parallel lines from the holes to the edge of the wood. The lines indicate "channels", just wide enough for the wire to sit in.

Step 6: Cutting the Board

Next he used a utility knife to cut along each line, cutting a little deeper than the wire's thickness, so the wire would lay below the surface of the wood. (It's not visible in the photo, but the board is clamped to the table - otherwise it slides around and is impossible to cut.)

Once the outline was cut, he used the knife to cut under the wood, and was able to lift each piece out.

We put the clamshell in, and tested the fit--  a little too shallow for the wire. So he repeated the cutting, until it was deep enough.

Step 7: More Cutting of Wood

Once that was finished, I laid the clamshell on top. The wires fit, but I thought the solder points could use a little more room. So I drilled a few holes around the end of the channels, for the solder points to fit in.

Step 8: Finishing the Board

Next came the hot glue. I put a blob over each solder point, for added protection. Then I spread glue on the back (the side without the holes). I lined up the wires in the channels, and glued the whole thing to the board.

The end result was nicely functional and flat. I only put a little glue on it because I wanted to be able to remove it to show my students. However... I suggest you use a liberal amount, especially around the wire channels so they don't slide out.

Eventually I want to add a plug to the wires, and maybe create a shield for plugging into the arduino. Also, I'd like to try extending the foil all the way to the case spine, to exit through slots cut in it. That way there'd be no need for wire channels running under the clamshell.

One more thing.... the center of a clamshell case has a "button" that sticks out from the surface. However you make yours, I suggest designing it so the button sticks up, instead of down into the board. I didn't, and it got in the way of the case laying flush on the board. However, once the hot glue was added, the problem was minimal.

Now onto the Arduino code!

Step 9: Arduino Sketch for Momentary Switch

I used two sketches included in the Arduino examples to turn this into a functioning switch. One makes it a momentary switch, the other turns it into a toggle switch. The same wiring works for both:

Use a fixed resistor of roughly the same resistance as the clamshell (I used 10K.)

Fixed resistor between A0 and ground.

One lead of the clamshell to A0. (Since I was using test leads, I just clipped directly to the fixed resistor leg coming out of A0. This way I could skip the breadboard.)

Other clamshell lead to 5V on the Arduino.

(This wiring basically treats the clamshell as one half of a potentiometer, and uses a fixed resistor for the other half.)

Momentary Switch

To make a momentary push-button switch, I used the sketch, “IfStatementConditional”, found in the “Control” examples. The sketch  works as-is, no changes necessary. The sketch comes with Arduino, but I'm pasting it below for reference.

Once you upload it, the built-in LED light on pin 13 lights up whenever you press on the clamshell.

If you have trouble with this:

Open the serial monitor (click the magnifying glass icon at the top right of the arduino sketch window). Note the numbers that appear each time you tap the switch.

Those numbers should be higher than the threshold value in the sketch. If they aren’t, lower the value. This number tells the Arduino the point at which to turn on the LED.

  Conditionals - If statement

This example demonstrates the use of if() statements.
It reads the state of a potentiometer (an analog input) and turns on an LED
only if the LED goes above a certain threshold level. It prints the analog value
regardless of the level.

The circuit:
* potentiometer connected to analog pin 0.
Center pin of the potentiometer goes to the analog pin.
side pins of the potentiometer go to +5V and ground
* LED connected from digital pin 13 to ground

* Note: On most Arduino boards, there is already an LED on the board
connected to pin 13, so you don't need any extra components for this example.

created 17 Jan 2009
modified 9 Apr 2012
by Tom Igoe

This example code is in the public domain.


// These constants won't change:
const int analogPin = A0;    // pin that the sensor is attached to
const int ledPin = 13;       // pin that the LED is attached to
const int threshold = 400;   // an arbitrary threshold level that's in the range of the analog input

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize serial communications:

void loop() {
  // read the value of the potentiometer:
  int analogValue = analogRead(analogPin);

  // if the analog value is high enough, turn on the LED:
  if (analogValue > threshold) {
    digitalWrite(ledPin, HIGH);
  else {

  // print the analog value:
  delay(1);        // delay in between reads for stability

Step 10: Arduino Sketch for Toggle Switch

Toggle Switch

I want the clamshell to behave like a real stompbox, so I decided to make a toggle switch next. I used the sample sketch, “Knock”, from the “Sensors” examples.

This uses the same wiring as the “IfStatementConditional” above. However, before I loaded the sketch, I made a small change:




This allows me to see the values the Arduino reads off the clamshell.

After verifying and loading the sketch, I opened the serial monitor. Now every time I tapped on the clamshell, the built-in LED on pin 13 toggled on or off. Additionally, the sensor reading itself appeared in the serial monitor.

It worked well, but I noticed the monitor sometimes returned several readings for each tap, or none at all. So I played with the delay value, and varied how fast I was tapping the switch with my foot. A delay of 150 seemed to work best for me.

Just like with the first sketch, the threshold value is key: If it doesn’t work, make sure the number assigned to “threshold” is much lower than the sensor reading numbers in the monitor.

Here's the sketch, a small variation on Knock!, which I'll call Stomp_Toggle. Once you get the switch functioning, you can cut and paste the code into any sketch you like.

/* Stomp Toggle

   This sketch reads the clamshell variable resistor used as a stomp switch.
   It reads an analog pin and compares the result to a set threshold.
   If the result is greater than the threshold, it writes
   the value to the serial port, and toggles the LED on pin 13.

   The circuit:
* One lead of the clamshell attached to A0
* Other lead of clamshell attached to 5V on Arduino
* 10K resistor attached from analog in 0 to ground

   created 25 Mar 2007
   by David Cuartielles <>
   modified 30 Aug 2011
   by Tom Igoe
   modified 10 Dec 2013
   by Jesse Seay

   This example code is in the public domain.


// these constants won't change:
const int ledPin = 13;      // led connected to digital pin 13
const int knockSensor = A0; // the clamshell is connected to analog pin 0
const int threshold = 500;  // threshold value to decide when the detected pressure toggles the switch

// these variables will change:
int sensorReading = 0;      // variable to store the value read from the sensor pin
int ledState = LOW;         // variable used to store the last LED status, to toggle the light

void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as as OUTPUT
Serial.begin(9600);       // use the serial port

void loop() {
  // read the sensor and store it in the variable sensorReading:
  sensorReading = analogRead(knockSensor);   

  // if the sensor reading is greater than the threshold:
  if (sensorReading >= threshold) {
    // toggle the status of the ledPin:
    ledState = !ledState;  
    // update the LED pin itself:       
    digitalWrite(ledPin, ledState);
    // send the sensor reading back to the computer, followed by newline
  delay(150);  // delay to avoid overloading the serial port buffer

Supercharged Contest

Participated in the
Supercharged Contest

Hardware Hacking

Participated in the
Hardware Hacking

Be the First to Share


    • Pocket-Sized Speed Challenge

      Pocket-Sized Speed Challenge
    • Audio Challenge 2020

      Audio Challenge 2020
    • Maps Challenge

      Maps Challenge

    2 Discussions


    6 years ago on Introduction

    Thanks! I would love to see what you make with it.



    This is brilliant! I have just started messing around with Velostat, and am only really starting to figure out how to use it. Thank you so much for sharing your project.