Page 1 of 1

LED doesn't turn off with relay, always on

Posted: Fri Jul 12, 2019 9:34 pm
by dq36g
Hey guys, I've got this wiring setup:

Image

[Note: the yellow part circled is a 3V rail]

For reference, here (https://i.imgur.com/mJj3U5Q.png) is my setup mapped to the relay.

This (https://www.amazon.ca/gp/product/B00E0NTPP4/) is my relay. The reviews say it works with Pi/3.3V even though it's 5V. My issue is that when I turn the relay off like this:

Code: Select all

relay = gpiozero.OutputDevice(RELAY_PIN, active_high=False, initial_value=False)
relay.on()
relay.off()
The LED stays on. I know that the relay is on because I hear a click, and the red LED on the relay that says IN1 is on.

Anyone know why?

Re: LED doesn't turn off with relay, always on

Posted: Fri Jul 12, 2019 10:46 pm
by LTolledo
its always "ON" because you connected it to the NC or "normally closed" contact of the relay (normally closed means if no power there is connection)

get it?

now try changing connection to NO or "normally open" and see what happens.....

Re: LED doesn't turn off with relay, always on

Posted: Fri Jul 12, 2019 11:04 pm
by dq36g
LTolledo wrote:
Fri Jul 12, 2019 10:46 pm
its always "ON" because you connected it to the NC or "normally closed" contact of the relay (normally closed means if no power there is connection)

get it?

now try changing connection to NO or "normally open" and see what happens.....
Ah, I see what you're saying, thanks for the info.
I've tried doing it like this

Image

But it never turns on. If it helps, this is in the product description:
2 relay module selection of high-quality loose relay, single-pole double-throw. A common end, a normally open end, a normally closed end.Can be selected by jumper relay and TTL or ground.

Re: LED doesn't turn off with relay, always on

Posted: Sat Jul 13, 2019 2:49 am
by LTolledo
ok lets try first the relay without the RPi

for this "experiment" we will need a 3.3v breadboard power supply, and a breadboard.

connect the Vcc to +3.3v
connect the GND to GND
dont connect anything to the output yet.

power on the breadboard power supply
get another GND wire and touch either IN1 or IN2

does an LED on that board light up when you touch the GND wire to IN1 or IN2?
if not, then the board cannot operate on 3.3v
if it does, then connect the LED to the output (lets say on Relay 1 [IN1])
GND --- 120ohm resistor ---- NO contact
Common --- 3.3v

now try touching the GND wire again to IN1, does the LED on the relay output side light up?
if it doesn't the relay may be faulty, try Relay2 [IN2]
if it lights up then the relay board works.

one way to check if the relay is actually activating is to "feel" the relay. If you feel something moves inside then the relay activates
if you dont feel anything even if the indicator lights up, the relay is not activating due to insufficient voltage (3.3v)

most of these relays boards are "active low" meaning a GND state on the IN pins turns on the relay while a +3.3v turns off the relay.
you need to remember this when making a program on your RPi to activate the relay....

have a similar relay board and tried all of the above... so that means I know what I wrote and not just some guesswork...

Re: LED doesn't turn off with relay, always on

Posted: Sat Jul 13, 2019 5:01 am
by dq36g
LTolledo wrote:
Sat Jul 13, 2019 2:49 am
ok lets try first the relay without the RPi

for this "experiment" we will need a 3.3v breadboard power supply, and a breadboard.

connect the Vcc to +3.3v
connect the GND to GND
dont connect anything to the output yet.

power on the breadboard power supply
get another GND wire and touch either IN1 or IN2

does an LED on that board light up when you touch the GND wire to IN1 or IN2?
if not, then the board cannot operate on 3.3v
if it does, then connect the LED to the output (lets say on Relay 1 [IN1])
GND --- 120ohm resistor ---- NO contact
Common --- 3.3v

now try touching the GND wire again to IN1, does the LED on the relay output side light up?
if it doesn't the relay may be faulty, try Relay2 [IN2]
if it lights up then the relay board works.

one way to check if the relay is actually activating is to "feel" the relay. If you feel something moves inside then the relay activates
if you dont feel anything even if the indicator lights up, the relay is not activating due to insufficient voltage (3.3v)

most of these relays boards are "active low" meaning a GND state on the IN pins turns on the relay while a +3.3v turns off the relay.
you need to remember this when making a program on your RPi to activate the relay....

have a similar relay board and tried all of the above... so that means I know what I wrote and not just some guesswork...

Hey so I f***ed up. I was doing it right, but I was using the IN1 input and the IN2 output. Thanks for taking time out of your day to help, I really appreciate it.

Re: LED doesn't turn off with relay, always on

Posted: Sat Jul 13, 2019 6:01 am
by LTolledo
dq36g wrote:
Sat Jul 13, 2019 5:01 am

Hey so I f***ed up. I was doing it right, but I was using the IN1 input and the IN2 output. Thanks for taking time out of your day to help, I really appreciate it.
hey! dont be too hard on yourself.... :o
...anyway... glad to be of service :D