Introduction: Arduino Programable 5 Pedal Switcher

Searching for a simple programable pedal switcher over the net I was
amazed about the overpriced gear around there... so I came out with DIY solution and found several great projects but found 'em too complicated (PCB etching...) or maybe too overpriced for my needs. All I needed at that time was the simplest possible programable true bypass relay switcher for 4 pedals but found a way to switch up to 5 pedals with the "nano" version of arduino UNO. With 2 Arduino nanos (thru serial communication) you can surely extend this as up to 8 switchers! (to see: second part of this instructable...). Posibility to add MIDI program change out on pin 1.

Addendum: connect a led in parallel of one of these little on the relay board (caution: check the polarity!). This manner you'll know which relay is on or off when programing. Tip: I 've used the hole of the screw near the inboard led to drill thru the chassis and put it the parallel one on. (see pictures on my second instructable )

After noob searching for the "code-part" of this project over internet and spent hours and hours of led debuging (hey, I'm NOT a coder, just a r'n'r guitar player!) I got out with an amazing library named "keypad.h". Initially intended to manage secret code doors within a keypad, we'll see how simple is to "fool" the code with a 3 way selector, so with only 5 momentary switches we'll can access up to 15 functions and store 5 presets on internal EEPROM! The hardware parts are current sees over Ebay / Google so please don't ask me "how and where can I buy this thing or this other..." ! Google is your friend and Ebay too!

Caution: some noise issues where experienced by some builders (me included). I suspect those cheap and chinese relays aren't made for audio signals. The ideal relays should be some called DPDT but for instance few advices can be followed: use shielded cables all along the signal path, ensure all the circuit in a metallic box use caps (usually 10u) for decoupling and/or add some high resistances to all in and outs jacks. Adding a booster pedal in front of the input may strongly reduce these noise...



-position "A" (select switches) from the selector (cases 'a' 'b' 'c' 'd' 'e' on the sketch) -> select wich pedal to loop ON (1,2... 5). When finished, turn the selector to ->

-position "B" (preset memory mode -cases 'f' 'g' 'h' 'i' 'j') -> select the number of the preset (1 to 5) where you want to preserve the loops (the led of the preset you choose will lit 2 times. Caution: don't press the switch more than once because you'll reset the preset (all ' 0,0,0,0,0')!

-Rotate the selector back to position 'A', select another pedal combination and store it on next free preset on position "B". You can repeat this procedure 5 times. Once you have your 5 combination stored, rotate to->

-position "C" (cases 'k' 'l' 'm' 'n' 'o')-> read the preset (1 to 5) you memorized previously

-enjoy the art of rocking pedals with one footpress !!!

Step 1: Arduino Programable 5 Pedal Switcher

So here are the parts:

-1 x arduino Nano with Atmega328 built-in (~4 to 5$)

-1 x 5 volt/2 amp power supply (~10 $)

-3 x ways rotary selector (~4$)

-5 x SPST Momentary Footswitches (~15$)

-5 x double relay modules (~ 15$)

-12 x chassis 6.3 female jack (~20$)

-10 x leds (half of a different color)

-5 x 220 to 560 ohms resistor (peanuts...)

-some spare cable (...)

~70$ if you don't have any of these as spare

(not included: metal chassis or woodbox or whatever...)


and here are the tools:


-soldering station

-eventually some tools for wood/metal/plastic working


Here's the code part: (many thanks to Anton Efremoff for his feedback and suggestions) Tip: don't forget to add "//" on these two lines if you want to save your preset after booting it up!

//for (int =0;i<512;i++)
//EEPROM.write(i,0); It's here just for initialize EEPROM memory in case of debugging

You''l have first to download and install the keypad.h library here:

A big THANK YOU to Armando Colangelo aka 4Knobs Effects for this code . Note his project is based on a different approach that ommit the 3 positions switch and therefore adds 1 more selecting switch (6 instead of 5).

A video is available on youtube showing his awesome work.


Fever2112 (author)2017-03-05

In this picture you have a lighted LED ring around the foot switch.... where did you get these?

MachineClash (author)Fever21122017-03-10

Try this: or search "footswitch led ring"

NikolayZ6 (author)2017-01-28

I don't recommend to put relays on D13, because potential jumps few times on this pin when arduino starts. Check it with any light diode, you don't need to make changes in your code, it will blink anyway.

besiek2510 (author)2016-11-26

part where you connect DPDT? 3 rotary switch? One wire from DPDT Connecting to the plates and the other to 3 rotary switch. please help. I still question how to connect LED understand from one leg to the plates and the other leg of the resistor and what else? please scheme of connecting or photo

xenophontis (author)2016-10-06

This is my build of the 5 pedal switcher.

I couldn't find the right size of enclosure. This one was hard to fit everything in. but i got it all to fit anyhow.

I've added an extra footswitch / LED to add an extra feature, like a boost or bypass all. I just havn't hooked it up yet. But the switcher is done for now.

CarraN (author)xenophontis2016-10-06

cool! yes it seem pretty little !
Do you observe some noise issues with your pedals on (mostly with overdrives)?
Did you use the Armando's code or mine?

xenophontis (author)CarraN2016-10-15

I used your code for this project. This looper only has a little noise from the relays as you mentioned, but this goes away with a buffer before. I didn't use any decoupling capacitors either. one of my distortion pedals creates a very small going noise, but it's too quiet to warrant using decoupling caps. Thanks for posting this project, it so much fun and very hand to have. On my pedal board.

LidioR (author)2016-10-05

Dear CarraN, congrats, wonderful project.

Can you please send me the final code, including this correction to make sure the memory will be there when boot it up?

Thanks in advance, Lidio (Brazil)

CarraN (author)LidioR2016-10-05


just place // before these two lines:

//for (int =0;i<512;i++)

that's all

ArmandoC26 (author)2016-10-05

Thx CarraN!!

Also the code has a different approach to the keypad library. I've found that in a normal setup the standard keypad function is checking the pins for H/L too often and, being this digital and audio together, I was experiencing clicking on the audio path. Slowing down the loop with a delay of 500ms, I could hear about 2 clicks almost every second, so after searching for a solution, I've found on the net this different approach to keyboard reading, that looks like has solved the ticking issue (see byte keypad() function toward the end of the code)

CarraN (author)ArmandoC262016-10-05

Hi Armando!
I've never experienced these clicks but I know some builders have done. On the other hand, I have some noise issue when engaging my OCD on the signal path. I think this is due to the bad quality of these chinese relay board but I'm not sure... Anyway, good job coding and building! I've seen your pedals page: nice!

ArmandoC26 (author)2016-10-05

... and sorry, it looks like I've 2 accounts ArmandoC26 and ArmandoC42... it's me in both case ;)

ArmandoC42 (author)2016-10-03



of course I can share the code, though it's about 900 line, don't wont to mess this board. I'll see if I can send it you via pm.

CarraN (author)ArmandoC422016-10-04


can you share your code with all? it's an instructable in the end...


ArmandoC42 (author)CarraN2016-10-04

Yes I can and will, just don't know how to attach a file here to be shared to all. Or should I post the whole programm as a reply? That's about 1000 lines!

See if you can access this link

ArmandoC42 (author)ArmandoC422016-10-04

Better ?

ArmandoC42 (author)2016-10-02

Hi! just to say thanks !!! I've based on this project my 6 channels looper. A video of it in action....

xenophontis (author)ArmandoC422016-10-03

well done! can you please share your arduino code? i like how you can program the preset without using a rotary switch. thanks!

CarraN (author)ArmandoC422016-10-02

Hi Armando!

cool! can I include your link to this instructable?


ArmandoC42 (author)CarraN2016-10-02

absolutely yes!


CarraN (author)ArmandoC422016-10-02

thank you too!

xenophontis (author)2016-09-24

One more question for you. After programming a preset to footswitches, should the relays go into bypass after hitting the switch again? Or does one of the present have to be set to all pedals off, to get a bypass mode?

xenophontis (author)2016-09-22

CarraN, how hard would it be to change this project, so that there is no read / write / select switch. But instead another momentary on/off footswitch. That would change from read mode to select mode. And the method of storing the preset was holding down the desired footswitch for 3 seconds?

CarraN (author)xenophontis2016-09-22


in the filosophy of this project here, this is not possible. My first attempt was on the way you want today but I didn't achieve it with arduino. Though I'm pretty sure it must be a way to do it... Ask about it on arduino forums.

ProjectL (author)2016-09-12

can I ask where did you get this cool looking switches?

ProjectL (author)2016-09-10

hi, I have build this on project board (replaced relays just with LED's) and every thing seems to be ok. I only have to sort out how to tweak it a bit. I will use only 4 effect loops, but need to have more presets... any ideas how to do it?

CarraN (author)ProjectL2016-09-11

It depens on how many presets you want... If there are equal to the number of switch you want to add the sketch is straight forward. If you want sort of bank you'll must do add two buttons and few changes on the sketch.


CarraN (author)2015-12-11

Ok! it seems like the onboard smd leds act as reverse as they should!
Have you tried with additional external leds as in the schem ? If your answer is yes, maybe you should add

for (int =0;i<512;i++){

in the setup() void of your code to initialize EEPROM. Because, by default all addresses are value 255 . Don't ask me why...

DaniP8 (author)2015-12-11

Well, I've no checked with a multimeter the outputs, but just connecting Arduino UNO (Low cost imitation) to 8-Relay Board, it stands all onboard smd red Leds light on, and when I select switches ('A' position ), selected ones turns off smd Led!

DaniP8 (author)2015-12-10

hey! I'm trying it as first Arduino project, an it's working at first tests! Thank's for the work and sharing knowledge!

in order to solve some aspects, why are the relays initialy open? onboard Led relays are HIGH!

CarraN (author)DaniP82015-12-10

Hi Dany!
are you saying me that all is working at reverse function?
Leds are normally lit and the relays on? I don't really understand

your question...

CarraN (author)2015-10-29

Hi all!

for persons with light arduino skills: to retain presets after boot up, just add "//" or delete these 2 setup lines

//for (int =0;i<512;i++)


It's here just for initialize EEPROM memory in case of debugging

JordanL6 (author)2015-04-06

Awesome project, dude! congrats!!
You considered using this relays " " ?

Another question... i have an arduino Mega, if i need 10 or 14 channels?


CarraN (author)JordanL62015-04-06

Hi jordan and thank you for your comment!

sure you can add more I/O depending on the patform you're using. Just adapt the code considering you'll need 3 inputs + 1/3 for tap input, 1/3 for output leds and the last 1/3 for output relays to keep it simple as previously wanted. Sadly with the Mega you'll can manage only 9 presets at max! Another solution is to combine 2 arduinos thru I2C communication but I still don't have a code solution for that ... (see my second instructable).

You can use any relays you want for this project, personaly I don't have found any cheaper than those on ebay ...


CarraN (author)2015-02-23

february 23- edit: changed configuration of relay connections, it works now!

anton.efremoff.1 (author)2015-02-02

problem. when I try to select a relay for High/Low - some times I need switch 2 times, for correct respond.

for ex. swith to low all relay and leds. then switch to HIGH 1-2-3-4-5 relays using only 1 push on each button. actually you will get a 1-3-5 or 2-4 relays in state HIGH - other will be in state low.

Do you have any idea how to solve it?


I solved it by myself. I think it can help somebody.

instead this:

case 'a': // a to e = select wich relay is HIGH/LOW

digitalWrite(10, ~state);

digitalWrite(15, ~state);

digitalWrite(10, state);

digitalWrite(15, state);


need to be this:

case 'a': // a to e = select wich relay is HIGH/LOW

digitalWrite(10, !digitalRead(10)); // Change the ledPin from Hi2Lo or Lo2Hi.

digitalWrite(15, !digitalRead(15));


for each select case (a,b,c,d,e) with specifing correspond digital pins.

CarraN (author)anton.efremoff.12015-02-02

thank you Anton! I just discover your question/answer about few minutes ago...

Did you realize all the project , I mean, including hardware? If so it will be cool if you can take some pictures I'll can had in this short tutorial. Actually I doesn't had enough time to build it myself (though I need to achieve it for personal use...)


anton.efremoff.1 (author)CarraN2015-02-02

Actually I made it on a test board, and for now - all works great. also I added a "all bypass" button - when you switch from "read" mode to "relay" mode - all relays is in stay as in bank, and when you try to change a on/off effect - it not correspond to real state of relay. "Bypass all" makes all relys and leds to "LOW", and allow to correct setup of device. Also this button help "reset"a current bank, if any thing happend. I will put project and photos later, when I finally build it.

CarraN (author)anton.efremoff.12015-02-02

yes maybe some kind of "reset" function can be added on sketch when turning the rotary selector, ie: when cases 'a' to 'e' -> void preset, when 'f' to ' j'-> void memory and 'k' to 'o' -> void read -> 'reset all' or something like this...

The philosophy of use is:

-choose the pedal to switch on

-> turn the memory mode ->

choose by exemple the preset 1

->return to relay mode, choose another pedal combination

->turn the memory mode

and select preset 2, etc...

When you have all the 5 presets memorized -> turn on read mode

Note that there is enough room in memory to add more presets : 255/5 = 51 but some sort of up/down buttons and maybe a double seven segment display must be added, and primary goal was SIMPLICITY! Not sure if it remains enough free pins though...

anton.efremoff.1 (author)CarraN2015-02-03

"The philosophy of use is:"

Yes, I expect a this behavior, but actually is:

-choose the pedal to switch on (ex - on-off-on-on-off)

-> turn the memory mode ->

choose by exemple the preset 1

->return to relay mode....

and in this step we have - 1 led is ON (a preset led). relays stay in on-off-on-on-off. When I try to enable first relay - the correspond led makes ON, but relay goes to OFF - other have a same behavior. And I have indocation which do not correct to relay state. )) so, I added a "bypass all" button. It's like a "Master Bypass" on passive switches. And the behavior of setup device look like this:

->Enable device.

->Enable "RELAY" mode

-> Press a "bypass all" button \\all leds and relays switch to LOW

->choose the pedal to switch on

-> turn the SAVE mode ->

-> choose by exemple the preset 1

->return to RELAY mode

->Press a "bypass all" button

->choose the pedal to switch on

->turn the SAVE mode

and select preset 2, etc...

After all preset memorized -> turn to "READ" mode.

5 buttons is presets and +1 button "Bypass All" - If I press it - I make a current preset to "bypass all" but - it not to change another presets, and not apply to current preset in memory. So I can fast move back - just press a preset button again.

CarraN (author)anton.efremoff.12015-02-04

That's it Anton!

I made modifications on the sketch based on your inputs.

Now you can store and go back to relay mode and all is reset. Pay attention to not press store switch more than once because it will reset the preset!

anton.efremoff.1 (author)CarraN2015-02-06

Yes, Thank you, Ialready made the same, but my guitarist said the it's not needed, if we have a "Master bypass" button. And this bypass feature more usefull than "clear all" after save.

One more thing - We need remember that A6 and A7 not work as Digital IO on arduino nano board (I used a A6 for Bypass All feature). For this IO we need add some "logic".

To upper script part -

int pinStateA6 = 0;

and in void loop() -

pinStateA6 = analogRead(A6) < 100 ? 0 : 1; //setup a analog input like digital using a basic C ternary operator.

if (pinStateA6 == HIGH) {

resetAll(); // turn all leds and relays to off. "Bypass All" button.


ResetAll - it's your function.

On schematic we need to add a aditional button on A6 from +5V. Also A6 input need to be conect to ground via resistor aroun 4.7KOhm.

Off course we can use a digital0 and digital1 IO, but on my board it is bisy for "Mute/TunerOut" finction. )) so, for now I have only A7 free ))

CarraN (author)anton.efremoff.12015-02-07

Nice tip about ternary operator! I wonder why arduino doesn't take it as a writing rule as it save a lot of line code...

CarraN (author)anton.efremoff.12015-02-06

My answer is it's not needed to have a "master bypass" button if we implement the resetAll function. More simpler though and you save pins for others functions... But thanks for the A6/A7 tip! I learn something right now!

CarraN (author)CarraN2015-02-06

I was thinking if you ABSOLUTELY want an hard "bypass all" function you can declare one free pins as INPUT_PULLUP (means it's permanently in HIGH state) and connect this pin on the double pole of the rotary wich the common is connected to ground. That way when you'll change from one mode to the other, this pin will can read momentary HiGH state you can assign to this function, ex: when pin X = high -> write all outputs to LOW. Maybe it helps...

Sasando_Rote (author)2015-02-02

keren om