Project in progress
Ankle Air Guitar Pedal

Ankle Air Guitar Pedal © MIT

Build an "invisibe" expression pedal for your guitar with MCP41010 and Arduino Nano. It's awesome and simple. May the funk be with you.

  • 5,345 views
  • 4 comments
  • 17 respects

Components and supplies

Ard nano
Arduino Nano R3
any arduino is okay, im thinking on using tinyduino
×1
mpc41010
digital potenciometer
×1
09269 01
SparkFun Triple Axis Accelerometer Breakout - ADXL335
any analogoutput accelerometer is okay
×1
stereo audio jack 6,5 mm female adapter
×1
stereo audio jack 6,5 mm cable
×1
09264 1
RGB Diffused Common Cathode
just for fun, no needed
×1

Apps and online services

About this project

We need to weld the correct things, so follow along. The current interest in dubstep was growing, and I was ready to spend 40€ on one expression pedal for my boss synthesizer when I remembered I was an electronics nerd.

Then science occurred.

At first, I thought about drilling a shoe and gluing the electronics inside, but I did not have a pair of shoes to spare. So, I ended up purchasing a hair band and stitching thread.

First steps with the MPC digital potentiometers family:

We have a lot of types to choose from, but I picked this one - the MPC41010.

  • MPC41010: single potentiometer, 10k ohm
  • MPC41050: single potentiometer, 50k ohm
  • MPC41100: single potentiometer, 100k ohm
  • MCP42010: two independent potentiometers, 10k ohm
  • MCP42050: two independent potentiometers, 50k ohm
  • MCP42100: two independent potentiometers, 100k ohm

More things about them here. Important things that you need to know for hacking this device:

  • You can do similar things with other digital potentiometers. (like the COM-10613, more info)
  • The resistance is 0 to 10k ohms divided in 255 steps with each step of 39 ohms. (MATH!)
  • Serial communication: just use #include <SPI.h>.

First Prototype: Lessons Learned

I love the smell of recycled cardboard in the morning.

(spanish)

What I learned with the prototype:

  • When the device is reset, the human needs to set the flat and the top values for adjusting the range of movement.
  • It would be nice to implement a function that chooses between the axis which had the wider range of variation. This would be useful so that you don't have to mind the position of the accelerometer; you could put it in upside-down, on the bass top, on your wrist, etc.
  • Maybe I need to implement a logarithmic behaviour for the resistance values.
  • I need to take care of the 0 level because it is highly instable.

Building the stereo jack 6,5 mm cable

Keep in mind I am poor. So for 4€, I bought the components (couple of male jack endings and 1 meter of cable).

We need to weld the correct things, so follow the scheme and use some hot-shrink tube to do a fine job.

Code

MAIN THINGArduino
main raw program, the rgb led or any pwm signal is catastrophic fro the accelerometer readings (noise)
#include <SPI.h>  
#define debug //comment this line if you´re not gonna use the serial data with the arduino ide

#define CS 10 //chipselect

#define accelerometerX A0//analogpins for the accelerometer
#define accelerometerY A1
#define accelerometerZ A2

#define RED 6 //rgb pins
#define GREEN 3
#define BLUE 5

//MCP41010 chip´s connection
//        39ohms per step of the  
//CS  10              U      vcc
//SCK 13 serial clock        PBO--UPRESISTOR
//SI  11 serial imput        PWO  INRESISTOR
//gnd                        PAO--BOTTOMRESISTOR




int datarray[18]={0,0,0,0,0,0,1023,1023,1023,0,0,0,0,0,0};
int smoothingarray[15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int rgb[3];
int i=0,chipvalue=0;
int ResistorValue=0;
void setup() {
//
//pinMode (GREEN, OUTPUT);//GREEN RGB (PWM)
//pinMode (BLUE, OUTPUT);//BLUE
//pinMode (RED, OUTPUT);//RED  
//digitalWrite(GREEN, HIGH);//setting the led off at the begining
//digitalWrite (BLUE, HIGH);//
//digitalWrite (RED,  HIGH);//

pinMode (CS, OUTPUT);//chipselect for the  MCP41010 chip
pinMode (13, OUTPUT);//things are happening led 
pinMode (accelerometerX, INPUT);//acelerometer´s inputs
pinMode (accelerometerY, INPUT);//
pinMode (accelerometerZ, INPUT);//
  SPI.begin(); 
  MCP41010Write(0);//init value horizontal foot
  
#ifdef debug
Serial.begin(9600);
#endif
}

void loop() {
datarray[0]=analogRead(accelerometerX);
datarray[1]=analogRead(accelerometerY);
datarray[2]=analogRead(accelerometerZ);

comparemaxmin(datarray);

detectRange(datarray);

ResistorValue=map(datarray[datarray[15]],datarray[datarray[15]+6]+20,datarray[datarray[15]+3]-10,0,255);//+20 to the min and -10 to the max for preventing unreachable edges

chipvalue =constrain(ResistorValue,0,255);

MCP41010Write(smoothing(chipvalue));

//  //map(value, fromLow, fromHigh, toLow, toHigh)
// for(i=0;i<=2;i++){
//  rgb[i]=map(datarray[i],datarray[i+6],datarray[i+3],0,255);
// }
////analogWrite(GREEN, rgb[0]);//EL LED DA PROBLEMAS DE LECTURA ruido/////////////////////7
////analogWrite (BLUE, rgb[1]);//
////analogWrite (RED,  rgb[2]);//



#ifdef debug
      Serial.print("//RawReadings:  ");
      Serial.print(datarray[0]);
      Serial.print(" ");
      Serial.print(datarray[1]);
      Serial.print(" ");
      Serial.print(datarray[2]);
      
      Serial.print("     /max ");
      Serial.print(datarray[3]);
      Serial.print(" ");
      Serial.print(datarray[4]);
      Serial.print(" ");
      Serial.print(datarray[5]);

      Serial.print(" /min ");
      Serial.print(datarray[6]);
      Serial.print(" ");
      Serial.print(datarray[7]);
      Serial.print(" ");
      Serial.print(datarray[8]);

      Serial.print("    //GAP :");
      Serial.print(datarray[9]);
      Serial.print(" ");
      Serial.print(datarray[10]);
      Serial.print(" ");
      Serial.print(datarray[11]);

//      Serial.print("/?? ");
//      Serial.print(datarray[12]);
//      Serial.print(" ");
//      Serial.print(datarray[13]);
//      Serial.print(" ");
//      Serial.print(datarray[14]);

      Serial.print("  //axis choose ");
      Serial.print(datarray[15]);
      
      Serial.print("       //chip value ");
      Serial.print(chipvalue);
      
      Serial.println();
#endif
  delay(100);//delay for stability
}






void comparemaxmin(int datarray[])
{
  for(i=0;i<=2;i++)
datarray[i+3]=max(datarray[i],datarray[i+3]);

  for(i=0;i<=2;i++)
datarray[i+6]=min(datarray[i],datarray[i+6]);

}


void detectRange(int datarray[18])
{
  for(i=0;i<=2;i++)
  {
datarray[i+9]=abs(abs(datarray[i+3])-abs(datarray[i+6]));
  }
if(datarray[9]>=datarray[10]&&datarray[9]>=datarray[11])//choosing the axis with the wider range
datarray[15]=0;
if(datarray[10]>=datarray[9]&&datarray[10]>=datarray[11])
datarray[15]=1;
if(datarray[11]>=datarray[9]&&datarray[11]>=datarray[10])
datarray[15]=2;
}

void MCP41010Write(byte value) //speaking protocol with the mcp chip
{
  // Note that the integer value passed to this subroutine
  // is cast to a byte
  
  digitalWrite(CS,LOW);
  SPI.transfer(B00010001); // This tells the chip to set the pot
  SPI.transfer(value);     // This tells it the pot position
  digitalWrite(CS,HIGH); 
}

int smoothing(int data){
int result,j;

for(j=0;j<=14;j++){
  smoothingarray[j] =  smoothingarray[j+1]; 
}
smoothingarray[14]= data;

result=(smoothingarray[0]+smoothingarray[1]+smoothingarray[2]+smoothingarray[3]+smoothingarray[4])/5;
constrain(result,0,255);
return result;
}

Schematics

SCHEME ANKLE EXPRESSION PEDAL
Guitar%20pedal

Comments

Similar projects you might like

Arduino UNO Guitar Pedal

Project tutorial by electrosmash

  • 47,680 views
  • 27 comments
  • 148 respects

Arduino DUE Programmable Guitar Pedal

Project showcase by Team ElectroSmash Team.

  • 12,442 views
  • 1 comment
  • 50 respects

Arduino MEGA Guitar Pedal

Project tutorial by electrosmash

  • 17,538 views
  • 2 comments
  • 105 respects

3D-Printed Air Gate for Drones

Project tutorial by circuito.io team

  • 5,618 views
  • 2 comments
  • 27 respects

Interactive Children's Jack-In-The-Box

Project tutorial by Team 10

  • 635 views
  • 0 comments
  • 4 respects

IR Controller for Air Conditioner

Project in progress by BuddyC

  • 32,968 views
  • 8 comments
  • 25 respects
Add projectSign up / Login