Programmable 8 Loops Pedal Switcher With Arduino Mega2560





Introduction: Programmable 8 Loops Pedal Switcher With Arduino Mega2560

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. I recommend to take it a view for the coding part explanation and how the things are tight together.

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 51 digital pins - 3 = 48 / 3 so 16 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 16 pedals on a pedalboard?"

Sure, they are...

AVOID using analog pins named A0 to A15, just use the digital ones! (2 to 53) See the MEGA2560 pinout

Note: this project DOESN'T allow 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:


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.


check out some outstanding bands I play with


Cosmic Rain

6 People Made This Project!


  • Oil Contest

    Oil Contest
  • Creative Misuse Contest

    Creative Misuse Contest
  • Water Contest

    Water Contest

158 Discussions

I have noticed a few people in the comments talking about having to give up on this because they could not solve the noise issue. I have mine working almost silent. Any noise you do hear is so low compared to the volume of the instrument that unless you were sitting there repeatedly hitting a switch without playing a note, you MIGHT hear it. I have also completely eliminated any interference and buzz or hum that comes along with it. Without decoupling caps, resistors, shielded cable or any of that stuff.

In my case the secret was simply connecting to an actual earth ground.

I have a 120v standard computer mains inlet in the back of my case, from there is a typical 12v transformer I stole from a wall wart power adapter. Connect that to an lm7805 and 7809 ( 5 to power relays, 9 to power the MEGA R3. While also keeping the MEGA behind its own 5v regulator for added safety.

But yeah this thing was a noisy piece of crap just using wall warts and regulators, once I brought a 3 prong mains cord into the case and attached all the "ground" wires to an actual earth ground and not just the negative pole on an AC/DC adapter, thing went dead silent and sounds brilliant. I am also using low signal relays. I just went to my local electronics surplus and bought a bunch of 5v relays that can handle a max of like 0.037A, made my own driver board for them and yep works like a charm, I would have no problem using this live now and even with my sovtek bigmuff the click is barely noticeable, you could have to know exactly what you are listening for to notice it. For reference the relays I am using: are CP Clare LSR 2C05.

MFR:CP Clare



SKU No.204184

Hope this helps someone out.

1 reply

Thanks to share Kyle!

I'm convinced about how better are the low signal relays and the quality of the power! Nice job with a computer supply indeed!




Question 5 months ago


I managed to cnnect the led's that lights up when the pedals are pressed, however, on the youtube video it shows someone programming the presets and there are more led's ... i noticed in the parts list you listed 16 led's. I am assuming some are related to the saving of presets. I am unsure where to connect these extra led's. Could you please help me. My screen now lights up but nothing written on it so I am having problems with that as well. Not sure why there is nothing showing. When I unplug everything and try just the screen with the arduino, i can get the "hello world". I assuming it is in the programming and compatibility with my screen.

Please help me.

1 more answer

Hi all,

Just a quick update. After having no luck trying to get some answers with regards to the LCD issue I was having, I reverted to going to the official Arduino forum. There is a guy there called Bill (username Bperrybap) who was absolutely amazing and managed to help guide me in the right direction in order to solve this issue. I am posting a link here as to what was done to rectify the problem I was having.

In my struggles I have posted something below with regardsto changing the pin names for example changing EN to E in the programming. This is absolutely not necessary.

My main issue was with the fact that the LCD i bought was a 16 pin wired directly to the arduina, whilst the library for the I2C lcd was totally different.

In the beginning I had no clue that the lcd I bought was totally different to an lcd that has an I2c board attached. Something to watch out for. If ythe code you are trying to use, uses an I2C library please buy and I2C lcd to save yourself a lot of hassle. I am slowly getting to grips with all the programming but it takes time and that is the fun of it all.

Many thanks to CarraN here as well.



Question 5 months ago

I am struggling with the connection of the Liquid crystal display. mine has these pins on there and I am not sure where/how to connect it in as there is no mention of the screen in the diagrams.

1 VSS VDD VO RS RW E D0 D1 D2 D3 D4 D5 D6 D7 A K 16

With regards to your code, which pins above connect with which pins on the mega board?


1 more answer

I managed to work it out. The trick is in how they are labelled by e\ch manufacturer. Mine has E instead of EN so in the code this needs to read E and not EN.



Tip 5 months ago

m I doing anything wrong or have I got a dead lcd to start with?

I have been looking at the coding for this and one question that comes to mind is this:
How does the arduino mega know that pin A13 A14 A15 have a three way switch connected to it? I cannot see any reference in the coding that refers to A13 A14 or A15.

Just trying to understand how this works

5 more answers

Hi CarraN,

Just to clarify, in the code it says this:

byte rowPins[rows] = {22, 23, 24,25, 26,27, 28, 29}; /*relay pins 1 to 8 */
byte colPins[cols] = {30, 31, 32}; /*selector pins a to h/ i to p/ q to x */
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, rows, cols);
int relayPin[8] = {33,34,35,36,37,38,39,40};
int ledPin[8] = {41,42,43,44,45,46,47,48};
byte midiChannel = 0;
int i;
int readOut;
int numberOfPedal = 8; /*adapt this number to your needs = number of loop pedals */

So in theory this line should read Footswitch es pins 1-8 .... It says relay and I am guessing it is just a typing error.

byte rowPins[rows] = {22, 23, 24,25, 26,27, 28, 29}; /*relay pins 1 to 8 */

Hi CarraN,

Thanks for the info regarding the pins. The diagram threw me off and i thought the relays connected to the A0, A1 etc... I got that part now.

So for example, let us take the first push button. The push buttons I have only have two connections on there. When one side of the push button is connected to pin 22, where does the other lug on the push button connect to.

If you have the time maybe a diagram on the actual physical connection of switched and Jack connectors would be a great help.

I have sorted out the relay now. There was nothing wrong with it, however, it only works if I use the installed version of arduino 1.8.5 .... when I use the online editor nothing works. It compiles but appears not to push the code to the arduino board. Not sure why, but I am happy using 1.8.5.

You are a great help and please keep up the good work. From my questions and your answers, in tyhe last two days I have a much better understanding how this works. As I said a diagram of the physical wiring would be all that I am missing.


OK I see you' re completly lost. Did you check all the pins that are on the code?
byte rowPins[rows] = {22, 23, 24,25, 26,27, 28, 29}; /*footswitches pins 1 to 8 */
byte colPins[cols] = {30, 31, 32}; /*selector pins a to h/ i to p/ q to x */
Remember it' s all yours if you want to change these, just adapt your code! If the footswitch 1 is connected to pin 22, your code MUST to tell 22!!! you get the idea?
The same for relays and all that is connected to your MEGA, it must to match to your code. And don't forget that ports A0 to A15 are analog inputs, so don't use them but instead the ports 2 to 52 that are DIGITAL ports!

I am well and truly stuck. not sure if it is the switch I bought. It only has two lugs on it. connected at least two relays to the arduino. Everything powers up but activating the switch does not kick in the relay at all. Also I do not have the voltage regulator yet so I am trying to power everything from the Arduino mega.
So far no overheating or anything. I have connected one guitar pedal on relay 1 and then sent that signal straight to the amp just to confirm it will work. I can hear my guitar through the amp and can hear the noise coming from the switch. However, no noise from the relay to make me think the relay is switching. I have tried powering the relay from a separate power supply (5v 2A). Still no switching.

just the instructable , it's all in there!


Question 5 months ago

I just followed this video on youtube to test my relay module and not a single light on it comes on!! Does that mean it is a faulty module? should there be lights on there?

I am confused with the additional voltage regulator that is needed between the arduino and the relays. Where does that go on the board? or is it just floating around whilst being grounded to the chasis which is metal?



5 replies

fix it on the chassis, just take care that the other pins don't touch it (the chassis) or it will blow! The central leg is the same as the radiating part of the regulator so you can leave it off or ground it, it's yours. In the schematic it doesn' t appears but you can add one capacitor (100n/50v. typically) between input and ground and another (~10uF/25v) between output and ground. Good luck!

Thanks for that. I am using 8 relays, on one single board. Do I need 8 regulators?

Ok Many thanks for your quick replies. Will keep everyone updated. Some of the parts should be here today.

Programming is scarey though.

Another quick question. On the voltage regulator, there are 3 pins. Pin3 is connected to the 5volt of the arduino, pin 2 is ground, where do I connect pin 1.
Not sure from the diagram but it seems to connect to the main external power (9v to 18v) that comes into the Arduino from a power supply. Am I reading this correctly?

I have also seen on Amazon this board

Can I use that instead of just a voltage regulator?