Relay module Active LOW (reversed) Help!

Please can someone help me.
I am new in arduino programming, I have problem with switching relay on and off.
Everything works great except when I set pinout to HIGH it turns OFF the relay and when I set pinout to LOW it turns ON the relay.

Can someone help me to resolve that problem.
This is the relay that I bought.

http://www.ebay.co.uk/itm/141710507211?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

Thank you!

There is no problem; just write LOW if you want it on and HIGH if you want it off. A nicer solution might be

#define RELAY_ON LOW

void setup()
{
  ...
  ...
}

void loop()
{
  // switch relay on
  digitalWrite(relayPin, RELAY_ON);
  delay(1000);
  // switch relay off
  digitalWrite(relayPin, !RELAY_ON);
  delay(1000);
}

I see 3 contacts on the left of the picture - maybe one pair is normally open (N.O.) and the other is normally closed (N.C.)?

GypsumFantastic:
I see 3 contacts on the left of the picture - maybe one pair is normally open (N.O.) and the other is normally closed (N.C.)?

It is like this

I really would like to make it work when the pin is HIGH to power on the relay if it is possible?

icanic:
I really would like to make it work when the pin is HIGH to power on the relay if it is possible?

Why though? There's no logical reason why HIGH should mean "on" any more than LOW should. And in any case, active low is more common.

Hmmm, ok if that is the way how relays work.
I am sending this over MQTT so then I can just send 0 to power on the relay, but somehow this is wrong in my head :slight_smile:

icanic:
Hmmm, ok if that is the way how relays work.

It's not a relay thing, it's a thing.

icanic:
Please can someone help me.
I am new in arduino programming, I have problem with switching relay on and off.
Everything works great except when I set pinout to HIGH it turns OFF the relay and when I set pinout to LOW it turns ON the relay.

Can someone help me to resolve that problem.
This is the relay that I bought.

http://www.ebay.co.uk/itm/141710507211?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

Thank you!

And if you ever replace that relay with another, not identical or from the same manufacturer, you will find it works the other way around. I have had to change program when replacing relay modules.

Paul

This IS a reason for this. See THIS PAGE

---------------------( COPY )---------------------
IMPORTANT NOTE: There is a issue with start-up of Arduino programs that control these relays. All of these 2,4, or 8 relay boards input controls are Active LOW, meaning that setting a pin LOW turns them ON. To assure that no relays activate at Reset or Power-On until you want them to, the initialization sequence in SETUP should be:
digitalWrite(Relay, HIGH);
pinMode(Relay, OUTPUT);

This design is intentional, so that it is possible to guarantee that at power-on of a system, or system reset, that no relays activate except when expected under program control. There may be pumps, lights etc attached and chaos could ensue if this was not controlled definitively for each output port being used.
-----------------( END COPY )----------------------

1 Like