Mac OS Foot Switch From a Guitar Amp Pedal.




About: I'm a research scientist at Yahoo! I like making stuff.

Need a foot pedal for your Mac? Got a two switch guitar pedal and and arduino board lying around? A couple of wires, a three prong 1/4" jack and you're all set. I had to do some audio transcription and used my pedal to play/pause and skip back the video.

This tutorial illustrates making a foot pedal for a Macintosh computer using an Arduino and a 2 switch guitar amp pedal.

You'll have to be a little familiar with soldering and writing simple code.

If you need a guitar amp pedal switch, you can buy one or make one with this other instructable or with this one.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Supplies.

1) Guitar Pedal (I'm using a two switch pedal)
2) Arduino (I'm using a Diecimila)
3) Breadboard (or prototype board if you like)
4) Three Conductor 1/4" Stereo Phone Jack (got one at RadioShack)
5) 2 1k ohm resisters
6) Wire (you know whatever you have lying around)
7) Soldering Iron (and Solder will help too)

Step 2: Solder the Jack

The jack (and corresponding plug) has three connection points: Ring, Tip, Sleeve. You need to solder a wire onto each of the connectors. Make the wires different colors just to stay sane.

The Sleeve (attached to the black wire in my photo) is the common line running to each of the switches on the pedal. If we give it (the black wire) a voltage, switch #1 will turn on/off the Tip wire (green in my photo). Likewise, switch #2 turns the Ring on and off (yellow in my photo).

If you get confused (I kinda did) just solder a different color wire onto each lead on the jack. You can use a volt meter to test for continuity (or wire it up to the breadboard with an LED on it) to figure it out. I kinda looked at each lead and figured out what part of the plug it actually makes contact with.

Step 3: Wire the Jack to the Breadboard

This step is the messy one. Here we connect the jack to the bread board.

Basically, we are going to take power from the arduino and run it to the foot switch (via the black wire on my jack - i know i know i should have used a red wire). Then each wire off the jack we hook to a 1k ohm resistor. And from the back of each resistor, back to ground.

Then we need two generous wires to lead off the board from the front of each resistor (next to where the jack leads back in. These two wires we will use to test for HIGH/LOW on the Arduino.

Step 4: Attach the Jack.

Attach the Jack so the Sleeve line connects to the RED 5v.

The Ring and the Tip should connect to each of the heads of the resistors.

Look at the little boxes on the second photo for detail.

Step 5: Attach Two Probe Wires.

We need 2 wires to run from the top (not the side connected to the ground, the other) of each resistor to our arduino.

Look at the long boxes on the photo for details.

Step 6: Attach the Breadboard to the Arduino

Now we plug four wires from the breadboard to our Arduino.

Plug the RED power wire into the 5V Power line on the Arduino.
Plug the BLACK ground wire into the GND line on the Arduino.
Plug the #1 switch (GREEN line) into the #9 pin on the Arduino.
Plug the #2 switch (YELLOW line) into the #8 pin on the Arduino.

(We'll test pins 8 & 9 for voltage on the Arduino)

Step 7: Plug in the Arduino to the Mac's USB Port

Plug your Arduino/Breadboard/Jack/Switch combo thingie into your USB port.

Step 8: Program the Arduino

So here, we wanna code up the arduino. You can use whatever pins you like really. Basically, we want to write to the serial port whenever a pin changes. We write a 1 for switch #2 and a "2" for switch #2. Really, you can't chord with this setup (but the code could be changed to allow for that).

Um, use the FootSwitch.pde file to get the code...not the jpg. :)

Step 9: Program the Mac

So, by now we have a foot switch talking to our Arduino. The Arduino writes a 1 or a 2 to the serial device when we click the switches. We need something on the Mac to read it. Making the Arduino pretend to be a keyboard is kinda hard. So, instead we are gonna write a little C program to be our controller for the Mac.

We'll start by taking Tod E. Kurt's existing arduino-serial program that reads the Arduino serial port. I've made a few small modifications to automatically do stuff when it sees a 1 or a 2. The attached file should work well. You can read the comments if you wanna see whats going on, but its not for the faint of heart.

You can download the source (the arduino-serial-footswitch.c file) or the compiled app (third file: arduino-serial-footswitch).

Download it and put it in a new folder.

If you wanna compile it, I'll assume you know how to:

1) Open an iTerm and CD into that directory
2) Compile it by typing: gcc -o arduino-serial-footswitch arduino-serial-footswitch.c

Step 10: Remote the Mac Via Applescript

So we need to write two AppleScripts. These will open the app we want and type they keyboard (shortcut) we want.

Attached is my template for doing so. You can almost read AppleScript. So just take a look at the attached file.

There are three types of key events you can make from AppleScript: "'key down'", "'key code'", and '"keystroke'". Your mileage may vary, so try "'keystroke'" first...if that doesn't work try the other events, one at a time.

Open up the Script Editor application (its there on your mac somewhere) and try it out. I'm gonna make you type this part in by hand. Sorry folks. :)

Save As... each AppleScript as a type "Application". Put them next to our complied C code/app from the last step. Name each one and - one for each switch.

Step 11: Get Running!

Whew. Ok, so we have a Foot Switch, which is wired into a breadboard, which is attached to an Arduino, which is plugged USB into a Mac, which is running a C program that listens to the footswitch and execs applescripts. Yowza!

ok. you should have a folder that looks like this:

|-- arduino-serial-footswitch
`-- arduino-serial-footswitch.c

Open up your terminal app. CD into the directory you made. You can start your little script like:

./arduino-serial-footswitch -p `ls /dev/tty.usbserial*` -b 9600 -R

this runs our script by looking for our Arduino board...if you have more than one plugged in, replace all of `ls /dev/tty.usbserial*` with the path to the device (if you do this dont use the quotes!).

It will appear to do nothing, but your pedal is now live. If your buttons are backwards, you can reverse the wires running to pins 8 & 9. :)

Happy Stomping!

Step 12: Voila–a Video Demo!

Here's a demo of the footswitch in action! I mention there's a 500ms latency (which is the AppleScript lag). There's a second latency in invoking the script itself, so you will see a total lag of ~60 seconds.

Be the First to Share


    • Assistive Tech Contest

      Assistive Tech Contest
    • Reuse Contest

      Reuse Contest
    • Made with Math Contest

      Made with Math Contest

    24 Discussions


    8 years ago on Introduction

    This is a pretty good intro to what is possible with an Ardurino and a Mac. I think I will find myself coming back to this for reference.


    9 years ago on Introduction

    I did something similar with an old USB joystick. Basically I just ran wires from the footswitch and soldered them to where the joystick buttons were. Works great for a 2-button switch, though I'm having some electrical issues trying to add another button. Are there any advantages to the Arduino (besides the possibility of analog inputs?)

    1 reply

    Reply 9 years ago on Introduction

    The Arduino lets me talk serial over USB to the mac. So adding new functionality is simplified (hardware wise) but requires a bit of software legwork.


    10 years ago on Introduction

    i have found a progran called apple script proxy which is much simpler and works with no need for 2 apple scripts or command line


    10 years ago on Introduction

    steps 8 9 and 10 all the downloads are .tmp files and dont work properly if i right click on them and save as (i am using mac obviously)

    1 reply

    Reply 10 years ago on Introduction

    So, most of the code is not in a 'ready to run' state. The code in this instructable illustrates a proof of concept. You have to compile the C source (as said in Step 9) and modify some AppleScripts (as said in Step 10) and assemble the App (Step 11). If you Save As... the code on Step 8 and name it .PDE, that should open right up in the Arduino app and print out the button number to the app's serial console.


    Reply 10 years ago on Introduction

    if you tell me which code you are trying to download from which step (exactly) i could provide more assistance.


    Reply 10 years ago on Introduction

    the arduino code and the mac codes all of them they just come up as a .tmp file and open a blank tab thanks for the quick responce james


    Reply 10 years ago on Introduction

    You can hit Control and Click (or Right Click) on one of the files and say "Save Link As...". Save it as the right filename like 'footswitch.pde'. That should download it correctly.


    10 years ago on Step 12

    Hi nice job I hope you don't mind answering a low tech question for me. What is the pinout for you Vox footswitch I assume its something like this can you confirm? Thanks

    vox footswitch.JPG
    3 replies

    Reply 10 years ago on Step 12

    Yup, that is correct. I run the + current to the sleeve and measure/test for current at the ring or tip.


    Reply 10 years ago on Introduction

    thanks unfortunately I don't have a footswitch to ring out in fact I am planning to build one for my VOX amp and I have been having a hard time finding a schematic online.


    Reply 10 years ago on Introduction

    me too mate. this drawing is right though. tip switch controls reverb, sleeve switch controls tremolo. closed circuit means effect is bypassed, so if you get two dpdt footswitches you can rig up a status LED for each effect


    11 years ago on Introduction

    You could also accomplish this by wiring the foot switch to the controller of a USB keyboard. I've built one for controlling PowerPoint shows where the right switch connects to the pins for PgDn and the left to PgUp. Yours is more impressive (and reconfigurable) though.

    1 reply

    Reply 11 years ago on Introduction

    I built a synth controller using this technique. Works great for switch-type events, especially if you can make it work for keys that you don't normally use in your sequencer. I did it by taking apart an old USB keyboard and hooking up alternative buttons to the switch points, basically like what's described here:

    The cool thing about aymans hack is that he could pretty easily add some analog foot pedals to the mix, since Arduino has 6 analog inputs.