Struggling with 16 channel relay

I'm struggling with something that I can't help but think has a simple solution. However, I'm not able to come up with it on my own (and yes, I did try googling this but apparently lack skill in finding my actual solution). I'm certain someone can get me lined out real quick with either a link or an explanation. I've checked several tutorials and noticed that they all have the output connected directly to the relay modules and did not require any additional circuitry to activate/deactivate relays. I have some electronics background but have forgotten a ton as I haven't been a practitioner for some time. What am I missing??

Your help would be much appreciated!

Symptom:
My relay activates when connected and never deactivates

Troubleshooting:
With a voltmeter connected to GND and PIN 13, and nothing else connected to those pins, I see it changing resistance based on the delay (from OL to 22 ohms). However when I connect it to the relay module the relay activates and never deactivates. When I disconnect the relay trigger wire the relay does deactivate. Also, when I simply jump the GND pin to the input trigger the relay follows the connection.

Hardware used:
Arduino Mega 2560 R3 - purchased here

16 channel relay module - purchased here

Wiring:

  • GND pin from arduino connected to GND pin on relay module
  • Pin 13 from arduino connected to relay 1 trigger on module
  • 12VDC applied +/-12VDC terminal on the relay module

Code used:

void setup() {
  pinMode(13, OUTPUT);    // sets the digital pin 13 as output
}

void loop() {
  digitalWrite(13, HIGH); // sets the digital pin 13 on
  delay(5000);            // waits for 5 seconds
  digitalWrite(13, LOW);  // sets the digital pin 13 off
  delay(5000);            // waits for 5 seconds
}

Code looks ok.
try using a different pin, not 13 and see what happens.
instead of measuring resistance, measure the voltage on the pin - what do you see when on and off?
Also with the relay trigger disconnected from the arduino (the relay should be deactivated) what is the voltage on the trigger pin?

I did try a couple other pins to make sure I didn't mess up something and I get the same behavior. When checking voltage I see it toggle between 4.6VDC and .4mVDC (so it appears to be working fine, hence my confusion).

EDIT: I'm beginning to suspect a faulty relay module as when I connect another GND pin form the arduino to the relay trigger activates, same as when I connect 5VDC from the arduino. I may be rusty but I know that can't be right.

I could be wrong. But i believe that your relay module may only require a 5v power supply instead of 12v.

unless it states that it can take up to 12v in the paperwork you received with it.. but on the item above you said you bought, it doesn't say it's 12v, just 5v. Tho there are some others on ebay that say they're 5v or 12v.

This is one of those weird opto isolated relay modules that requires a ground to activate... it's low side switching. I believe you can jump or use seperate power for the isolation.

Here's the schematic for a 4 channel version:

the relay board in the link you provided looks like it is 5v and not 12.
check what is written on the relays 5 or 12 will be shown for the coil voltage.

if you power a 5v relay board with 12v you can damage it. Also it explains why a high of 4.6V Arduino output caused the relay to activate, the relay board thinks its a LOW as its <6V.

I believe OP is switching 12v with the relay.... you need a logic high to turn off.

You seem to have bought a 16-channel relay module with 5volt relays, but a cheaper one with the 12volt>5volt buck converter parts missing.
These 16-channel boards (including the ones with buck converter parts) have a design error.
Relay VCC is permanently connected to Arduino VCC. No opto isolation possible.

Connect a 5volt supply (>=1.5Amp) to the screw terminal, and connect the Arduino to VCC, ground and the inputs.

Your code must enable the internal pull up resistors on the pins BEFORE setting the pins to OUTPUT, to stop relay chatter diring bootup.
Also not wise to use pin13, but the analogue pins can also be used as digital pins.
This module is "active LOW", meaning a HIGH on the pin turns a relay off.
Leo..

Well crap. I’m embarrassed for making an assumption that the DC terminals were 12VDC. I’ll apply the correct voltage and retest. It is supposed to be low level on, but makes sense now how a high and a low weren’t enough to change state. Thanks for getting me back on track.