I'm looking to connect an 8-relay board to an Arduino Uno. A board like this one. However, I don't really want to use up 8 digital outputs if I don't have to. Is there some intermediate circuitry I can either buy or build that would do this?

For example, can I connect something to the serial so that sending '3' would result in binary 00000011 and thus turn on relay's 1 and 2?

Alternately, and probably more lazy, is there an extension board that would just give me a pile more digital pins?

  • Sure, use a Mega instead of the Uno, more memory and 3 times as many pins – dinotom Apr 21 '16 at 6:52
  • 2
    You could use shift registers and/or I/O expanders. – Paul Apr 21 '16 at 8:48
  • You are using a UNO, you have the pins available, you could just use them. With the UNO and the relay board you have everything you already need, otherwise you're going to have to implement something else. A serial "3" is going to require more programming than just flipping the output register, much less overhead. Shift registers work well, but then you'd have to implement that at your relay board end. It's all unnecessary work, unless you have a valid reason to want to do it another way. Eight data wires and a ground IS the lazy way out. – Madivad Apr 22 '16 at 11:24

A likely solution is to use the Arduino SPI interface and the Arduino SPI library to control a SPI relay board. Here is a 6 year old thread talking about such a board. And another more recent relay thread where SPI is brought up.


There are ICs that provide additional I/O ports through either the SPI or I2C busses, such as MCP23017 or MCP23018 or their 8 port equivalents. There are many different makes, search Google for "Arduino addition IO Pins"


You can use a MUX/DEMUX. Check out the link. Basically, you can select the output pin by a series of commands that you can do with the Arduino. The relay inputs will be hooked up to the IC's outputs


  • Why should mux/demux help here? With a demux you can "attach" one pin to several outputs, and control which output is selected with the address. If the OP used one of these, he would have to attach +5V on the common input, one relay over each channel except one, and then he could only turn one ONE relay at a time... – frarugi87 Apr 21 '16 at 14:40
