I have a 16 channel relay that will basically manage 16 different contacts. However, each channel in the relay needs to be controlled by an individual Arduino. So in total I would have 16 different Arduino boards that will each control a single channel in the relay. Is this possible? If so, how do I make the conenctions? I tried it earlier using several arduinos and connecting their ground wires together but did not seem to work, the relays remained energized. I am using the SAINSMART 16-Channel 12V Relay Module
Looking at the schematic, here are some points to be kept in mind when using this relay board:
- The relay board should be powered through the 12V connector
- The relay board has its own 5V regulator
- The optocouplers are attached in "reverse"
So, the external connections should be
- Connect all the arduino grounds together, and connect them to the board ground
- Do not connect any +5V wire together
- Connect arduino 1 to IN1, arduino 2 to IN2 and so on
- Writing a HIGH value on the INx pin will result in the relay to be de-energized (so contact goes in NC position), writing a LOW value on INx pin energizes the relay (so contact goes in NO position)
If making this connection the board does not work as expected, try to detach all the arduino boards and manually shorting IN1 and +5V, IN1 and GND, IN2 and +5V, ...
You could think of using 16 Arduino's sending messages (or a control signal) to a Master Arduino which controls the 16 relays.
You can use a protocol (like ModBus, I2C). Or you can connect each Arduino to a dedicated input pin of a 16:1 Multiplexer and let the Master check all 16 lines one by one to check which relay need to be enabled.
This way you can even add more intelligent logic in the Master if needed.
You wrote that joining Arduino ground together didn't work.
This leads me to believe that you didn't do the most important connection. You need to have each Arduino ground connected to the Relay Module ground. Usually this requirement is fulfilled, because people power all devices from the same power supply.
Without that Relay Module inputs are "floating", and their states are random.