SainSmart relay board

Hi to all ! Am reopening this topic because i finally get the boards so i can test it directly.

Board:

formatting link

Some schematics / not checked:

formatting link

My question is how to connect this 12V relay board to raspberry. If i connect it like:

RSP----------RELAY

GND -------> GND VCC -------> 12V + from power adapter IN1 -------> GPIO raspberry

This setup is not working.

------------------------------------------------------

If i connect

RSP----------RELAY

GND -------> IN1 VCC -------> 12V + from power adapter GND -------> ?

red indicator light lights up on the side. So this should be confirmation that relay is triggered in low state ? If so, how should i connect all this together ? The problem is that i dont hear any relay click when the light turns on...

Any suggestion is welcome !

Reply to
gm
Loading thread data ...

You risk Raspberry Pi: this setups sends about 9.7V on GPIO pin. This goes trough 820 Ohm resistor, so hopefully GPIO pin can handle that. However, with surviving GPIO pin the relay should be on, so if the relay is off then probably GPIO pin has failed...

I wrote (in your original thread):

: Assuming that marking on the board is accurate you should have : 12V ground connected to GND, connect 5V to VCC pin, : remove jumper joining VCC and JD-VCC and connect : 12V to JD-Vcc pin. Low signal on IN1 (or IN2) should : activate corresponding relay.

In other words:

RSP----------RELAY

GPIO -------> IN1 | control circuit

5V -------> VCC | -------> JD-VCC 12V + from power adapter | relay power -------> GND from power adapter |

There is no need to connect Raspberry Pi ground to the relay. Without ground connection there is less risk that by mistake you burn something on Raspberry Pi.

For test you may connect as follows:

RSP----------RELAY

GND -------> IN1 | control circuit

5V -------> VCC | -------> JD-VCC 12V + from power adapter | relay power -------> GND from power adapter

this should turn on the relay. If this works, but the connection with GPIO pin does not work, then the problem is either program or burnt GPIO pin.

--
                              Waldek Hebisch
Reply to
antispam

No, of course not. Connecting the +5V pin from Rpi to the"Vcc" point on the relay board is required. Connecting the relay board 'ground' to the Rpi is not required. The second ".0Vcc" that connects to +12V is confusing...

On that schematic, Vcc is NOT supposed to be +12V, it is supposed to be the logic-level pullup resistor (and probably +5V, but maybe +3.3V...) look at the "digital I/O" spec on the Rpi and be aware that there may be damage.

Use your ohms setting on the meter to tell if the relay is closed or open. It's possibly just a quiet relay

Reply to
whit3rd

The blurb claims it will work, but they don't provide any details.

What does the blue jumper do?

that schematic is probably unrelated.

You need - from 12V power adaptor to GND also.

Also try the above with IN1 to +3.3V raspberry instead then with IN1 to GND instead - one of those two should click the relay and the other not.

--
This email has not been checked by half-arsed antivirus software
Reply to
Jasen Betts

Hi all and thank you for reply !

@Walbek I didnt look at your whole post, so it's my mistake. Sorry for that.

I have test it and its working great, so i guess it will work flawless when i run it throe program. Thank you for posting this answer !

Dzi?kuj? :-) ( if the google translation was correct )

-
Reply to
gm

The schematic shows an indicator diode in series with the optoisolator diode dropping around 4 volts total. When the IN1 signal is not grounded, the full 5 volts if placed on the input pin. The rPi chip is powered by 3.3 volts, so the parasitic diode on the rPi output turns on and conducts current into the substrate. This is not good. The only thing that allows this to work is the fact that as the current rises the voltage drop across the diodes rises limiting the current into the CPU chip. But I would not be comfortable relying on this level of protection. Too much current into this pin and the SCR latch up effect will be triggered. As long as this is the *only* output wired this way you may be ok. But use a few of these circuits and you can destroy the CPU chip, not just the output pin.

You can configure the output as an open drain (only pulls down and not up) and add an LED from the output to ground. This will limit the voltage seen on the IO pin and should still limit the current to a value which will keep the relay de-energized.

I don't understand why this board even uses an optoisolator. If they simply added a resistor in series with the transistor base and let the control signal provide the voltage, it would work just fine and eliminate the over-voltage issues of using a ground connection to switch the optoisolator current.

--

Rick C
Reply to
rickman

"Driving" the IN pin via voltometer shows 2.7V. Given 10 Mohm internal resistance of voltometer this gives 270 nA leakage current. 3.3V supply of Raspberry Pi + voltage drop on ESD diode means that leakage when connected to Raspberry Pi will be much smaller. Of course, at higher temperatures voltage drops will be smaller. However, AFAICS even at 80C there will be still safety margin keeping leakage in microamp range.

With this board one can probably use 3.3V as Vcc -- that would eliminate all worries about leakage. My estimate is that at -20C one will get 0.6 mA or more trough transistor base. That could be too little to drive 5V relay (needing 70 mA). However 12V relay needs only 30 mA, so as long as transistor beta remains above 50 it should work.

Actually the input part with optoisolator is completely isolated from the rest, there is no need to connect grounds. So unlike some other boards one may get separation when needed. One can ask why they put indicator LED in series with transoptor (or in series with transitor base in case with no transoptor). Some possible guesses are:

- they save one resistor compared to alternative curcuits

- they get current for indicatar LED "for free" (otherwise current trough LED would increase power consumption)

- they want less sensitive input

--
                              Waldek Hebisch
Reply to
antispam

That depends on variations in the two diodes in series in this circuit. The I-V curve for diodes is mostly logarithmic. If the applied Vcc is say, 5.5 volts (the max value with 10% tolerance) you will see a

*hugely* larger current. Add variation in the diodes and you may well be looking at significant current into the IO pin which can cause latchup. Maybe this isn't a problem, I don't know for sure. My point is that this is an overly complex circuit which can be done much more easily. Why is the optoisolator in there at all? I would think the transistor provides enough isolation by itself.

I don't see how you can say 3.3 volts Vcc would work. There are two LEDs in series. That would require some 3.6 volts minimum to drive enough current to turn on the LED in the optoisolator sufficient to activate the phototransistor.

Ok, ground isolation is a good reason to use an optoisolator. But it's not clear to me why the driver ground would need to be isolated from the controlling circuitry. The relay isolates the load. I guess someone is concerned about driving the coil of the relay using the same ground as the digital circuit. Seems to me a SSR would be easier. One part only.

--

Rick C
Reply to
rickman

There are three diodes: the two LED-s and ESD diode in BCM chip. Measured voltage drop on two LED-s is 2.3V. Estimating ESD diode drop at 0.6V we get 2.9V at room temperature. Rescaling to 80C we get 2.4V drop. 5.25V - 2.4V = 2.85V which still gives substantial margin for varation in diode parameters and 3.3V rail. OTOH at 5.5V margin gets uncomfortably small.

Buffering yes. But driving transistors directly you need to connect grounds, so no isolation.

Well, at first I thought the same. But then tried the circuit and it worked. With 3.3V drive current trough LED-s is more than 0.5 mA and this is enough for 5V relay (nominally 70 mA trough relay). The LED in optoisolator is an IR LED, so has small voltage drop. Also red LED-s have small voltage drop. In room temperature voltage drop on both LED-s is about 2.89V. I made mistake in my estimate above and at

-20C -- estimated voltage drop is getting close to 3.20V which leads to 0.1mA trough LED-s which may be too little.

I definitely prefer to drive this circuit from 5V, but if I had to bet between working or not working at 3.3V I would bet on working.

Well, when driving power circuit at some distance from a micro it makes sense to put relay close to the load and run longer wires for control circuit. In such case it may be convenient to connect relay power to the load. Without optoisolator such connection could lead to problems...

This relay is dirt cheap. ATM I have not seen DC SSR with isolation and similar current capability at comparable price. There are cheap modules with MOSFET-s, but the ones I saw have design problems...

--
                              Waldek Hebisch
Reply to
antispam

That is fine if you are building a gizmo for home, but for work you need to be sure; include worst case plus some margin.

What is a comparable price? I've been looking at SSRs lately and the price greatly depends on the load current. There are devices that will switch 4 amps at up to 60 volts DC for less than half the cost of this module... which is two channel, so the price is about the same per channel. Other voltages, currents and types are available. It's not like they are overly expensive. Relays need a bit more support circuitry to minimize arcing and you need to deal with the inductive kickback from the coil.

What design problems have you seen with SSRs?

--

Rick C
Reply to
rickman

.

DON'T use the jumper. Put 12V on the JD-VCC pin. Put 3.3V on VCC ( Connect IN1 and IN2 to the GPIO of the Rpi. Connect GN to Rpi GND

Here Rpi3 schematics:

formatting link

IN1 and IN2 will be inverted, it means that you need to put a 0 in order to close the relay, a 1 will open it.

Bye Jack

Reply to
jack4747

Relay modules like in this thread seem to cost about $2.5 at Aliexpress.

I saw cheap ($8.9 for 10) modules with IRF520, but they connect micro pin directly to the gate. There is a

1 k resistor to discharge the gate and 1k resistor in series with indicator LED. Here, it is not clear if IRF520 will turn on with 3.3V gate drive. With 5V drive IRF520 resistance is going to be relatively high. Module is sold without a heat sink, adding one is inconvenient because there is linited space between FET tab and a connector. In short: no isolation, probably unreliable at 3.3V, limited current and large losses at 5V.

There is another module, with four IRF540 for $6. This one uses optoisolators as voltage amplifiers: colector of phototransistor is connected to positive load voltage, emiter to FET gate. Again, there is

1k resistor + LED and 10k resistor parallel to the gate. Optoisolator LED anode is connected to input via 470 Ohm resistor (kathode is connected to ground). This is will probably work well with 12V load. But lower load voltage may mean too low voltage on the gate. High load voltage may lead to to high voltage on the gate. One can workaround problems with gate voltage by using separate gate supply and connecting load separately to higher/lower voltage. Again no heatsink and FET-s are mounted in a way which makes adding hard. In short: no isolation due to common ground, need appropriate voltage for gate drive, limited current due to lack of heat sink.

The second module is better than the first one, still it lacks features that I expect in a SSR.

--
                              Waldek Hebisch
Reply to
antispam

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.