last update: february 17 2016

This is the second part of my previous tutorial about how to do simple programable pedals switcher (or looper) now with a MEGA2560 Arduino to achieve 8 storable loops on 8 presets.

Note that is possible to improve the number of total loops. Just keep in mind that it add more lines to the code and more cost on hardware. That said, improving the possibilities in the mean time!

Number of max loops = total number of digital pins - 5 /3 (minus 3 pins for selecting mode and the two Rx/Tx)

In this tutorial we have 69 digital pins - 5 /3 = (21.33) so 21 loops available. Just think you can add more interesting options like increasing the number of presets, add a display or read pot values for expression pedals by exemple, thus decreasing the number of available loops. But frankly: "who needs 21 pedals on a pedalboard?"

Sure, they are...

Note: this project DON'T allows to reverse order of the pedals. This involves to matrix all that! That means: number of relays = (quantity of pedals) X (quantity of pedals)!!! and a lot of nightmares and disillusion! But actually you can consider 2 (or more) groups of loops, ie: one before the jack input of your amp and the other on the fx loop, if your amp is provided obviously! The only thing to do is to add a couple of chassis jack between two relays, the choice is yours. This is called the "breaking technique".

We can also use pin D1(Tx) for Midi communication.

So, in order to keep it as simple as wanted, see the schematic of this version of the project.


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...


-1 chinese Arduino Mega 2560 (keep your original for test other projects)

-8 momentary switches

-1 LM7805 regulator (5v.)

-1 three ways selector

-8 double relay modules or

-1 sixteen relays module (9 / 12 volts) or 1 eight dpdt relay bord (it's a lot expensiver)

-18 chassis 6.3 female jack (minimum) / 20 if you want to add the "breaking technique"

-1 9V-12v /3A power supply

-16 leds and 470 ohms resistors

-1 MIDI din + 1 220 ohms resistor (for optional MIDI out)

-spare cable or chinese Dupont wire (male to female)

(not included: the box)



-plyers/ cutter

-soldering station/ iron



-position "A" from the selector (cases a,b,c,d,e,f,g,h on the sketch) -> select wich pedal to loop ON (1,2... 8)

-position "B" (cases i,j,k,l,m,n,o,p) -> select the number of the preset (1 to 8) where you want to preserve the loops (the led of the preset you choose will lit 2 or 3 times)

-position "C" (cases q,r,s,t,u,v,w,x)-> read the preset (1 to 8) you stored previously

Watch it on youtube


needed Arduino library:


In case your LCD library doesn't work with this sketch, download these 2 libraries HERE

Step 1: Programmable MEGA2560 Arduino Based 8 Pedals Looper

You can even add some pot reading for expression pedals: there's enough room for it! Or even 8 more leds that can indicate wich effect loop is engaged when in "read" mode (in parallel to relays). Some follower suggested me to implement the possibility to select in wich "pre" or "post preamp" mode each effect can be selected (google for "4 cables" technique). This is also possible but adding a 16 relays module that will take more space and weight on the box. I suggest choosing "16 x DPDT relay module" to limit space waste but I must admit that I didn't found any cheap of these (~100$/piece) !

For this simple project, I suggest you to buy a cheap chinese copy of this board as you can find it for ~7$. You'll save your original board for arduino practicing.

So, here is the code for this beast as an example (choose your own pins):

Many thanx to PascalP3 to have corrected and improved this sketch!

Step 2: Hardware Building

Here's an example with 5 switches and 1 function selector and another 8 loops project by David B1 who gently share pictures of his great job! Thanks to him.

<p>Hello</p><p>Really impressive work, thanks to CarraN, also PascalP3 and now mikeganz.</p><p>Looking<br> to build this shortly (waiting for parts) and happily noticed <br>mikeganz's addition to the project. Bank support!! Awesome feature, <br>thanks for your work.</p>
Everyone is welcome but pay attention that mikeganz have actually an issue with his code... (see commentaries)<br><br>cheers<br><br>carran
<p>Hi there! I've been working through this and have come up with a few things. </p><p>1) Banks! I figured out some math that allows banks for easy storage with only one extra button/switch. I can share if you like. </p><p>2) I put together some code to allow for 2 buttons/switches and 2 relays to control read/program loops/program preset instead of using a rotary switch. Again, happy to share... </p><p>HOWEVER - I'm trying to get this to use 16 loops, and that's not working. With 10 loops, where &quot;i&quot; is always a single digit, it works great - but with 11 or more, where &quot;i&quot; is a double digit, it is running the loop constantly because it is reading each digit separately (e.g. 1 and 1, 1 and 2, 1 and 3 instead of 11, 12, 13, etc. &mdash; this is my theory anyway). </p><p>Any insight on how this might be fixed? </p>
<p>Hi!</p><p>please can you send us a brief schematic because I don't understand what's not working on your project. Is it the display or selector or what?</p><p>cheers</p>
<p>The issue isn't in the schematic... 10 or less loops, and your program works perfectly. From 11 or more loops, the program stops working properly. I think it's in the number of loops vs. keypad rows. </p><p>Your instruction said this could go up to 21 loops (or 0 to 20), but as soon as you get more than 10 (or 0 to 9), the whole program hangs up. Some debugging is showing me that it's possible the &quot;char keys[rows][cols] = {&quot; line is only using the first number in &quot;byte rows&quot; (in my case, 1 instead of 16) because it's not set for a 2 digit number, and I'm not sure how to make that work. </p><p>Running a serial line in Void Setup to see what &quot;i&quot; produces shows there is no issue there with 2 digit numbers, so I think that the keypad itself isn't setup to handle more than 10 rows (as it is set from 0 to 9).</p><p>This issue has the butterfly effect of having all these pins set for the keypad with nothing to use them for - thus the writeOut and memory functions hang up, and the readPreset mode doesn't work at all. It just keeps cycling through everything. </p><p>I may have a workaround for my specific issue, but it won't work for anyone with more than 10 loops. Does that make sense? </p>
<p>I don't think (but I'm not 100% sure though) the keypad library is limited to n caracters, except the by the max of ascii caracters available in keyboards, of course! check the keypad library.</p><p>So you're telling me that when you select the loop 11 by exemple, relay 11 doesn't work! is that right?</p>
Hi Mike!<br><br>send us your code and we'll see ehat's going on.<br><br>cheers<br><br>carran
<p>Hi CarraN! Code is below (doesn't include the 2 relays for programming yet. I also removed the midi stuff because it is not needed for what I'm doing, and I need every single pin I can get, hehe):</p><p>#include &lt;LiquidCrystal.h&gt;</p><p>#include &lt;Wire.h&gt;</p><p>#include &lt;EEPROM.h&gt;</p><p>#include &lt;Keypad.h&gt;</p><p>LiquidCrystal lcd(13, 12, 11, 10, 9, 8);</p><p>const int bankButton = 53; //Pin for Bank Button</p><p>const byte rows = 16;</p><p>const byte cols = 3;</p><p>char keys[rows][cols] = {</p><p> {'a','q','7'},</p><p> {'b','r','8'},</p><p> {'c','s','9'},</p><p> {'d','t','0'},</p><p> {'e','u','~'},</p><p> {'f','v','!'},</p><p> {'g','w','@'},</p><p> {'h','x','#'}, </p><p> {'i','y','$'},</p><p> {'j','z','%'},</p><p> {'k','1','^'},</p><p> {'l','2','&amp;'},</p><p> {'m','3','*'},</p><p> {'n','4','('},</p><p> {'o','5',')'},</p><p> {'p','6','+'} </p><p>};</p><p>byte rowPins[rows] = {30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45};</p><p>byte colPins[cols] = {46,47,48};</p><p>Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, rows, cols);</p><p>int relayPin[16] = {14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29};</p><p>int ledPin[16] = {A0,A1,2,3,4,5,6,7,A8,A9,A10,A11,A12,A13,A14,A15};</p><p>int i;</p><p>int readOut;</p><p>int numberOfPedal = 16;</p><p>int bankVariable = 20;</p><p>int numberOfBanks = 5;</p><p>int bank = 0; //Starting Bank Number</p><p>boolean lastBankButton = LOW;</p><p>boolean currentBankButton = LOW;</p><p>/* SETUP */</p><p>void setup() {</p><p>lcd.begin (16,2); </p><p>lcd.print(&quot;Line 1&quot;);</p><p>lcd.setCursor(0,1);</p><p>lcd.print(&quot;Line 2&quot;);</p><p>for(i=0; i&lt;numberOfPedal; i++) {</p><p> pinMode(relayPin[i], OUTPUT); </p><p> pinMode(ledPin[i], OUTPUT);</p><p> digitalWrite(relayPin[i],LOW); //turn ON all relays</p><p> digitalWrite(ledPin[i],LOW); //turn ON all preset LEDs</p><p> };</p><p> delay(500);</p><p> for(i=0; i&lt;numberOfPedal; i++) {</p><p> pinMode(relayPin[i], OUTPUT); </p><p> pinMode(ledPin[i], OUTPUT);</p><p> digitalWrite(relayPin[i],HIGH); //turn OFF all relays</p><p> digitalWrite(ledPin[i],HIGH); //turn OFF all preset LEDs</p><p> };</p><p> pinMode(bankButton, INPUT);</p><p> Serial.begin(9600);</p><p>delay(1000);</p><p>lcd.clear();</p><p>lcd.print(&quot;Press any preset&quot;);</p><p>lcd.setCursor(0,1);</p><p>lcd.print(&quot;to start&quot;);</p><p>delay(1000);</p><p>}</p><p>/* Bank Button Debounce */</p><p>boolean bankdebounce(boolean last) {</p><p> boolean current = digitalRead(bankButton);</p><p> if (last != current) {</p><p> delay(5);</p><p> current = digitalRead(bankButton);</p><p> }</p><p> return current;</p><p>}</p><p>/* LOOP */</p><p>void loop() {</p><p> currentBankButton = bankdebounce(lastBankButton); </p><p> if (lastBankButton == LOW &amp;&amp; currentBankButton == HIGH) {</p><p> bank ++;</p><p> lcd.clear();</p><p> lcd.print(&quot;Bank &quot;);</p><p> lcd.print(bank);</p><p> lcd.setCursor(0,1);</p><p> lcd.print(&quot;Press Any Preset&quot;);</p><p> if (bank &gt;= numberOfBanks) {</p><p> bank = 0;</p><p> }</p><p> }</p><p> lastBankButton = currentBankButton;</p><p> char key = keypad.getKey();</p><p> if(key) { // Check for a valid key.</p><p> switch (key) {</p><p> case 'a': writeOut(0);</p><p> break;</p><p> case 'b': writeOut(1);</p><p> break;</p><p> case 'c': writeOut(2);</p><p> break;</p><p> case 'd': writeOut(3);</p><p> break;</p><p> case 'e': writeOut(4);</p><p> break;</p><p> case 'f': writeOut(5);</p><p> break;</p><p> case 'g': writeOut(6);</p><p> break;</p><p> case 'h': writeOut(7);</p><p> break;</p><p> case 'i': writeOut(8);</p><p> break;</p><p> case 'j': writeOut(9);</p><p> break;</p><p> case 'k': writeOut(10);</p><p> break;</p><p> case 'l': writeOut(11);</p><p> break;</p><p> case 'm': writeOut(12);</p><p> break;</p><p> case 'n': writeOut(13);</p><p> break;</p><p> case 'o': writeOut(14);</p><p> break;</p><p> case 'p': writeOut(15);</p><p> break; </p><p> case 'q': memory(100+(bank*bankVariable),0);</p><p> break;</p><p> case 'r': memory(200+(bank*bankVariable),1);</p><p> break;</p><p> case 's': memory(300+(bank*bankVariable),2);</p><p> break;</p><p> case 't': memory(400+(bank*bankVariable),3);</p><p> break;</p><p> case 'u': memory(500+(bank*bankVariable),4);</p><p> break;</p><p> case 'v': memory(600+(bank*bankVariable),5);</p><p> break;</p><p> case 'w': memory(700+(bank*bankVariable),6);</p><p> break;</p><p> case 'x': memory(800+(bank*bankVariable),7);</p><p> break;</p><p> case 'y': memory(900+(bank*bankVariable),8);</p><p> break;</p><p> case 'z': memory(1000+(bank*bankVariable),9);</p><p> break;</p><p> case '1': memory(1100+(bank*bankVariable),10);</p><p> break;</p><p> case '2': memory(1200+(bank*bankVariable),11);</p><p> break;</p><p> case '3': memory(1300+(bank*bankVariable),12);</p><p> break;</p><p> case '4': memory(1400+(bank*bankVariable),13);</p><p> break;</p><p> case '5': memory(1500+(bank*bankVariable),14);</p><p> break;</p><p> case '6': memory(1600+(bank*bankVariable),15);</p><p> break;</p><p> case '7': readPreset(100+(bank*bankVariable),0); </p><p> break;</p><p> case '8': readPreset(200+(bank*bankVariable),1);</p><p> break;</p><p> case '9': readPreset(300+(bank*bankVariable),2);</p><p> break;</p><p> case '0': readPreset(400+(bank*bankVariable),3);</p><p> break;</p><p> case '~': readPreset(500+(bank*bankVariable),4);</p><p> break;</p><p> case '!': readPreset(600+(bank*bankVariable),5);</p><p> break;</p><p> case '@': readPreset(700+(bank*bankVariable),6);</p><p> break;</p><p> case '#': readPreset(800+(bank*bankVariable),7);</p><p> break;</p><p> case '$': readPreset(900+(bank*bankVariable),8);</p><p> break;</p><p> case '%': readPreset(1000+(bank*bankVariable),9);</p><p> break;</p><p> case '^': readPreset(1100+(bank*bankVariable),10);</p><p> break;</p><p> case '&amp;': readPreset(1200+(bank*bankVariable),11);</p><p> break;</p><p> case '*': readPreset(1300+(bank*bankVariable),12);</p><p> break;</p><p> case '(': readPreset(1400+(bank*bankVariable),13);</p><p> break;</p><p> case ')': readPreset(1500+(bank*bankVariable),14);</p><p> break;</p><p> case '+': readPreset(1600+(bank*bankVariable),15);</p><p> break;</p><p> }</p><p> }</p><p>}</p><p>/* Use Presets */</p><p>void readPreset(int addr, int led) {</p><p> for(i=0; i&lt;numberOfPedal; i++) {</p><p> digitalWrite(relayPin[i], EEPROM.read((addr)+i));</p><p> digitalWrite(ledPin[i], HIGH);</p><p> digitalWrite(ledPin[led], LOW);</p><p> }</p><p> lcd.clear();</p><p> lcd.print(&quot;Current Bank: &quot;);</p><p> lcd.print(bank);</p><p> lcd.setCursor(0,1);</p><p> lcd.print(&quot;Preset: &quot;);</p><p> lcd.print(led + 1);</p><p>}</p><p>/* Select Preset and Store */</p><p>void memory(int addr, int led) {</p><p> for(i=0; i&lt;numberOfPedal; i++) {</p><p> EEPROM.write((addr) + i, digitalRead(relayPin[i]));</p><p> digitalWrite(ledPin[i], HIGH);</p><p> }</p><p>lcd.clear();</p><p>lcd.print(&quot;Program saved to&quot;);</p><p>lcd.setCursor(0,1);</p><p>lcd.print(&quot;Bank &quot;);</p><p>lcd.print(bank);</p><p>lcd.print(&quot;, Preset &quot;);</p><p>lcd.print(led + 1);</p><p>digitalWrite(ledPin[led], HIGH);</p><p>delay(100);</p><p>digitalWrite(ledPin[led], LOW);</p><p>delay(100);</p><p>digitalWrite(ledPin[led], HIGH);</p><p>delay(100);</p><p>digitalWrite(ledPin[led], LOW);</p><p>delay(100);</p><p>digitalWrite(ledPin[led], HIGH);</p><p>delay(100);</p><p>digitalWrite(ledPin[led], LOW);</p><p>delay(100);</p><p>digitalWrite(ledPin[led], HIGH);</p><p>lcd.clear();</p><p>}</p><p>/* Choose Loops/Relays */</p><p>void writeOut(int relay)</p><p>{</p><p> digitalWrite(relayPin[relay], !digitalRead(relayPin[relay]));</p><p> //digitalWrite(ledPin[relay], !digitalRead(relayPin[relay]));</p><p> lcd.clear();</p><p> lcd.print(&quot;Current Bank: &quot;);</p><p> lcd.print(bank);</p><p> lcd.setCursor(0,1);</p><p> lcd.print(&quot;Choose Loops: &quot;);</p><p> lcd.print(relay + 1);</p><p>}</p>
<p>Hi CarraN, <br><br>I'm a complete newbie on the arduino world, and I'm also a guitar player :) <br>I'd like to control 10 loops with thin project. Can you give me a hand with the code, please?<br>Also,<br> is it possible to add some kind of control over the text that is <br>displayed? Maybe costumize the name of the preset, change the midi PC <br>message...<br><br>If you could help me, I'd be very gratefull <br>Cheers! <br>Mike</p>
Hola Miguel<br><br>all you need is in this instructable. The display stuff is a follower's addon of the initial project that I've included in the code but without any waranty from my part. So if you have a specific question you can still post here, maybe someone can will help you! <br>I suggest reading first some comments related to.<br><br>hope this will help<br><br>cheers<br><br>carran<br><br>
<p>Can this looper be use as footswitch? I mean changing loops AND amp channels?</p>
yes it can! Just wire off those amp channel relays! Similar to the &quot;breaking technique&quot; explained on this instructable.<br><br>cheers
I've checked YouTube videos and there is a big delay between button press and changing loop. It's unavoidable?
<p>Hi!</p><p>no problem of any latency on my side! You'll do not have neither!</p><p>Youtube isn't lip synching accurate, maybe you 've experienced this...</p>
<p>Hi,<br>I show my 2nd job so far<br>Project is like your view still can work in process and not ready, but basically you can see how it will eventually.<br>The design is based on my Amp.</p>
<p>Hi Aranius,</p><p>I'm german too. Did you have a homepage, you wrote earlier. Kann ich mit Dir in Kontakt treten bez&uuml;glich Deines Arduino loop-Switcher Projektes. Ich m&ouml;chte mir auch selbst eines bauen. Gr&uuml;&szlig;e</p><p>Bernhard</p>
<p>Hi Aranius!</p><p>did you solve your noise issues?</p>
Hi carran. Yes. The noise comes Form my fuzz strompbox....
<p>how to connect selectror? For Arduino ports 30,31,31 and beyond? I will ask about the photo</p>
<p>the common is connected to all the switches and the 3 others respectively to pins 30 31 32 , but you decide: there 're plenty of free pins on this project.</p>
<p>Hi,</p><p>does this switcher work as a loop switcher and could be used in preset mode when need?</p>
hi!<br><br>yes and yes!<br>
<p>and as i understand, it could control a software like guitar rig via midi output? any news about noise issue? is this DPDT relay module ok for this project? maybe it could solve the noise issue <a href="http://www.ebay.co.uk/itm/5V-DPDT-Relay-Module-Polarity-reversal-switch-Board-F-Arduino-uno-r3-MEGA-2560-/252475636633" rel="nofollow">http://www.ebay.co.uk/itm/5V-DPDT-Relay-Module-Pol...</a></p>
Hello, how are you? I did the tutorial as images, is working but is very sizzling. You know what can be? thank you.
<p>please, see below!</p>
<p>Hi!</p><p>yes, noise appears to be an issue on this project. Some suggestions where told here in these comments. Like putting some resistances, decoupling with caps and using shielded cables but frankly I tried it all and it remains noisy... sorry. The only way it seems to work for me is putting a buffer before the input. </p><p>Now, I cannot tell you why your sound is louder (?!!) it's a passive system...</p><p>cheers</p>
<p>Hi! I made this project, but I have two questions: Connecting the guitar to the amplifier, the volume seems louder: how can I raise output volume? On the other hand, when I press the buttons to activate/deactivate relays, I heard a little pop in the amplifier: how can I resolve it?</p><p>Thank you</p>
Good evening, I am Brazilian and I do not speak English very well. I'm trying to do the 8 loops. by these images and text lack much information. how to connect the display, how to connect the guitar in and out so the amp if the LEDs need to use capacitors. this pdf for download there is a full tutorial or is the same thing that is written here. thanks for listening.
It has a video on youtube showing how it works?
not yet!<br><br>cheers
<p>Thanks CarraN for a fantastic project (and your help) this is my finished looper hope you like it. </p>
<p>wow! welldoneman ! you're an hardware master! </p>
<p>My Looper in its new home among my other home made effects pedals(5 pedals above the looper) thanks again CarraN</p>
You're welcome !<br>Cheers!
<p>Hi! I'm trying to build it, but I don't understand one thing: Are the two relay pins bridged for switch on or off the couple of relays in the same time?</p><p>Thank you.</p>
<p>but could easily be replaced by one DPDT relay! but they're a lot expensivier!</p>
Thank you! I've already bought a 16 relay board with 20 euros, so I think it's OK forma my project! :)
<p>It work Perfectly :-) Ive just got to put in all the jack sockets and I think I will put a true bypass foot switch on it as well. Thanks again</p>
nice! but why put a true bypass switch, it's already true bypass...
<p>Thank you so much CarraN that has sorted it you are a Legend. my fault for not reading the schematic properly, and it was clear on your schematic Thanks again this project is awsome.</p>
you're welcome man! Does it work now? <br>cheers
Hi <br>They appear to have the same voltage as the other switches. just to clarify pins 30,31,32 on the sketch go to 1,2,3 position pin on the selector switch and the center terminals of the switch go to Ground is this correct? again thanks for the help<br>
<p>No, no!!! None of the switch pins goes to ground. Please check again the schematic !</p><p>There are 8 (or the number of loops you choose, it's yours) pins going to 8 contacts and the common contacts pins go to the selector's center terminal. Then the selector goes to 3 differents ways (and pins of the board). I think it's clear in the schem...</p>
<p>Thanks for the quick reply </p><p>Should the voltage on the selector pin that is in operation read around 5 volts as mine only read 0.4 volts</p>
<p>mmmhh... not sure about that. Try to read when pushing some button and tell me.</p>
<p>Hi </p><p>I have built this but im having trouble with the selecting the 3 positions for programming, if you keep pressing a foot switch it eventually flashes and &quot;Stored&quot; is displayed on the LCD keep pressing the same switch more and the word preset is displayed on the LCD, if I follow the how to use, it dose not change no matter which function the switch is turned to.....any advice????</p>
Hi!<br><br>1) check out the 3 selector pin numbers on board and see if it match with your sketch (current error)<br>2) same thing with other pins<br>3) check the pins of the selector switch itself, if you have contact checker in your multimeter, it will help!<br><br>hope it helps!<br><br>cheers
<p>Anybody have any video on how this works ?</p>
<p>Hi,<br>I have again been thinking the idea of the changes.<br>I will make now the following:<br>Since my AMP a channel switch and a switchable Boost has, I'm here to replace the footswitch and integrate my Ralais this in Looper.<br>In addition, I would like the &quot;Braking Technique&quot; change meaning that I can turn my Ralis whether the &quot;group B&quot; in the FX loop of the amp or does not.<br>A scheme for this I'm going to create at the weekend and show here.<br>Possibly for me would still Switchable A-B switch useful to choose between two guitars. But here I'll probably still may think about another solution.<br>I would also like the housing substantially smaller (previous size 500mm x 215mm. New housing 600mm x 80mm) designed. The planning of the case do I do with InkScape.<br>The procedure for the banks I have I not found a sensible solution ....<br><br>greeting<br>Peter</p>

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: