zubayer077
Posts: 5
Joined: Fri Nov 09, 2018 2:30 am

Raspberry pi 30A relay

Fri Nov 09, 2018 3:27 am

Hi I am trying to operate this relay from raspberry pi,
https://www.ebay.ca/itm/142640797340

My question has 2 parts,

First of all I cannot turn it on using gpio in my pi. I connected pin 2 (5v), pin 6 (GND), pin 3 (IN1), pin5 (IN2). I don't hear any audible click when I run the following script.

Code: Select all

#!/usr/bin/python
import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)

# init list with pin numbers

pinList = [3, 5]

# loop through pins and set mode and state to 'high'

for i in pinList: 
    GPIO.setup(i, GPIO.OUT) 
    GPIO.output(i, GPIO.HIGH)

# time to sleep between operations in the main loop

SleepTimeL = 2

# main loop

try:
  GPIO.output(3, GPIO.LOW)
  print "ONE"
  time.sleep(SleepTimeL); 
  GPIO.output(5, GPIO.LOW)
  print "TWO"
  time.sleep(SleepTimeL);
  GPIO.cleanup()
  print "Good bye!"

# End program cleanly with keyboard
except KeyboardInterrupt:
  print "  Quit"

  # Reset GPIO settings
  GPIO.cleanup()
Can anyone shed some lights on it. The product details says when the high level trigger is selected through jumper wire, the operating voltage is 1.5-5v. I am using 5V 3A adapter, I should have enough power to trigger this relay.

Second part,
Does anyone know how to connect wires on high voltage side. I am particularly curious about the 120v~250V connectors in the center which in the circuit connects to c1Isolated Power board. If I explain differently, each relay has 4 connectors on the High voltage side, 1NC, 1NO, 1Common and 1 120~240V. I am curious to know how this 120V is connected.

I greatly appreciate if any input from anyone aware of this kind of relays and how they can be connected to control 120V voltage.

RattusRattus
Posts: 67
Joined: Sat Sep 29, 2018 11:27 am

Re: Raspberry pi 30A relay

Fri Nov 09, 2018 12:09 pm

CAUTION I HAVE NOT SEEN THE SCHEMATICS - I AM OFFERING AN OPINION BASED ON YOUR POST AND LOOKING AT THE EBAY ITEM ONLY

This looks like there is a power supply to drive the 'solid state' (?) relays sate between the two.

As such it looks like you need to give the system mains (either 110 or 240VAV) on the middle two pins to power the module.
without that power nothing you do on the inputs will have any effect on the 'relay' terminals.

If these really are solid state relays then you wouldn't expect to hear a click - Solid state relays are an electronic module that replicates the electro mechanical operation of a relay using solid state electronics (i.e. TRIACs).

Perhaps it would be a good idea not to connect to your RPi until you have confirmed that you can operate each channel by switching a DC voltage on the input (a couple of AA batteries to give you 3V drive?) because getting this wrong and getting mains back feed into your Pi (and anything else it is connected to INCLUDING YOURSELF would be BAD)

/Andy

LTolledo
Posts: 2132
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Raspberry pi 30A relay

Fri Nov 09, 2018 1:47 pm

to make it simple, you cannot (and will never ever) turn ON an AC100V relay with just 3.3V DC directly from the RPi's GPIO.

even "5V relays" dont usually work well directly on RPi's 3.3V GPIO...

better test it first with a 3V battery to confirm it the relay actually turns ON.
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

Brandon92
Posts: 775
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Raspberry pi 30A relay

Fri Nov 09, 2018 4:20 pm

This statement is not true:
"2-channel AC100-250V 30A Solid State Relay Module Board High/Low Level Trigger"

Because it is a normal relay, datasheet.
And the coil voltage is 5v.

What for kind of load to you want to switch wiyt this relais. Depending on the load, the maximal switching current decrease fast. And can you make a diagram of how you think you should connect it. Then we can see if it is a good idea for you to do this.

I so wondering if the isolation barrier between you Rpi interface and the other part of the circuit is according to the safety requirements.

Note, this is based on if the image is correct in your eBay link

wh7qq
Posts: 1345
Joined: Thu Oct 09, 2014 2:50 am

Re: Raspberry pi 30A relay

Sat Nov 10, 2018 6:07 am

There is a very high likelihood that you are going to have a pile of ash when you attempt to switch a high voltage load if you don't kill yourself in the process. From the questions you ask and the level of understanding they demonstrate, you should not proceed unless you have a licensed electrical contractor at your side.

According to the Songle datasheet, there seems to be a disconnect between reality and the description. This relay has a coil and contacts. It is not solid state, but mechanical. The coil on the 5v model has a 27 ohm resistance and will draw 185 ma at that voltage. If you attempt to source or sink this kind of current from the RPi, you are simply out of luck. the GPIO pins have a maximum current of 16 ma. That level of current would clearly require a power transistor or power Mosfet to drive it from the RPi. There are plenty of interface documents on the web that show that kind of circuitry and it is simple. There is a very high likelihood that you are going to have a pile of ash when you attempt to switch a high voltage load if you don't kill yourself in the process.

A better choice is to use a SSR (solid state relay) which can be driven directly (through a small resistor) from the GPIO pins. They are available that will switch up to 100 A at 240 v which is more than enough to handle your load. I use such a relay to switch the 240 v 24 a load of my electric water heater element. It does require a heat sink and I also use a fan in an abundance of paranoia. The SSR does an excellent job of isolating the RPi from the AC circuit as the only connection is by way of light.

drgeoff
Posts: 9912
Joined: Wed Jan 25, 2012 6:39 pm

Re: Raspberry pi 30A relay

Sat Nov 10, 2018 8:55 am

I don't downplay the valid safety concerns of wh7qq and others about working with mains electricity but he is not 100% technically correct in his analysis of the relay board pictured in the listing linked to in the opening post. Those pictures show a transistor driving each relay coii - Q1 and Q2. They also show U1 and U2 which have the physical appearance and footprint of an optocoupler and I cannot come up with an explanation of what other type of component they might be. Hence to claim that the RPI GPIO needs to source or sink 185 mA is incorrect.

The board contains a small 5 volt PSU - the daughterboard between the relays. That provides the coil current.

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

Re: Raspberry pi 30A relay

Sat Nov 10, 2018 11:11 am

So looking up the relay data sheet shows it a physical relay , and each appears to have an opto isolator /transistor driver circuit, my guess would be that it suffering the same problem as most of the other relay boards designed to work at 5v , in that the pi gpio being 3.3v just cant activate or release the relay because of the voltage difference.

I would set the relay board to active low and just use a transistor drive circuit between the pi gpio and the trigger terminals on the relay board.

like this.

Image

Before doing this try testing the relay board by connecting 5v and ground with it set to active low try connecting ch1 to ground the relay should switch, ch2 should produce the same result when connected to ground.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Brandon92
Posts: 775
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Raspberry pi 30A relay

Sat Nov 10, 2018 11:31 am

I also agree with drgeoff. That the onboard powersupply power the relay. And I (hope) that the optocoupler* is driven by the Rpi and that the optocoupler drive the transistor and then the relay. But as a isolation layer the optocouple his mean "feacture" is somewhat canceled by the traces under the optocoupler itself. And yes, there is a extra powersupply, but you also don't know if it the isolation barrier is save.

*By the looks of that part.

Also, the the burning mark by R1 is also not a good sign of the quality of this board:
Image
wh7qq wrote: A better choice is to use a SSR (solid state relay) which can be driven directly (through a small resistor) from the GPIO pins. They are available that will switch up to 100 A at 240 v which is more than enough to handle your load. I use such a relay to switch the 240 v 24 a load of my electric water heater element. It does require a heat sink and I also use a fan in an abundance of paranoia. The SSR does an excellent job of isolating the RPi from the AC circuit as the only connection is by way of light.
That also depents on what type of SSR you are using and what for kind of load that you are using. And the quality / brand of that part is also a imported part of this. Because, if you use a well know brand, those relays are not the cheapest arround there. And there will work with the specification that the manufacture says. And the cheap-ones are not.

zubayer077
Posts: 5
Joined: Fri Nov 09, 2018 2:30 am

Re: Raspberry pi 30A relay

Sat Nov 10, 2018 4:58 pm

RattusRattus wrote:
Fri Nov 09, 2018 12:09 pm
CAUTION I HAVE NOT SEEN THE SCHEMATICS - I AM OFFERING AN OPINION BASED ON YOUR POST AND LOOKING AT THE EBAY ITEM ONLY

This looks like there is a power supply to drive the 'solid state' (?) relays sate between the two.

As such it looks like you need to give the system mains (either 110 or 240VAV) on the middle two pins to power the module.
without that power nothing you do on the inputs will have any effect on the 'relay' terminals.

If these really are solid state relays then you wouldn't expect to hear a click - Solid state relays are an electronic module that replicates the electro mechanical operation of a relay using solid state electronics (i.e. TRIACs).

Perhaps it would be a good idea not to connect to your RPi until you have confirmed that you can operate each channel by switching a DC voltage on the input (a couple of AA batteries to give you 3V drive?) because getting this wrong and getting mains back feed into your Pi (and anything else it is connected to INCLUDING YOURSELF would be BAD)

/Andy
I connected to RPi 5V and tried to energize the relay with the RPi 5V source. This relay has a operating voltage of 1.5~5V. However it didn't work. So I am assuming the board is powered by the extra power source on the high voltage side.

zubayer077
Posts: 5
Joined: Fri Nov 09, 2018 2:30 am

Re: Raspberry pi 30A relay

Sat Nov 10, 2018 5:13 pm

wh7qq wrote:
Sat Nov 10, 2018 6:07 am
There is a very high likelihood that you are going to have a pile of ash when you attempt to switch a high voltage load if you don't kill yourself in the process. From the questions you ask and the level of understanding they demonstrate, you should not proceed unless you have a licensed electrical contractor at your side.

According to the Songle datasheet, there seems to be a disconnect between reality and the description. This relay has a coil and contacts. It is not solid state, but mechanical. The coil on the 5v model has a 27 ohm resistance and will draw 185 ma at that voltage. If you attempt to source or sink this kind of current from the RPi, you are simply out of luck. the GPIO pins have a maximum current of 16 ma. That level of current would clearly require a power transistor or power Mosfet to drive it from the RPi. There are plenty of interface documents on the web that show that kind of circuitry and it is simple. There is a very high likelihood that you are going to have a pile of ash when you attempt to switch a high voltage load if you don't kill yourself in the process.

A better choice is to use a SSR (solid state relay) which can be driven directly (through a small resistor) from the GPIO pins. They are available that will switch up to 100 A at 240 v which is more than enough to handle your load. I use such a relay to switch the 240 v 24 a load of my electric water heater element. It does require a heat sink and I also use a fan in an abundance of paranoia. The SSR does an excellent job of isolating the RPi from the AC circuit as the only connection is by way of light.
I understand there is a risk associated in working with high voltage AC source, precautions including building the circuit in an isolated power protected with a fuse etc. is important.

I have an old server that draws 270~300W at its peak. My primary goal is to turn the server on or off with this CKT, however I want to try devices like rice cooker, kettle etc. Domestic fuses has a limit on 15A, so I am not expecting to operate anywhere close to current limit this relay specifies.

Do you suggest any SSR relay which has current limit of 15A that works with Raspberry pi without any extra breadboard circuitry.

zubayer077
Posts: 5
Joined: Fri Nov 09, 2018 2:30 am

Re: Raspberry pi 30A relay

Sat Nov 10, 2018 5:25 pm

Brandon92 wrote:
Sat Nov 10, 2018 11:31 am
I also agree with drgeoff. That the onboard powersupply power the relay. And I (hope) that the optocoupler* is driven by the Rpi and that the optocoupler drive the transistor and then the relay. But as a isolation layer the optocouple his mean "feacture" is somewhat canceled by the traces under the optocoupler itself. And yes, there is a extra powersupply, but you also don't know if it the isolation barrier is save.

*By the looks of that part.

Also, the the burning mark by R1 is also not a good sign of the quality of this board:
Image
wh7qq wrote: A better choice is to use a SSR (solid state relay) which can be driven directly (through a small resistor) from the GPIO pins. They are available that will switch up to 100 A at 240 v which is more than enough to handle your load. I use such a relay to switch the 240 v 24 a load of my electric water heater element. It does require a heat sink and I also use a fan in an abundance of paranoia. The SSR does an excellent job of isolating the RPi from the AC circuit as the only connection is by way of light.
That also depents on what type of SSR you are using and what for kind of load that you are using. And the quality / brand of that part is also a imported part of this. Because, if you use a well know brand, those relays are not the cheapest arround there. And there will work with the specification that the manufacture says. And the cheap-ones are not.
I agree with drgeoff and you that the onboard powersupply power the relay. From this image
Image
it may seem that the connector connects to line and neutral of power supply. Do you think there may be a chance of polarity between them!!

My last question is if the onboard daughterboard powers the relays, then why do we need extra +5V and GND on the low voltage side. It would have been easier to answer if we have complete schematic of this board (may be to energize the low voltage side circuitry).

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

Re: Raspberry pi 30A relay

Sat Nov 10, 2018 6:03 pm

zubayer077 wrote:
Sat Nov 10, 2018 5:13 pm
.....
Do you suggest any SSR relay which has current limit of 15A that works with Raspberry pi without any extra breadboard circuitry.
I have some of these and they work fine directly connected to the RPi GPIO: https://documents.opto22.com/0859_Solid ... _sheet.pdf
The actual part I have is 240D45 and I had no problem turning on/off a 10A 120VAC load.
As mentioned some of the China copies may not work as well.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

wh7qq
Posts: 1345
Joined: Thu Oct 09, 2014 2:50 am

Re: Raspberry pi 30A relay

Sat Nov 10, 2018 8:10 pm

Must admit that I missed the separate daughter board power supply for the relay coil current. I hope the transformer provides sufficient isolation between primary and secondary. I also hope that those (maybe) opto-couplers that I missed in the board pics are what they appear to be. The board builder/seller have not provided schematics of the board so we are left to guess and pray. The physical cuts (dark "U" shapes) on the board to isolate those fat contact traces (underside) are scary looking. The lack of proper documentation is intimidating as well.

Opto 22 and other name brand SSRs are expensive and are very good but are probably made in the same far-eastern factory that pumps out cheaper ones. With proper testing agency certification (and UL has documented some counterfeits so be wary) they do not have to be expensive. SSR's have several advantages: they can be driven directly (through a series resistor) from the GPIO pins, they offer optical isolation between the controller and the load, zero-crossing switching and hermetic sealing which eliminates contact sparking and RF interference and they are physically noiseless.

On the minus side, they utilize triacs for the switching element which can fail in the shorted mode if subjected to a high voltage transient, and when conducting normally, they have a roughly 1.6 volt drop across them which requires a heat-sink unless currents are low (P=IV). If the load being switched is critical and must turn off (like an aquarium heater..unless you like your fish cooked :D ) they are a dangerous choice but if your load can stay on continuously without major consequence and you provide adequate heat management, they are an excellent choice. You do need to pay attention to the voltage requirement on the opto-coupler side as some models require more than the nominal 3 volts for turn-on. In that case, a transistor driver circuit such as shown above by @pcmanbob is needed.

Depending on fuses for protection is questionable practice, as they require a finite time to blow which can result in dangerous shock or damage to downstream components. Semi-conductors are very good at protecting fuses :D.

drgeoff
Posts: 9912
Joined: Wed Jan 25, 2012 6:39 pm

Re: Raspberry pi 30A relay

Sat Nov 10, 2018 9:46 pm

Circuit diagram
CCI_000006.jpg
CCI_000006.jpg (51.63 KiB) Viewed 1394 times
Left side half shown. Part numbers in brackets for right side half. D2, C1 and HL jumper shared between both.

5 volt supply can come from either onboard PSU or an external supply. Latter for when board is used for non-mains switching ie no ac 100-240 readily available.

PhatFil
Posts: 1436
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Raspberry pi 30A relay

Sun Nov 11, 2018 1:40 am

Whats the job here? what will the relay be switching on/off. and under what circumstances? For most hi load applications SSRs Solid State Relays can be a superior solution to the traditional magnetic coil type relay as well as cheaper and easier to implement ;)

zubayer077
Posts: 5
Joined: Fri Nov 09, 2018 2:30 am

Re: Raspberry pi 30A relay

Sun Nov 11, 2018 3:22 am

PhatFil wrote:
Sun Nov 11, 2018 1:40 am
Whats the job here? what will the relay be switching on/off. and under what circumstances? For most hi load applications SSRs Solid State Relays can be a superior solution to the traditional magnetic coil type relay as well as cheaper and easier to implement ;)
I am trying to on off an old IBM server. The server reaches to almost 300W under peak operating conditions. The power supply has a 725W rating, but I never observed it reaching that. The relay will turn on off one of the power supply.
I didn't understand the question of circumstances. However I understand at peak load if the relay board fries, the server continues to work, it may not do more harm than running a bit longer.

Return to “General discussion”