Problem in using 4 Relay Module to light LED

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 photos of the setting are as follows.
https://drive.google.com/file/d/0B9GHszdNyS15bEUwMS1KQ2lLa1E/view?usp=sharing
https://drive.google.com/file/d/0B9GHszdNyS15ZWpKc1NqWlRDTm8/view?usp=sharing

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);
}

I can't see where the wires are going, but I've got to assume something's wired wrong...

This is might be unrelated, but your current-limiting resistor is not in series with the LED.... Your LED could be fried, or the lack of a resistor could be "killing" the 5V and crashing the Arduino.

Do you hear the relay clicking? If not, disconnect the LED and listen for clicking.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html
then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile:
OPs Pictures


Here's a way make use of the opto-isolation feature (connection diagram and sample code).

From your images, I cannot figure out how everything is powered ... note that the relay board cannot derive power from the Arduino except for powering it's opto and visible LEDs.

After connections and powering is OK, there a possible issue in your code. You may need to reverse the order of pinMode and digitalWrite in your setup or the relay will energize for 500ms. Also use digitalWrite(relayPin, HIGH) to ensure the relay stays OFF (the relays are active-low trigger).

Reversing the order like this influences the default condition of pinMode (changes it to default HIGH on the pin).

I'm often surprised that people can "plug stuff up" and expect it to work without doing the paperwork.

By paperwork, I mean drawing up a connection diagram, even if just on a napkin. Especially if you are

  1. going to ask questions about why it doesn't work

  2. attempting to keep your own sanity to know WHY you are connecting things to each other.

There should be enough proof here by now that there is almost never a picture that "tells the story".

Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :slight_smile:

pwillard:
I'm often surprised that people can "plug stuff up" and expect it to work without doing the paperwork.

Works in their day to day job?

Hey guys, this OP did the same thing as the other one. He put BOTH leads of the resistor in the SAME row !
The led is fried because there was no resistor in series. He needs to remove the resistor and rotate it 90 degrees counter clockwise, move it over so one end connect to the led and then move the wire to the other lead, and replace the led.

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);
}

Can you show a schematic instead of that useless wiring diagram?

At first glance, you have the power supply shorted as soon as it comes out of the battery pack.

Beyond that, it's just not worth trying to follow those wires. Post a schematic.

These present so many problems around here. I just placed an order for one so that I might get the skinny on the great relay board dilemma.

http://forum.arduino.cc/index.php?topic=409294.0

.

Wawa:
http://forum.arduino.cc/index.php?topic=409294.0

Irritating.
What's the deal hgchcw?

@hgchcw, please do not cross-post. Threads merged.