I basically want a single input relay, with 6 outputs, that switches to any of the 6 outputs based on the gpio signal, if that makes sense.

So the gpio signal would send a signal like 1-6 in binary for example and would turn on the corresponding circuit.

Is this possible? Is there some module that does this or will I need to make it?

  • gpio signal .... how many pins are you talking about? – jsotola Feb 25 at 20:51

If I understand correctly you are looking for a 3-Line To 8-Line Decoder/Demultiplexer such as the 74HC138. It selects one of 8 outputs based on the value of three inputs. The HC series has a wide Operating Voltage Range (2 V to 6 V) that will play well with the Pi without further ado. Note that you will need three GPIO output pins at the Pi (not counting enable pins of the 138) since three bits are needed to encode 1 through 6.

If using the I2C bus is an option an 8-Bit I/O Expander for I2C Bus such as the PCF8574 could also do the trick. It would require only the connection of the two bus related lines - data (SDA) and clock (SCL).

  • Could I use the same 3 gpio pins for 4 x 74hc138, I imagine in series? It sounds like what I need. It's just I have never used on of these before. I'm guessing the binary gpiosignal would go to pins ABC, that would correspond to outputs 0-7. Obviously vin and ground. Is this right? – Alex White Feb 24 at 22:23
  • @AlexWhite, you could use those three pins for 4 of the HC138 - not in series though but in parallel. One needs to mind that the sum of the input currents is below the max output current of the Pi's GPIO (but in this case that is not an issue). You could use the enable pins of the HC138's to behave them differently if that is required. Giving solid advice would however require to understand your demands in more detail. It is also likely that you will get better answers over at EE for the circuitry that is more or less not depending on the Pi. – Ghanima Mar 2 at 9:48

just use an attiny or a mega328p and a 5v signal boost. theyre basically miracle chips for things that should be simple, but arent. and you can reprogram them to do something different when you feel like it or sacrifice the 1.50$ and leave it to be that forever. once you start digging around in circuitry you should probably leave that to microcontrollers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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