Introduction: Programmable 8 Loops Pedal Switcher With Arduino Mega2560

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

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

______________________________________________________

Hardware:
-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)

______________________________________________________

Tools:

-plyers/ cutter

-soldering station/ iron

______________________________________________________

USE:

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

keypad.h

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

Picture of 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

Picture of 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

ZeK

Cosmic Rain

Comments

tanjin (author)2017-08-09

Can I create infinite patches for the 8 pedal loops? How would I do that? Thanks!

CarraN (author)tanjin2017-08-09

hey!

what do you mean about infinite patches?

tanjin (author)CarraN2017-08-10

I'm sorry, I mean "presets"! For example, in a gig I have 30 songs, each one with different pedal combinations, can I have 30 presets for each song?

Many thanks!

CarraN (author)tanjin2017-08-12

30 x 30 = 900 memory presets in a MEGA2560?


The eeprom has 4kB, so 4000 /8 = 500.
Sadly, it'll miss 400 places of presets the way memory is managed in this project...
One solution could be to write the eight relays states in a bit, by ex:
00010010, 11101100, etc... But I must admit that 's something that I've not achieved, though I KNOW it's possible. In this case you could have 4000 memory preset.
Other one is adding more memory to the Arduino. There are plenty of tutorials out there.


cheers

ps:If you find the solution you're welcome to share

davey.young (author)2017-07-05

will this project be capable of switching amp channels as well as different loops? I'm trying to find something that will for instance...go from dirty channel on amp, to clean with lets say a chorus and delay with one click, then with another button switch to dirty channel with delay.

CarraN (author)davey.young2017-07-06

hey

yes it can with a bit of mods!

cheers

CarraN (author)2017-05-27

Hi Pascal!

yes, I let it down for the same reason, though the noise appears only with distortion pedal, and I guess those chinese relays are not so friendly with audio. If I remember, putting a booster signal pedal before the switcher threw out this noise issue for a large part but not entirely... It will be interesting to see how many people achieved it without any sound issues. Some build are very impressive!

Hope you'll get it!

cheers

PascalP3 (author)2017-05-27

Hi CarraN,

It's been a while since i checked in. The last i worked on,was trying to get rid of the clicks of the relays in the audio line. Unfortunately i did not succeed and got quite discouraged. So the project ended up on a shelf in the attic. I'm wondering if anybody experience similar problems and if they managed to solve it...

I'm thinking about using audio relays which are much smaller too.

Also i've looking at the possibilities of using the CD4053 integrated circuit which should be noiseless (at least without relay clicks...)

Looking forward to some usefull input.

best regards,Pascal

bassleigh (author)2017-05-11

Hello

Really impressive work, thanks to CarraN, also PascalP3 and now mikeganz.

Looking
to build this shortly (waiting for parts) and happily noticed
mikeganz's addition to the project. Bank support!! Awesome feature,
thanks for your work.

CarraN (author)bassleigh2017-05-11

Everyone is welcome but pay attention that mikeganz have actually an issue with his code... (see commentaries)

cheers

carran

mikeganz (author)2017-05-07

Hi there! I've been working through this and have come up with a few things.

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.

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

HOWEVER - I'm trying to get this to use 16 loops, and that's not working. With 10 loops, where "i" is always a single digit, it works great - but with 11 or more, where "i" 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. — this is my theory anyway).

Any insight on how this might be fixed?

CarraN (author)mikeganz2017-05-09

Hi!

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?

cheers

mikeganz (author)CarraN2017-05-09

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.

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 "char keys[rows][cols] = {" line is only using the first number in "byte rows" (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.

Running a serial line in Void Setup to see what "i" 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).

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.

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?

CarraN (author)mikeganz2017-05-10

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.

So you're telling me that when you select the loop 11 by exemple, relay 11 doesn't work! is that right?

CarraN (author)mikeganz2017-05-08

Hi Mike!

send us your code and we'll see ehat's going on.

cheers

carran

mikeganz (author)CarraN2017-05-08

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):

#include <LiquidCrystal.h>

#include <Wire.h>

#include <EEPROM.h>

#include <Keypad.h>

LiquidCrystal lcd(13, 12, 11, 10, 9, 8);

const int bankButton = 53; //Pin for Bank Button

const byte rows = 16;

const byte cols = 3;

char keys[rows][cols] = {

{'a','q','7'},

{'b','r','8'},

{'c','s','9'},

{'d','t','0'},

{'e','u','~'},

{'f','v','!'},

{'g','w','@'},

{'h','x','#'},

{'i','y','$'},

{'j','z','%'},

{'k','1','^'},

{'l','2','&'},

{'m','3','*'},

{'n','4','('},

{'o','5',')'},

{'p','6','+'}

};

byte rowPins[rows] = {30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45};

byte colPins[cols] = {46,47,48};

Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, rows, cols);

int relayPin[16] = {14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29};

int ledPin[16] = {A0,A1,2,3,4,5,6,7,A8,A9,A10,A11,A12,A13,A14,A15};

int i;

int readOut;

int numberOfPedal = 16;

int bankVariable = 20;

int numberOfBanks = 5;

int bank = 0; //Starting Bank Number

boolean lastBankButton = LOW;

boolean currentBankButton = LOW;

/* SETUP */

void setup() {

lcd.begin (16,2);

lcd.print("Line 1");

lcd.setCursor(0,1);

lcd.print("Line 2");

for(i=0; i<numberOfPedal; i++) {

pinMode(relayPin[i], OUTPUT);

pinMode(ledPin[i], OUTPUT);

digitalWrite(relayPin[i],LOW); //turn ON all relays

digitalWrite(ledPin[i],LOW); //turn ON all preset LEDs

};

delay(500);

for(i=0; i<numberOfPedal; i++) {

pinMode(relayPin[i], OUTPUT);

pinMode(ledPin[i], OUTPUT);

digitalWrite(relayPin[i],HIGH); //turn OFF all relays

digitalWrite(ledPin[i],HIGH); //turn OFF all preset LEDs

};

pinMode(bankButton, INPUT);

Serial.begin(9600);

delay(1000);

lcd.clear();

lcd.print("Press any preset");

lcd.setCursor(0,1);

lcd.print("to start");

delay(1000);

}

/* Bank Button Debounce */

boolean bankdebounce(boolean last) {

boolean current = digitalRead(bankButton);

if (last != current) {

delay(5);

current = digitalRead(bankButton);

}

return current;

}

/* LOOP */

void loop() {

currentBankButton = bankdebounce(lastBankButton);

if (lastBankButton == LOW && currentBankButton == HIGH) {

bank ++;

lcd.clear();

lcd.print("Bank ");

lcd.print(bank);

lcd.setCursor(0,1);

lcd.print("Press Any Preset");

if (bank >= numberOfBanks) {

bank = 0;

}

}

lastBankButton = currentBankButton;

char key = keypad.getKey();

if(key) { // Check for a valid key.

switch (key) {

case 'a': writeOut(0);

break;

case 'b': writeOut(1);

break;

case 'c': writeOut(2);

break;

case 'd': writeOut(3);

break;

case 'e': writeOut(4);

break;

case 'f': writeOut(5);

break;

case 'g': writeOut(6);

break;

case 'h': writeOut(7);

break;

case 'i': writeOut(8);

break;

case 'j': writeOut(9);

break;

case 'k': writeOut(10);

break;

case 'l': writeOut(11);

break;

case 'm': writeOut(12);

break;

case 'n': writeOut(13);

break;

case 'o': writeOut(14);

break;

case 'p': writeOut(15);

break;

case 'q': memory(100+(bank*bankVariable),0);

break;

case 'r': memory(200+(bank*bankVariable),1);

break;

case 's': memory(300+(bank*bankVariable),2);

break;

case 't': memory(400+(bank*bankVariable),3);

break;

case 'u': memory(500+(bank*bankVariable),4);

break;

case 'v': memory(600+(bank*bankVariable),5);

break;

case 'w': memory(700+(bank*bankVariable),6);

break;

case 'x': memory(800+(bank*bankVariable),7);

break;

case 'y': memory(900+(bank*bankVariable),8);

break;

case 'z': memory(1000+(bank*bankVariable),9);

break;

case '1': memory(1100+(bank*bankVariable),10);

break;

case '2': memory(1200+(bank*bankVariable),11);

break;

case '3': memory(1300+(bank*bankVariable),12);

break;

case '4': memory(1400+(bank*bankVariable),13);

break;

case '5': memory(1500+(bank*bankVariable),14);

break;

case '6': memory(1600+(bank*bankVariable),15);

break;

case '7': readPreset(100+(bank*bankVariable),0);

break;

case '8': readPreset(200+(bank*bankVariable),1);

break;

case '9': readPreset(300+(bank*bankVariable),2);

break;

case '0': readPreset(400+(bank*bankVariable),3);

break;

case '~': readPreset(500+(bank*bankVariable),4);

break;

case '!': readPreset(600+(bank*bankVariable),5);

break;

case '@': readPreset(700+(bank*bankVariable),6);

break;

case '#': readPreset(800+(bank*bankVariable),7);

break;

case '$': readPreset(900+(bank*bankVariable),8);

break;

case '%': readPreset(1000+(bank*bankVariable),9);

break;

case '^': readPreset(1100+(bank*bankVariable),10);

break;

case '&': readPreset(1200+(bank*bankVariable),11);

break;

case '*': readPreset(1300+(bank*bankVariable),12);

break;

case '(': readPreset(1400+(bank*bankVariable),13);

break;

case ')': readPreset(1500+(bank*bankVariable),14);

break;

case '+': readPreset(1600+(bank*bankVariable),15);

break;

}

}

}

/* Use Presets */

void readPreset(int addr, int led) {

for(i=0; i<numberOfPedal; i++) {

digitalWrite(relayPin[i], EEPROM.read((addr)+i));

digitalWrite(ledPin[i], HIGH);

digitalWrite(ledPin[led], LOW);

}

lcd.clear();

lcd.print("Current Bank: ");

lcd.print(bank);

lcd.setCursor(0,1);

lcd.print("Preset: ");

lcd.print(led + 1);

}

/* Select Preset and Store */

void memory(int addr, int led) {

for(i=0; i<numberOfPedal; i++) {

EEPROM.write((addr) + i, digitalRead(relayPin[i]));

digitalWrite(ledPin[i], HIGH);

}

lcd.clear();

lcd.print("Program saved to");

lcd.setCursor(0,1);

lcd.print("Bank ");

lcd.print(bank);

lcd.print(", Preset ");

lcd.print(led + 1);

digitalWrite(ledPin[led], HIGH);

delay(100);

digitalWrite(ledPin[led], LOW);

delay(100);

digitalWrite(ledPin[led], HIGH);

delay(100);

digitalWrite(ledPin[led], LOW);

delay(100);

digitalWrite(ledPin[led], HIGH);

delay(100);

digitalWrite(ledPin[led], LOW);

delay(100);

digitalWrite(ledPin[led], HIGH);

lcd.clear();

}

/* Choose Loops/Relays */

void writeOut(int relay)

{

digitalWrite(relayPin[relay], !digitalRead(relayPin[relay]));

//digitalWrite(ledPin[relay], !digitalRead(relayPin[relay]));

lcd.clear();

lcd.print("Current Bank: ");

lcd.print(bank);

lcd.setCursor(0,1);

lcd.print("Choose Loops: ");

lcd.print(relay + 1);

}

MiguelE42 (author)2017-03-26

Hi CarraN,

I'm a complete newbie on the arduino world, and I'm also a guitar player :)
I'd like to control 10 loops with thin project. Can you give me a hand with the code, please?
Also,
is it possible to add some kind of control over the text that is
displayed? Maybe costumize the name of the preset, change the midi PC
message...

If you could help me, I'd be very gratefull
Cheers!
Mike

CarraN (author)MiguelE422017-03-26

Hola Miguel

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!
I suggest reading first some comments related to.

hope this will help

cheers

carran

MarcinM42 (author)2017-03-13

Can this looper be use as footswitch? I mean changing loops AND amp channels?

CarraN (author)MarcinM422017-03-14

yes it can! Just wire off those amp channel relays! Similar to the "breaking technique" explained on this instructable.

cheers

MarcinM42 (author)CarraN2017-03-18

I've checked YouTube videos and there is a big delay between button press and changing loop. It's unavoidable?

CarraN (author)MarcinM422017-03-18

Hi!

no problem of any latency on my side! You'll do not have neither!

Youtube isn't lip synching accurate, maybe you 've experienced this...

aranius made it! (author)2016-07-31

Hi,
I show my 2nd job so far
Project is like your view still can work in process and not ready, but basically you can see how it will eventually.
The design is based on my Amp.

FuzzmoG (author)aranius2017-03-02

Hi Aranius,

I'm german too. Did you have a homepage, you wrote earlier. Kann ich mit Dir in Kontakt treten bezüglich Deines Arduino loop-Switcher Projektes. Ich möchte mir auch selbst eines bauen. Grüße

Bernhard

CarraN (author)aranius2016-08-01

Hi Aranius!

did you solve your noise issues?

aranius (author)CarraN2016-08-01

Hi carran. Yes. The noise comes Form my fuzz strompbox....

besiek2510 (author)2016-11-28

how to connect selectror? For Arduino ports 30,31,31 and beyond? I will ask about the photo

CarraN (author)besiek25102016-11-28

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.

zulas12 (author)2016-08-30

Hi,

does this switcher work as a loop switcher and could be used in preset mode when need?

CarraN (author)zulas122016-08-30

hi!

yes and yes!

zulas12 (author)CarraN2016-11-19

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 http://www.ebay.co.uk/itm/5V-DPDT-Relay-Module-Pol...

renatoam (author)2016-09-06

Hello, how are you? I did the tutorial as images, is working but is very sizzling. You know what can be? thank you.

CarraN (author)renatoam2016-09-07

please, see below!

CarraN (author)2016-08-31

Hi!

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.

Now, I cannot tell you why your sound is louder (?!!) it's a passive system...

cheers

syntesys (author)2016-08-31

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?

Thank you

renatoam (author)2016-08-19

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.

renatoam (author)2016-08-15

It has a video on youtube showing how it works?

CarraN (author)renatoam2016-08-16

not yet!

cheers

David B1 made it! (author)2016-07-21

Thanks CarraN for a fantastic project (and your help) this is my finished looper hope you like it.

CarraN (author)David B12016-07-22

wow! welldoneman ! you're an hardware master!

David B1 made it! (author)2016-07-21

My Looper in its new home among my other home made effects pedals(5 pedals above the looper) thanks again CarraN

CarraN (author)David B12016-07-22

You're welcome !
Cheers!

syntesys (author)2016-07-08

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?

Thank you.

CarraN (author)syntesys2016-07-08

but could easily be replaced by one DPDT relay! but they're a lot expensivier!

syntesys (author)CarraN2016-07-08

Thank you! I've already bought a 16 relay board with 20 euros, so I think it's OK forma my project! :)

CarraN (author)syntesys2016-07-08

yep!

David B1 (author)2016-07-03

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

CarraN (author)David B12016-07-04

nice! but why put a true bypass switch, it's already true bypass...

David B1 (author)2016-07-03

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.

CarraN (author)David B12016-07-03

you're welcome man! Does it work now?
cheers

About This Instructable

24,834views

49favorites

License:

More by CarraN:Arduino Based ZOOM MS70-cdr Midi Program ChangerProgrammable 8 Loops Pedal Switcher With Arduino Mega2560Arduino Programable 5 Pedal Switcher
Add instructable to: