Project - 8 switches handling 8 relays, doable with Arduino Uno?

Hi guys, new to the forum, I've just been lurking a bit in the last few days since I've got my Arduino Uno and done the blinking thing....

My name is Armando and I'm from Italy. I know just a little bit of programming (started in the 80s with Basic, then DBASEIII, and a little bit of macro in Excel). I also know a little bit of electronics, and build guitar effects pedals as a hobby.I've a project in my mind about building an 8 loops switching system for guitar effects pedal-board. What I, as a start, would like to know is if this is doable with Arduino (and possibly with only the chip ATMEGA32).

My ideas/set up for the project are, in no particular order Hardware

  • 8 stomp switches + LED
  • 8 relays + LED

Software - each switch activates 1 to 8 relays, driven by an ULN2083 (2803 don't remember now) based on the port "opened" on the chip. - one of the 8 switches used to program each loops - constantly read the switch states waiting for user to stomp. - long press enter in programming more and wait for user to close the session and memorize the loops on/off into a matrix - save the loop configurations as a matrix [LoopNumber(1-to 8), relé on(1 to ). or setting up a byte number with port on/off like 00110010.

and may be more features they'll come to my mind :)

So, before I start a deep lurking here and there, do you guys think this is doable ? better with a full Arduino board or the chip is enough for the sketch to run?

Suggestion/advice are more then welcome, even if somebody has already faced something like this some pieces of code are also welcome :)

I know there's already something like that out there, even MIDI things, though I think, if I could get one done by myself that'll be cool and I could incorporate it/part of in guitar pedals.

Just to be clear I'm not talking about audio manipulation, just switching.

Thanks to all and have a nice day! Ciao Armando

do you guys think this is doable ?


better with a full Arduino board or the chip is enough for the sketch to run?

When you remove the chip, you have a dead bug. Dead bugs don't work worth a damn.

You need a regulated power supply plus all the input and output connections. Then, the sketch will run.

The arduino board (UNO etc.) come with the regulator and and USB port etc. with out the need to add bits.

Seeming as you are using relays and such, the weight and power saving would not be worth the time and effort vs. the convenience imho.

Thanks for replies guys

indeed I have no problem to make my own circuit and pcb with power supply, oscillator(?) and all connections, I use draw and etch myself PCBs for guitar pedals.

I've seen videos on YT about programming an external chip using A. "as ISP"

That's why I thought about using only the chip vs the hole A. board.

Thanks again Armando

Hi there

so, after a little bit of lurking, I’ve found this code posted from PaulS(thanks!). Just something to star with. Changed the state to HIGH to use internal resistor

Is there any reason why the LEDs are dimmed compared to how they light with the blinky sketch?

The do light up at every hit of the switch and turn off, but the intensity if really slow.

8 switches to gnd using internal resistors
8 LEDs connect to gnd via 390R restistors

byte ledPins[] = { 2, 3, 4, 5, 6, 7, 8, 9 };
byte swiPins[] = { 10, 11, 12, 13, 14, 15, 16, 17 }; // 14 to 17 are analog pins 0 to 3

for(byte i=0; i<8; i++)
   int state = digitalRead(swiPins[i]);
   if(state == HIGH) // Assumes no-pullup resistor
      // Turn all the LEDs off
      for(byte j=0; j<8; j++)
         digitalWrite(ledPins[j], LOW);

      // Turn on the one correct LED
      digitalWrite(ledPins[i], HIGH);

Thanks for help

Please forget that ULN2803s (or ULN2003s) existed!

It's an obsolete chip which uses Darlington transistor pairs for poor performance.

Get to know the TPIC6B595. It has proper FET switches and a serial-in shift register and latch meaning you control it - or any reasonable number of them - with only three control lines.

What do the relays need to do? Considered the relay boards available on eBay? Maybe you can make your own PCBs, but it is a waste of time to make your own Arduino board and much the same to make a relay board if you can get one ready-built.

{If you do make your own PCB, just put on it the pinout to mount a ready-assembled Pro Mini or Nano using the header pins.}

Thanks Paul__B for reply.

indeed I've already PCBs with ULN and relay, and the switching PCBs (using a 74C373 octal switch) they both work fine. The only thing is that, at the moment, to select which relays are on for each loop I'm using 8 position dip-switches.

So I just want to use A. to switch the on/off relays instead of the dip-switched, thinking it is more easy to program, store/modify and recall pre-set programs.

Thanks Ciao Armando