2

i'm new to this part of the forum and the raspberry. Hope my way of questioning is appropiate and that you can get a picture of what i'm talking about. Otherwise please be merciful.

I have a little problem with my lcd-monitor which is connected to my raspberry (hdmi) when turning on the 'R3'-Relay in the picture. The monitor switches on and off when i switch the relays. I don't intend to let the circuits run with the monitor connected, but i think there is propably something really 'unhealty' going on for my pi.

enter image description here

In this link you can see how the pi is connected to the relais module: https://docs.google.com/file/d/0B5-HND9HJkXWSTQtYlFTZ3VyODA/edit

I heard that its possible to use a capacitor to compensate voltage up- and downs, caused inductively by the relay, whose might be responsible for my problem. But where do i have to put them?

By the way, my transformer is not a RLTS80. I don't know my model. A simple voltage transformer. if the model makes any differences i will look it up.

The monitor is connected to the hdmi interface on the pi and its plug is in the same plugbar as the raspberry pi and the device which voltage i want to regulate.

I don't owe a phase tester.

2

I think it is important to use the 2N2222 based logical level shift up and buffer to take the 10~20mA sinking current from the optocoupler. If Rpi GPIO is directly connected to the optocoupler, the 15mA current might damage the GPIO pin circuitry.

Rpi-SainsmartRelay-Wiring

My suggested wiring is as below.

Rpi relay wiring

I am assuming OP's relay module is similar to this below.

sainsmart 8ch 5-v relay board

And the photocoupler similar to below.

el354 photocoupler

Below is a summary of the photocouopler.

el354 photocoupler summary

But I don't understand why Sainsmart says that their module can be controlled directly by Rpi, though at the same time each channel takes 15~20mA.

Sainsmart module current requirement

I found a relay module similar to Sainsmart, and has optocoupler, and with a limiting resistor of 1K. In other words, input drive current is only 4~5 mA. So I can use rpi to directly control this module.

rpi direct control relay module

el817 summary

I have also connected all the grounds together, just check out if there is any bad effects.

Measuring Relay Switch Noise/Interference

After skimming through a couple of EE SE and electro-tech-online.com forum discussions on relay noise, I have the feeling that relay noise is a complicated thing. The hardware guys suspect the noise feeds through the AC line. I have been playing only 5V/12V motors, and I dare not to play with big 220VAC motors for now. So I will start with light DC 1A loading, to see if I can find any spiking noise.

def toggleKY019GpioPin17():
    # tlfong01 2018may13hkt1228
    toggleRelay(relayPin = 17, activateLevel = 'High', \
                activateMilliSeconds = 20, deActivateMilliSeconds = 20, \
                toggleCount = 100000)
    return 

Relay switch noise checking

Noise waveform

I did not find any spiking noise at switch on and off. But the signal noise is around 1V pp. I don't know if these noise level is big or small. But the rpi program works OK, switch on and off at about 40mS period or 1/40mS = 25cps.

Varistor for Relay Surge Absorption

Now I have found a varistor with a broken leg

Varistor picture and spec

Varistor datasheet

Appendices

These appendices are for relay beginners.

A. SainSmart 8-Channel 5V Relay Module Ad

SainSmart 8-Channel 5V Relay Module Ad

B. SainSmart 8-Channel 5V Relay Module Rpi Wiring Diagram

C. SainSmart 8-Channel 5V Relay Module Schematic and Spec

SainSmart 8-Channel 5V Relay Module Schematic

Specification

Power Supply: 5V DC / 400mA (relay all ON)

Input control signal voltage:

0V - 0.5V Low stage (relay is ON)

2.5V –5V High state (relay is OFF).

Input control signal LOW state current: 2.5V: 0.1mA.

3.3V: 0.18mA.

5V: 0.35mA.

JD-VCC or VCC: Power supply input, 5V DC. (JD-VCC RELAY POWER VCC:SYSTEM VCC)

GND: Power supply ground and control signal ground.

CH_x: Control signal input, Low: relay ON, High: relay OFF.

COM / NO / NC: (C1=COM1, C2=COM2)

Control signal state low, the relay ON, COM - NO disconnected, COM - NC connected.

Control signal stage high, the relay OFF, COM - NO connected, COM - NC disconnected

D. How to wire a Raspberry Pi to a Sainsmart 5v Relay Board

D1. Pi and MCP23017 Based Heating Control system

E. Simple relay circuit getting noise spike form AC line

F. Relay noise problem although flyback diode is used

G. Transient Supressor - michaelkellett

The fan may be a much more difficult load than the lights - but if switching the relay makes it go wrong only if it's the fan that is switched then it is probably something to do with the characteristics of the fan/regulator combination.

I should mention that you need to be very very careful using the Sainsmart board to switch mains voltages - you must be very careful with your wiring and make sure things are in a box and firmly screwed down. You could try putting a transient suppressor across the relay contacts for the fan - something like:

Transient suppressor EPCOS 1004329 B72205S151K101

H. Introduction to Transient Voltage Suppressors

Relay with Transient Supressor

I. Mechanical Relay Primer

J. Relay Arc Suppression

For AC powered applications, you can put a Metal Oxide Varistor (MOV) across the load terminals of the relay in order to protect it from voltage spikes. An MOV will not remove the entire arc, but it will be helpful in circuits up to several hundred volts. You can buy an MOV from any electronics distributor, like this MOV from Digikey.

For low-voltage AC applications, a bi-directional transient voltage suppression diode ("transil diode") that is rated for higher than the AC voltage of the circuit can be placed across the relay terminals in order to protect it from voltage spikes. You can buy one from any electronics distributor, like this Transil Diode from Digikey.

K. Sain Smart Story

L. Sain Smart relay manuals

M. RLTS80 Transformer

RLTS80 transformer

N. Low Electromagnetic Noise Emission Solid State Relay news

Two kinds of emissions:

Radiated emissions - low with standard solid state relays

Conducted emission noise: with standard Solid State Relays, conducted emission noise is emitted by thyristors and at 150KHz you reach the highest level.

Standard low noise SSR on the market are limited to low switching current of 5A for domestic applications or to low inductive loads, while lots of pure resistive loads applications have high emission noise.

EMC stands for Electromagnetic Compatibility.

O. AC-DC Power Supplies - Using Wall Warts

Page 5 of 9 - Output Voltage vs Percentage Load (Switching Supplies)

P. Varistor ZOV10D471K Datasheet

Q. 20mA coil operating current relays

R. Circuit Design of 2N2222 Driving a Relay

.END

  • Thanks for your answer. The tranistors i'm using are PN2222A 6E tranistors. I have only one photocoupler here and i would need one for every relay i'm switching. i really don't understand why sainsmart was telling me that the circuit is "safe" the way they discribed it in the google-document..It is definetly not. Maybe they want me to destroy my raspi and learn more about optocoupling. – jo87casi May 26 '18 at 21:09
1

To your question about when there are two grounds, it is no longer a Raspberry Pi related question. However I hope a quick explanation will help those Raspberry Pi users tinkering with electronics parts.

When you separate Relay Power Supply (JD-VCC) from System Power Supply, you probably would want to separate the ground as well so that two parts of the system have total isolation. The "GND" at the header connecting to Raspberry Pi (or any kind of controller) is the System Ground that connect to Raspberry Pi, while the "GND" at the JD-VCC jumper is so called the Relay Power Ground. The circuit diagram below will help to illustrate that (the diagram may not be the exact circuit of your board).

schematic

simulate this circuit – Schematic created using CircuitLab

0

I found my problem. I was using 2K Resistors instead of 2.2K between the pin and the transistor gate. Now everything works perfectly.

  • How nice to hear the good news. But there should be almost no difference whether you use 2K or 2.2K. I still vote your answer up because I always found good troubleshooting news is good news. Happy relaying. – tlfong01 May 27 '18 at 23:58
  • One simple way to check if the 2.2K/2K makes any difference is put back the 2.2K and see if the problem comes back. You may also like to let me know the markings on the optocoupler (the 4 pin black chip, usually EL354, EL871C etc) and the resistors (2pin rectangular thing, usually 102, 221 etc) on the relay module. Then I can do some simple calculations to convince you. – tlfong01 May 28 '18 at 3:21
  • @tlfong01 : you're correct... we'll never know what happened, but one thing's for sure: changing from a a 2K R to a 2.2K R didn't correct the original problem. And btw, extraordinarily thorough answer :) – Seamus Jun 2 '18 at 13:57
  • @Seamus: I know my answer is extraordinarily long, relative to SE average. When giving an answer, I do have a couple of general guidelines, which, being general, contradict each other, so I need to make trade offs, based on other guidelines! ... One guideline I always consider first is Occam's Razor: "Make things as simple as possible, but not simpler". A similar guideline from Q&A websites is: "Make your answer as long as required, but as short as possible". – tlfong01 Jun 4 '18 at 5:37
  • Those are excellent guidelines! – Seamus Jun 4 '18 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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