Arduino Uno driving relays through Digital I/O

I have the following relay board:
[Amazon.com: DEVMO 8 Channel DC 5V Relay Module Board, (2PACK) Electrical Equipments 8-Ch Optocoupler Compatible with PIC AVR DSP ARM MCU PLC Smart Home Control Switch : Electronics](Amazon.com: DEVMO 8 Channel DC 5V Relay Module Board, (2PACK) Electrical Equipments 8-Ch Optocoupler Compatible with PIC AVR DSP ARM MCU PLC Smart Home Control Switch : Electronics)

that i have connected the VCC/gnd to a 5V DC power supply. The arduino is powered by another DC power supply running at 10V. The relay control signals are connected to pins 2 to 9 on my Uno. Is this setup ok? For some reason I pin 4 is not turning on anymore (might have gotten damaged?) but wondering if there is a better way to do this. All other pins are working fine and pin 4 was working previously but not anymore.

Can be, but can be wrong as well. Do you have jumper removed? Post a diagram of the 5V supply / relay / arduino wiring.

Do you have the relay GND connected to Umo GND?

Since every relay except the 4th is working, I would suspect either a hardware problem, or a problem with your sketch. These relay boards are fairly low quality, and the relays can easily be damaged by inductive loads or high current.

Relay indicator LED can give a hint, where the problem is..

it does not turn on for pin 4

Then the issue is not broken relay. Either bad wiring, fried pin or error in code.
Post your wiring anyway.

can the arduino uno pins drive the relays directly (with 5V on the arduino)?

No.
Do you have the grounds connected?

Wired like this?

Do we see your actual wiring on that image?

The wiring for that type relay board is a bit unconventional.
The jumper from JD-VCC to VCC should be removed, and the 5v supply for the relay board connected to the JD-VCC pin and the GND of the relay board.
The Arduino output pins should be connected to the relay board input pins, and there should be a connection between the 5v pin of the Arduino and the Vcc pin on the same header as the relay input pins. There should be no connection between the GND of the Arduino and the GND of the relay board.

The relays activate when the Arduino outputs a LOW.

i will try that thank you for the detailed explaination


Code should also be different.

void setup() {
pinMode(relay1Pin, INPUT_PULLUP); // first set (all) relay pins high
pinMode(relay1Pin, OUTPUT); // then set the pins to output 
}

This stops brief relay chatter during bootup.
Leo..

1 Like