# Can't work out Arduino 12v Relay (5v Logic)

I have a 12v relay but I just can't figure out how to use it. I went to tech support, but they just waved me away. So, my problem is that I have an 8 channel relay, but can't get it to work. I did try a shared ground (I know, bad idea) but disconnected that after half a second.

So the board has 10 pins, VCC GND IN1 IN2 IN3 IN4 IN5 IN6 IN7 IN8 and two linked ones, COM-GND. So, the relays require 12v in to move the coil (already have a power supply) and requires 5v logic to move the coils. What I can't figure out is how I'm supposed to use the logic and 12v input at the same time. Shared ground... didn't work. I'm lucky I was just touching some male jumpers and it scared the life out of me and I disconnected them.

But it's basic electronics: there's no flow if the ground isn't connected. The Arduino doesn't have a ground for its 5v logic, and there's no ground on the board that won't blow something up.

So, how do I provide enough power to work the relays and get the 5v of logic to switch them, without setting something alight?

• The Arduino doesn't have a ground for its 5v logic - So you never saw 'GND' marked pin on ur board ? Nov 27 '19 at 10:54
• "the relays require 12v in to move the coil and requires 5v logic to move the coils" Make up your mind? Which one are you actually using? The link provides both versions. Nov 27 '19 at 12:10
• @Lundin "5V logic to move the coils". no contradiction there, only bad phrasing. "5V logic to control the coils" would be more appropriate. Nov 27 '19 at 12:14

## 2 Answers

You should connect it just like you did it.

Common ground between the Arduino and the relay board.

The datasheet even mentions supplying the 12V to the relay board from the Arduino 12V Vin - and that would require the ground for the relay board to be connected to the Arduino ground.

The digital IOs from the Arduino are 5V logic level. The relay board doesn't need 5V power, it only needs 12V for the relays. The 5V logic signals are used to drive a transistor to switch the relays.

Correction:

A closer look at the pictures (since the datasheet doesn't include a schematic) shows that the relay board uses optocouplers to drive the relay.

The board still only has one ground connection, though, so you must still connect the relay board ground and the 12V ground together.

The optoisolation doesn't really do much for you since the grounds still have to be connected.

There are apparently several versions of the board, some with and some without optoisolators.

In any case, they all share the same pinout, so you must connect the relay power ground and the Arduino ground together.

• "The 5V logic signals are used to drive a transistor to switch the relays" actually, no. 12V versions of the board have optical isolation, so the 5V logic inputs are used to drive the LEDs in those. The grounds can and should be separated in this case. Nov 27 '19 at 11:36

First, a little advice - avoid using products without proper documentation. This board is quite generic Keyes module and there are many clones of it. Some manufacturers provide a bit more information, e.g. here

Now, your board should be connected like this:

+12V -> VCC
-12V -> GND
Arduino GND -> COM
Arduino digital output pins -> IN1..IN8

The jumper between COM and GND should be removed.

Note, that if you power Arduino from the same 12V supply, you can can save 1 wire by removing connection between Arduino GND and COM pin and leaving the jumper as it is. In this case the grounds of relay module and Arduino will be connected at the negative power supply line. However saving 1 wire is not worth it, IMHO.