Getting 12v relay module working with Arduino

Hello

I have an Arduino UNO and want to use to to turn on and off my 230v light.

I have bought this 12v two relay module: https://www.alibaba.com/product-detail/HW-279A-new-2-channel-5V_62575889007.html

(The link is for a 5v but the one I have is 12v.

I have connected the DC+ to plus side of my 12v power source and DC- to the negative side of my power source. When I power it on both relays activates even though there is nothing connected on the IN1 and IN2. I have tried to send a signal from the Arduino UNO from a digital pen set to high (5v) to either IN1 or IN2 and nothing happens.

I must be doing something wrong, I just can't figure it out. Hope you can help me :slight_smile:

Try and connect the DC- to the ground of the Arduino.

There are two jumpers on the board labeled "S1" and "S2", are they set on HI or LOW?

Try and connect the DC- to the ground of the Arduino.

I have tried connecting the ground of the Arduino to DC- and I stille get the same result. Though after trying to switch the + and - of the power source to the relay module. Now only one of the relay activates when I turn power on after connecting the power source correctly again.

There are two jumpers on the board labeled "S1" and "S2", are they set on HI or LOW?

Both are set to HIGH.

Though after trying to switch the + and - of the power source to the relay module.

Why? You just blew one of your modules.

The power supply I use got no identification of which is - or +. So i tried to change them to see if it made a difference. Still I only need one of the relays. But there might be a problem the module because when i connect power relay 1 always activate no matter if S1 is HIGH or LOW.

I just tried to put 12V to DC+ and ground to DC- and taking another wire from DC- to IN1 while S1 was set to LOW. Nothing happens.

vontrap:
The power supply I use got no identification of which is - or +. So i tried to change them to see if it made a difference. Still I only need one of the relays. But there might be a problem the module because when i connect power relay 1 always activate no matter if S1 is HIGH or LOW.

I just tried to put 12V to DC+ and ground to DC- and taking another wire from DC- to IN1 while S1 was set to LOW. Nothing happens.

Hi, please get yourself at least a multimeter if you are gona tinker with ths stuff, you must know for sure because often times there is no second chance for your circuits and it takes a couple of milliseconds to ruin them... at this point you can't be sure if they are even operational... Isn't there some datasheet you can refer to? Its not plumbing, you need to be sure.

Arduino ground and 12V ground need to be conected together it seems, and when s1 is LOW grounding IN1 should trigger the Rel1 if you have a pullup resistor to 5V on IN1, if its set to high then a 5v signal will triger it.... google what pullup and pulldown means, and take this experience to learn never to try switching polarity just to see what happens.

I have not been able to locate a datasheet for this exact module. I think you guys are right that I have destroyed the relay module. I will get a multimeter and a new relay and be more carefull next time. Thanks for your help.

vontrap:
The power supply I use got no identification of which is - or +. So i tried to change them to see if it made a difference.

Doh! Expensive approach.

Failing all else you can use electrolysis to settle polarity:

Dip the two wires in salt water, the +ve will start turning to copper chloride and staining the
water greenish, the -ve will give off hydrogen bubbles.

The power supply I use got no identification of which is - or +.

Often that is a sign that the power supply is in fact supplying AC instead of DC. You can test that with an LED and a 10K resistor in series.

If the LED lights up no matter which way round you connect the wires then you have an AC supply. AC supplies are often used in audio equipment to get a dual rail supply in the unit itself.

An AC supply connected to that relay module as well as most other units would damage or destroy them in 50 or 60mS.

Actually, bar a few obvious blunders, this would seem to be the circuit of the relay module (replicated for a two relay module of course :grinning: )

Since the transistor has a VEBO of 5 V, applying a reverse supply of 12 V arguably would trash the transistor, but 5 V would not. While the optocoupler does have a reverse breakdown of nominally 6 V, the 2k2 resistor should protect it.

Paul__B:
this would seem to be the circuit of the relay module

XD karma for thoroughness
Opto input should be 2 and 4, but then jumper high, or no jumper always keeps relay on, and you need to set low, and limit IN current? for 5V around 320ohm resistor on input?
jumper just for manual bypass then?

Now it should be obvious that the connection between the 12 V and R5 is a stupid drawing blunder, but the optocoupler is also drawn incorrectly.

Pins 1 and 2 are the input to the anti-parallel LEDs and are on one side of the optocoupler while 3 and 4 on the other side are the transistor.

So it really is a bidirectional input opto, makes much more sense considering low and high input selection it claims to have, they can be pretty cheap with info, I would probably glance some routs manually if I had it, or even search info by parts when in doubt...