1

This question already has an answer here:

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?

marked as duplicate by Paul, Mattia, Madivad, Nick Gammon Apr 26 '16 at 4:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 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
1

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.

0

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"

-1

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

https://www.sparkfun.com/datasheets/IC/cd74hc4067.pdf

  • 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

Not the answer you're looking for? Browse other questions tagged or ask your own question.