https://www.amazon.com/gp/product/B0789 ... SLEZQ&th=1
There are jumpers to switch between LOW and HIGH triggers. Currently they are HIGH as LOW turned all of the relays on and I wasn't able to turn them off.
I have 24v + and - from an A/C adapter into the relay, followed by 4 gpio pins from RBpi, and COM on the relay to RBpi ground.
My script sets GPIO's to Output.LOW initially (the relays are off) and then when I set them to HIGH they turn on.
Problem is they're acting weird.
1st relay - LED lit, 1-2 seconds later relay closes.
2nd relay - LED lit and instant close.
3rd relay - LED lit and instant close.
4th relay - LED lit, never closes.
I've seen posts saying external power should go through JD-VCC but this relay doesn't have that available. I feel like I must have this wired wrong but I'm too inexperienced to know. Do I need to wire this up with transistor/resistors?


Code: Select all
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
# init list with pin numbers
pinList = [18, 17, 27, 22]
# loop through pins and set mode and state to 'LOW'
for i in pinList:
GPIO.setup(i, GPIO.OUT)
GPIO.output(i, GPIO.LOW)
# time to sleep between operations in the main loop
SleepTimeL = 1
# main loop
try:
GPIO.output(18, GPIO.HIGH)
print("ONE")
time.sleep(SleepTimeL);
GPIO.output(17, GPIO.HIGH)
print("TWO")
time.sleep(SleepTimeL);
GPIO.output(27, GPIO.HIGH)
print("THREE")
time.sleep(SleepTimeL);
GPIO.output(22, GPIO.HIGH)
print("FOUR")
time.sleep(SleepTimeL);
GPIO.cleanup()
print("Good bye!")
# End program cleanly with keyboard
except KeyboardInterrupt:
print(" Quit")
# Reset GPIO settings
GPIO.cleanup()