Can't light LED in relay

I have connected a 4 Relay Module as follows.

4 Relay Module 1st Relay NO port → breadboard at LED

4 Relay Module 1st Relay COM port → Ground

breadboard at the other end of LED → 5V in Uno board

4 Relay Module IN1 port → 4 port in Uno board

4 Relay Module VCC port → 5V port in Uno board

4 Relay Module GND port → GND port in Uno board

The circuit diagram of the setting is as follows.

https://drive.google.com/open?id=0B1Puk … TduNDFWd1E

The coding is as follows. However when the arduino is executed, the LED does not light. I have tried to light the LED without using the Relay module. It works. Are there any error in using the 4-Relay Module?


const int relayPin = 4;

void setup() {

Serial.begin(9600);

// give the MAX a little time to settle

delay(500);

pinMode(relayPin, OUTPUT);

digitalWrite(relayPin, LOW);

delay(500);

}

void loop() {

// basic readout test

digitalWrite(relayPin, HIGH);

delay(500);

}

A lot of those relay modules are actually active LOW, not HIGH.

I have tried to connect the relay module as the attached circuit diagram, and the coding is as follows. The light indicator IN1 in the relay module lights up for 2000ms and then turns off for 2000ms but the LED in the breadboard never lights up. Why the LED can’t light up in this setting?

Then, I have tried to change the wire near the LED in the breadboard from NO to NC. The LED always lights up which shows that the LED can function.


const int relayPin = 4;

void setup() {

Serial.begin(9600);

delay(500);

pinMode(relayPin, OUTPUT);

delay(500);

}

void loop() {

digitalWrite(relayPin, LOW);

delay(2000);

digitalWrite(relayPin, HIGH);

delay(2000);

}

I can’t tell if the relay module’s ground is connected to the Arduino’s ground. It needs to be connected. What is the purpose of the batteries? Are they connected to the breadboard or only the relay module?

The batteries is for the relay module. Without it, the IN1 indicator won’t light. Arduino is connected to PC’s USB for power supply in my case.

Many Thanks.

Well, I’m still confused. It looks like the relay module’s VCC pin is connected to the +5 volt pin on the Arduino. And can you confirm that the relay module’s ground pin is connected to the Arduino’s ground pin? Things may not work at all or may work strangely if the grounds are not connected. BTW, I think I found info on the relay module. The inputs are active LOW, which means that you need to output a LOW or ‘0’ to IN1. The module’s VCC jumper (switch?) needs to be set so that the rest of the module gets 5 volts. I think that you planned on the batteries supplying voltage to the relay coils. But the relays have 5 volt coils so 3 volts won’t be enough to make the relay turn on.

HTH

Thanks Dave! I have followed the steps guided in the following source, in which the relay module’s ground pin connects to the ground of separate power supply.

http://forum.arduino.cc/index.php?topic … msg2789482

Yes. I output a Low to IN1 to active the LED. In the relay module, it has JD-VCC and VCC. I connect JD-VCC to separate power supply. Yes, actually I use 1.5V x 6 batteries, i.e. 6V to the relay coils. I haven’t drawn all batteries in the diagram.

It’s strange that I have tried to connect the wires of NO and COM. The LED lights up. Therefore the LED circuit should not have any problem. The bug may be come from the relay module.

But I have tried to connect the circuit in the other relay board. The same consequence happens again. So, it seems that it’s not due to the bug of one relay board.

That relay module looks like there are two sets of isolation and three separate circuits.

The Arduino drives the LED and the optoisolator. This uses Vcc (+5V) and the INn pins; the pins get driven low to turn on the opto. For this, GND is not used. Think of it as the Arduino just driving an LED.

The opto drives the relay coils via a transistor. This uses GND and JD-VCC for power, if the jumper is removed. If it is connected, it would use GND and Vcc (the same one as the optos…). This is where you connect your 6V battery. That would be 4 AA batteries, not 6… (If you used 9V, you may have burned out the relay coil.)

Then there are the relay contacts. They are simply switches with the COM connected to NC when the relay is off, and to NO when it is on.

If the LED lights up when connected to NO, the relay must be turned on. If you disconnect the INn pin corresponding to that relay, does the LED turn off? That would tell you that the relay is working.

Break the problem down into parts to troubleshoot. Just connect the Arduino to INn and Vcc. Then get the LED on the relay board to blink. If you can’t get that to work, try replacing the relay board with an LED and a resistor. Once that works, add the 6V battery. The relay should click in time with the blinking light. Finally, add the load (the LED on your breadboard).

/mike