4

I have a Raspberry Pi 3b and wired to a 4 port relay I got from Amazon:
https://www.amazon.com/JBtek-Channel-Module-Arduino-Raspberry/dp/B00KTEN3TM/

Everything is working, but it seems backwards to me. First I set the modes to 'out' for all 4 of the GPIO ports I'm using. I'm using the following pins because they're close to each other on the pi, and issuing these commands to set up the ports properly:

gpio -g mode 26 out
gpio -g mode 13 out
gpio -g mode 6 out
gpio -g mode 5 out

From what I read, I should issue a '1' to turn them on, and a '0' to turn them off. But this seems to be reversed from what I'm seeing. If I issue a '1', nothing happens. If I issue a '0' they turn on. This turns them all on:

gpio -g write 26 0
gpio -g write 13 0
gpio -g write 6 0
gpio -g write 5 0

After that, I can issue a '1' to turn them off.
Is this normal behavior?

2

4 Answers 4

3

Yes, many relays are low-On, high-Off.

It is normal.

2

Considering the hand-drawn schematics available at the product page linked in the question, it is clear that the circuit is "active low". That is, the coil of the relays is energized if the input is low. The controlled contacts however are two-way contacts so that it is possible to either break or make a contact when either energizing or de-energizing the coil. If possible it is however advisable to chose the configuration in which the coil is energized the least amount of time.

enter image description here

(source: https://www.amazon.com/dp/B00KTEN3TM/ posted by Granpinos, Jul 06, 2015)

1

Here is how it works in simple terms.

Consider the following schematic.

Applying a LOW to a lamps turns it on.

It is sometimes referred to as "active low" signal.

schematic

simulate this circuit – Schematic created using CircuitLab

1

Use a diode with

gpio(-) and relay input(+) if it doesn't work then reverse the diode connection. The gpio only supply 3.3 volt. Maybe this one will solve. While using nodemcu I faced the same problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.