DoTheEyeThing
Posts: 2
Joined: Sat Jun 09, 2018 8:13 pm

Relay Issues

Sat Jun 09, 2018 8:46 pm

So I ordered a 24v relay
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?

Image
Image

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()

DoTheEyeThing
Posts: 2
Joined: Sat Jun 09, 2018 8:13 pm

Re: Relay Issues

Sat Jun 09, 2018 11:13 pm

I resposted this on reddit and someone helped identify that I need at least 5v to trigger the relays, so I'm looking into ways of doing that. : )

User avatar
Z80 Refugee
Posts: 358
Joined: Sun Feb 09, 2014 1:53 pm

Re: Relay Issues

Sat Jun 09, 2018 11:21 pm

That's not what it says on the advertised product details. If you can find me a circuit diagram for the relay board I will be able to comment further.
Military and Automotive Electronics Design Engineer (retired)

For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!

klricks
Posts: 7427
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Relay Issues

Sat Jun 09, 2018 11:36 pm

Test each relay by connecting the IN of each relay to 3V3 GPIO pin 1.
If not working try each IN to 5V GPIO pin 2.
If that does not work the relay is bad.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

pcmanbob
Posts: 10449
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Relay Issues

Sun Jun 10, 2018 10:57 am

DoTheEyeThing wrote:
Sat Jun 09, 2018 11:13 pm
I resposted this on reddit and someone helped identify that I need at least 5v to trigger the relays, so I'm looking into ways of doing that. : )
probably easier to switch back to low level trigger and use a 2n2222 transistor and a 470Ω resistor like this

Image

So now when you apply a high signal to the transistor base you will trigger the relay by connecting a ground to the CH / IN pin.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Relay Issues

Wed Jun 13, 2018 12:27 pm

Z80 Refugee wrote:
Sat Jun 09, 2018 11:21 pm
That's not what it says on the advertised product details. If you can find me a circuit diagram for the relay board I will be able to comment further.
I also have a module with High/Low trigger selectable. I made guesses and drafted a schematic. I have proofread 90% of it. You might like to use it for reference. I think Rpi works only when High trigger is selected. Arduino should work in both High or Low trigger select.
02ndrgC[1].jpg
relay high low select
02ndrgC[1].jpg (131.89 KiB) Viewed 1270 times
I am an electronics and smart home hobbyist.

Return to “Troubleshooting”