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.

<p>In this picture you have a lighted LED ring around the foot switch.... where did you get these?</p>
<p>Try this: https://guitarpedalparts.com/product/3pdt-foot-switch-with-led-ring-red/ or search &quot;footswitch led ring&quot;</p>
<p>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.</p>
<p>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</p>
<p>This is my build of the 5 pedal switcher.</p><p>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. </p><p>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.</p>
cool! yes it seem pretty little !<br>Do you observe some noise issues with your pedals on (mostly with overdrives)?<br>Did you use the Armando's code or mine?<br>cheers
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.
<p>Dear CarraN, congrats, wonderful project.</p><p>Can you please send me the final code, including this correction to make sure the memory will be there when boot it up?</p><p>Thanks in advance, Lidio (Brazil)</p>
Hi<br><br>just place // before these two lines:<br><br>//for (int =0;i&lt;512;i++)<br>//EEPROM.write(i,0);<br><br>that's all
<p>Thx CarraN!!</p><p>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)</p>
Hi Armando!<br>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!<br>ciao!
<p>... and sorry, it looks like I've 2 accounts ArmandoC26 and ArmandoC42... it's me in both case ;)</p>
<p>thanks </p><p><a href="https://www.instructables.com/member/xenophontis" rel="nofollow">xenophontis</a><br></p><p>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.</p>
Yo!<br><br>can you share your code with all? it's an instructable in the end...<br><br>thanks!
<p>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!</p><p>See if you can access this link</p><p>http://media.wix.com/ugd/914253_e98e388d1ef14535b948603821d10bec.pdf</p>
<p>Better ?</p><p>https://drive.google.com/drive/folders/0ByzWvdNvN7jDRjh4cFlkM25BNTg?usp=sharing</p>
<p>Hi! just to say thanks !!! I've based on this project my 6 channels looper. A video of it in action.... </p><p>https://youtu.be/FT50IPzZUDc</p>
<p>well done! can you please share your arduino code? i like how you can program the preset without using a rotary switch. thanks!</p>
<p>Hi Armando!</p><p>cool! can I include your link to this instructable?</p><p>cheers</p>
<p>absolutely yes!</p><p>Thanks!<br></p>
<p>thank you too!</p>
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?
<p>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?</p>
<p>hi!</p><p>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.</p>
<p>can I ask where did you get this cool looking switches?</p>
<p>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?</p>
<p>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.</p><p>cheers</p>
Ok! it seems like the onboard smd leds act as reverse as they should!<br>Have you tried with additional external leds as in the schem ? If your answer is yes, maybe you should add <br><br>for (int =0;i&lt;512;i++){<br>EEPROM.write(i,0);}<br><br>in the setup() void of your code to initialize EEPROM. Because, by default all addresses are value 255 . Don't ask me why...
<p>hey! I'm trying it as first Arduino project, an it's working at first tests! Thank's for the work and sharing knowledge!</p><p>in order to solve some aspects, why are the relays initialy open? onboard Led relays are HIGH!</p>
<p>Hi Dany!<br>are you saying me that all is working at reverse function?<br>Leds are normally lit and the relays on? I don't really understand</p><p>your question...</p>
<p>Hi all!</p><p>for persons with light arduino skills: to retain presets after boot up, just add &quot;//&quot; or delete these 2 setup lines</p><p>//for (int =0;i&lt;512;i++)</p><p>//EEPROM.write(i,0);</p><p>It's here just for initialize EEPROM memory in case of debugging</p>
<p>Awesome project, dude! congrats!!<br>You considered using this relays &quot; <a href="http://www.mouser.com/ProductDetail/NEC-Tokin/EC2-5NJ/?qs=c5n%252bvICFHOZkIu8ma2yLxQ%3D%3D" rel="nofollow">http://www.mouser.com/ProductDetail/NEC-Tokin/EC2-...</a> &quot; ?</p><p>Another question... i have an arduino Mega, if i need 10 or 14 channels?</p><p>cheers!</p>
<p>Hi jordan and thank you for your comment!</p><p>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).</p><p>You can use any relays you want for this project, personaly I don't have found any cheaper than those on ebay ... </p><p><a href="http://www.ebay.com/sch/i.html?_from=R40&_trksid=m570.l1313&_nkw=8+relay&_sacat=0" rel="nofollow">http://www.ebay.com/sch/i.html?_from=R40&amp;_trksid=m...</a></p><p>cheers!</p>
<p>february 23- edit: changed configuration of relay connections, it works now!</p>
<p>problem. when I try to select a relay for High/Low - some times I need switch 2 times, for correct respond.</p><p>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. </p><p>Do you have any idea how to solve it?</p>
<p>I solved it by myself. I think it can help somebody.</p><p> instead this:</p><p>case 'a': // a to e = select wich relay is HIGH/LOW </p><p> digitalWrite(10, ~state); </p><p> digitalWrite(15, ~state); </p><p> digitalWrite(10, state); </p><p> digitalWrite(15, state); </p><p> break; </p><p> need to be this:</p><p>case 'a': // a to e = select wich relay is HIGH/LOW</p><p> digitalWrite(10, !digitalRead(10)); // Change the ledPin from Hi2Lo or Lo2Hi.</p><p> digitalWrite(15, !digitalRead(15));</p><p> break; </p><p>for each select case (a,b,c,d,e) with specifing correspond digital pins. </p>
<p>thank you Anton! I just discover your question/answer about few minutes ago... </p><p>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...)</p><p>cheers</p>
Actually I made it on a test board, and for now - all works great. also I added a &quot;all bypass&quot; button - when you switch from &quot;read&quot; mode to &quot;relay&quot; 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. &quot;Bypass all&quot; makes all relys and leds to &quot;LOW&quot;, and allow to correct setup of device. Also this button help &quot;reset&quot;a current bank, if any thing happend. I will put project and photos later, when I finally build it.
<p>yes maybe some kind of &quot;reset&quot; function can be added on sketch when turning the rotary selector, ie: when cases 'a' to 'e' -&gt; void preset, when 'f' to ' j'-&gt; void memory and 'k' to 'o' -&gt; void read -&gt; 'reset all' or something like this...</p><p>The philosophy of use is: </p><p>-choose the pedal to switch on </p><p>-&gt; turn the memory mode -&gt;</p><p>choose by exemple the preset 1</p><p>-&gt;return to relay mode, choose another pedal combination </p><p>-&gt;turn the memory mode </p><p>and select preset 2, etc...</p><p>When you have all the 5 presets memorized -&gt; turn on read mode </p><p>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...</p>
<p>&quot;The philosophy of use is:&quot;</p><p>Yes, I expect a this behavior, but actually is:</p><p>-choose the pedal to switch on (ex - on-off-on-on-off)</p><p>-&gt; turn the memory mode -&gt;</p><p>choose by exemple the preset 1</p><p>-&gt;return to relay mode....</p><p>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 &quot;bypass all&quot; button. It's like a &quot;Master Bypass&quot; on passive switches. And the behavior of setup device look like this:</p><p>-&gt;Enable device.</p><p>-&gt;Enable &quot;RELAY&quot; mode</p><p>-&gt; Press a &quot;bypass all&quot; button \\all leds and relays switch to LOW</p><p>-&gt;choose the pedal to switch on</p><p>-&gt; turn the SAVE mode -&gt;</p><p>-&gt; choose by exemple the preset 1</p><p>-&gt;return to RELAY mode</p><p>-&gt;Press a &quot;bypass all&quot; button</p><p>-&gt;choose the pedal to switch on</p><p>-&gt;turn the SAVE mode</p><p>and select preset 2, etc...</p><p>After all preset memorized -&gt; turn to &quot;READ&quot; mode.</p><p>5 buttons is presets and +1 button &quot;Bypass All&quot; - If I press it - I make a current preset to &quot;bypass all&quot; 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.</p>
<p>That's it Anton! </p><p>I made modifications on the sketch based on your inputs. </p><p>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!</p>
<p>Yes, Thank you, Ialready made the same, but my guitarist said the it's not needed, if we have a &quot;Master bypass&quot; button. And this bypass feature more usefull than &quot;clear all&quot; after save. </p><p>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 &quot;logic&quot;. </p><p>To upper script part - </p><p>int pinStateA6 = 0;</p><p>and in void loop() - </p><p> pinStateA6 = analogRead(A6) &lt; 100 ? 0 : 1; //setup a analog input like digital using a basic C <a href="https://en.wikipedia.org/wiki/Ternary_operator" rel="nofollow">ternary operator</a>. </p><p> if (pinStateA6 == HIGH) { </p><p>resetAll(); // turn all leds and relays to off. &quot;Bypass All&quot; button. </p><p> }</p><p>ResetAll - it's your function.</p><p>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.</p><p>Off course we can use a digital0 and digital1 IO, but on my board it is bisy for &quot;Mute/TunerOut&quot; finction. )) so, for now I have only A7 free ))</p>
<p>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...</p>
<p>My answer is it's not needed to have a &quot;master bypass&quot; 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!</p>
<p>I was thinking if you ABSOLUTELY want an hard &quot;bypass all&quot; 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 -&gt; write all outputs to LOW. Maybe it helps...</p>
keren om

About This Instructable




More by CarraN:Arduino Based Boss GP-10 Program Changer Programmable 8 Loops Pedal Switcher With Arduino Mega2560 arduino programable 5 pedal switcher 
Add instructable to: