guyd
Posts: 13
Joined: Wed Jun 27, 2018 7:28 am

Re: Relay' connected to Rpi Zero W - causes it to freeze

Sun Jul 15, 2018 4:06 pm

tlfong01 wrote:
Sun Jul 15, 2018 2:55 pm
guyd wrote:
Sun Jul 15, 2018 2:32 pm
I'll try to L/H jumper as suggested - it would be odd if that makes any diff resulting RPI to stop working due to power/ EMI or other
Well, the L/H jumper makes a difference not because of power/EMI, but because the circuit design. For L, the relay circuit assumes Rpi GPIO as a sink driver. For H, Rpi GPIO a source driver. The L and H circuits have different requirements. Arduino meets both requirements, but Rpi meets only the H requirement. Don't worry for now. Try my suggestion and see how it is going.

For the EMI problem, I have the following suggestion.

RE: RELAY MODULE KY-019 5V Post by tlfong01 » 2018-Jul-13 Fri 7:53 pm
viewtopic.php?f=63&t=77158&sid=2d46e36b ... 0#p1340412

BTW, I don't have any problem understanding your question. Actually I appreciated you thorough and well thought troubleshooting procedure, like swapping this and that to locate the cause.

Good luck.
Thank you for your compliment- I'll post an asnwer after I try your suggestion.
Guy

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

Re: Relay' connected to Rpi Zero W - causes it to freeze

Sun Jul 15, 2018 4:40 pm

guyd wrote:
Sun Jul 15, 2018 2:32 pm
1. I use common relays that operate at 5VDC, and triggered by gpio 3.3V. I do not think that labeling it as "Arduino" or "Raspberry Pi" does not make any technical difference.
It absolutely does, as several of us have said many times over. For some reason people see a 5V pin on the GPIO and assume that means they can wire things to it (and the other GPIO pins) without any prior consideration of what's going to happen. eBay suppliers are happy to sell stuff - they just hide the details where novices won't look (or won't understand), so you can't complain you've bought the wrong thing.

This lack of understanding about basic electronics is why software dabblers should not be dabbling with hardware. The Raspberry Pi is built to make it easy to dabble with software. It is not built to survive hardware abuse.

PLEASE, PLEASE, PLEASE: Unless you really understand electronics and the interfacing requirements of the Raspberry Pi, only EVER buy hardware modules that specifically say "suitable for Raspberry Pi".

Anything can be adapted, but that often means extra components which novices really don't want to do (and wouldn't be necessary if they bought the right thing in the first place). Don't buy it just because it's cheap, buy it because it's right.

Beginners Guide to Wiring Things to the GPIO
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)!

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

Re: Relay' connected to Rpi Zero W - causes it to freeze

Sun Jul 15, 2018 7:53 pm

tlfong01 wrote:
Sun Jul 15, 2018 10:19 am

  • 1. The first thing is that many of these relay boards don't have an option to [jumper] select high or low trigger

Ah, I think this board with the uncommon option of using a jumper to select High Level/Low Level trigger causes some confusion. The problem is a bit complicated. Let me clarify point by point and see if you agree what I am going to say.

There are two methods for Rpi to control the relay: (a) direct drive using 3.3V GPIO signal, (b) Indirect drive with a buffer/logical level converter. Let us discuss the first method.

For the first method of direct drive without buffer/logical level conversion, I need first describe the Arduino case and explain why there is no problem at all either the jumper is selecting High Level Trigger or Low Level Trigger.
if you use an arduino to drive the relay board either way it will work because the arduino has a 5v gpio even if you are powering the arduino from 3.3v the gpio is still 5v tolerant.
Next I will describe the Rpi case and explain why if jumper selects High Level Trigger, Rpi has no problem. But if jumpers selects Low Level Trigger, then Rpi won't work, the relay is always ON.

when using high level trigger ( which is not present on many of the relay boards people use and have problems with ) if may work if the resistor/led combination on the relay board has been chosen to work with both 5v and 3.3v, as long sufficient current can flow to light the led in the opto isolator the relay will activate.

the reason the low trigger will often not switch off the relay is because when the relay board is using 5v and the gpio as a ground the current can flow lighting the led, but when you then set a high because the pi gpio is only 3.3v some current can still flow and so it keeps the led lit just enough to keep the relay activated.

if you were using a 5v gpio as in the case of the arduino you would have 5v at both ends of the circuit so no current flow and led will not be lit and relay not activated.


A good way to see this for your self is to connect a 470Ω resistor in series with an led , then connected it between 3.3v pin on the pi and a gpio pin on the pi.

then if you drive the gpio pin low the led will be on current flowing from the 3.3v pin through the circuit to the ground provided by the gpio.
but if you drive the gpio pin high no current will flow and the led will be off because both ends of the circuit is at 3.3v
Remember we want information.......................no information no help
The use of crystal balls & mind reading is not supported

guyd
Posts: 13
Joined: Wed Jun 27, 2018 7:28 am

Re: Relay' connected to Rpi Zero W - causes it to freeze

Sun Jul 15, 2018 8:09 pm

Z80 Refugee wrote:
guyd wrote:
Sun Jul 15, 2018 2:32 pm
1. I use common relays that operate at 5VDC, and triggered by gpio 3.3V. I do not think that labeling it as "Arduino" or "Raspberry Pi" does not make any technical difference.
It absolutely does, as several of us have said many times over. For some reason people see a 5V pin on the GPIO and assume that means they can wire things to it (and the other GPIO pins) without any prior consideration of what's going to happen. eBay suppliers are happy to sell stuff - they just hide the details where novices won't look (or won't understand), so you can't complain you've bought the wrong thing.

This lack of understanding about basic electronics is why software dabblers should not be dabbling with hardware. The Raspberry Pi is built to make it easy to dabble with software. It is not built to survive hardware abuse.

PLEASE, PLEASE, PLEASE: Unless you really understand electronics and the interfacing requirements of the Raspberry Pi, only EVER buy hardware modules that specifically say "suitable for Raspberry Pi".

Anything can be adapted, but that often means extra components which novices really don't want to do (and wouldn't be necessary if they bought the right thing in the first place). Don't buy it just because it's cheap, buy it because it's right.

Beginners Guide to Wiring Things to the GPIO
thank you for sharing your knowledge

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

Re: Relay' connected to Rpi Zero W - causes it to freeze

Tue Jul 17, 2018 7:59 am

pcmanbob wrote:
Sun Jul 15, 2018 7:53 pm
tlfong01 wrote:
Sun Jul 15, 2018 10:19 am
... I need first describe the Arduino case and explain why there is no problem at all either the jumper is selecting High Level Trigger or Low Level Trigger.
if you use an arduino to drive the relay board either way it will work because the arduino has a 5v gpio even if you are powering the arduino from 3.3v the gpio is still 5v tolerant.

Ah, I guess I misled you. I did not mean to power 5.5V Arduino with Vcc = 3.3V operate Arduino at 3.3V. I meant Arduino users powering 5V Arduino normally with Vcc = 5V operating at 5V should have no problem either jumper selects High or Low. (Of course no problem - the 5V Arduino relay was originally designed to entertain 5V Arduino operating at 5V!)

Now a new situation. If a 3.3V Arduino 101 powered at Vcc = operating at 3.3V, even if its 3.3V GPIO pins are 5V tolerant, its High level is same as Rpi, less than 3.3V, not high enough to switch off relay. In other words the new 3.3V Arduino 101 operating at 3.3V has the same Rpi problem.

pcmanbob wrote:
Sun Jul 15, 2018 7:53 pm
... the reason the low trigger will often not switch off the relay is because ...
... when you then set a high because the pi gpio is only 3.3v some current can still flow ... and so it keeps the led lit just enough to keep the relay activated.
... A good way to see this for your self is to connect a 470Ω resistor ...
... but if you drive the gpio pin high no current will flow and the led will be off because both ends of the circuit is at 3.3v
This I fully agree. In short, add a 4K7 to relay input terminal IN, all problems solved!

BTW, I think we have different meanings of the term "5V tolerant". Perhaps I would discuss that later.


Update 2018jul17hkt2037
Or you might like to check out what the Arduino 101 guys think about the term.

What does "5V tolerant I/O" mean? Jun 24, 2017, 11:34 am
https://forum.arduino.cc/index.php?topic=485569.0

Operating Voltage 3.3V (5V tolerant I/O) Mar 13, 2016, 08:33 pm
https://forum.arduino.cc/index.php?topic=386191.0

Errata 2018jul17hkt2140
I forgot the traditional Arduino operating at 5V is powered by 7~12V, so I wrongly saying that powering 5V means operating at 5V. Similarly the new Arduino 101 operating at 3.3V is also powered by 7~12V. I have updated the misleading paragraphs. My apologies for any confusion.

Update 2018jul18hkt2055
After mentioning the new situation about Arduino 101, I thought Google might show me Arudino relay newbies having the same problem as Rpi. The first post I googled confirms that Arduino 101 indeed has the same problem, as I guessed. What I have never guessed is that the newbie is advised not to use 3.3V Arduino 101, buy a 5V Uno instead. This makes me laugh.

Re: Relay won't turn off...Help please? #10 Jan 10, 2018
https://forum.arduino.cc/index.php?topic=521122.0
The 101 and other 3.3volt Arduinos are for advanced tinkerers.
It seems to me that you are a beginner.
You should have bought a standard Uno if you're just playing with an LDR and a 5volt logic relay.
Even a $2 Nano clone will do what you want much better.
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

Return to “Add-ons”

Who is online

Users browsing this forum: No registered users and 6 guests