Objective: select one of four relays and latch closed

You will need: Arduino UNO (or similar), 4-way relay card, four SPST momentary pushbutton switches, breadboard and patch cables.


4-way relay

This project came about from a requirement to switch video channels remotely. Any one of four channels needs to be switched and if an existing channel is already active then it needs to be de-activated before switching a new channel.

When the Arduino is powered up, none of the relays are energised. When a pushbutton is pressed, the corresponding relay is closed and latched so that the pushbutton can be released and the relay remains closed. If another pushbutton is pressed, the previous relay is opened and the new relay is closed and latched. If the pushbutton for a currently closed relay is pressed, the relay is opened. An explanation of how the relay card needs to be connected can be found here.

You could modify the sketch so that the current status of the relays is saved to non-volatile memory each time a relay is opened or closed. In this way, the previous state of the relays can be re-instated when the Arduino is powered on. You only need to store one byte of data in EEPROM for the relay status (for four relays you only need two bits actually!). Information on how to read from and write to EEPROM is available on the Arduino website.

Link to sketch source code.

4-way relay wiring diagram