kaos wrote: ↑Wed Aug 22, 2012 5:48 pm
I suspect that this particular board
[Note 1] might give problems, if connected directly to the GPIO. ...
If you can find (or make) a relay board with a schematic that is a mirror image of this one; that is, uses NPN type transistors with emitter tied to ground, and the relay connected between Vcc and collector of the transistor, then chances are it will work with the Raspi's 3.3V signals, even if it is designed for 5V. ...
Note 1 - The board referred is
http://www.elecfreaks.com/store/8-chann ... p-268.html. This 4 year old link is already broken. I guess a similar board is the following:
5V Low Level Trigger One 1 Channel Relay Module DC AC 220V Interface Relay Board Shield LED Indicator for Arduino
https://www.aliexpress.com/item/5V-Low- ... 27376.html
I also found the following interesting:
Common Pitfalls for Beginners #25 Problems with relay modules - mahjongg, Forum Moderator 2017oct22
viewtopic.php?f=91&t=83372&p=1225448#p1225448
Summary
... raspberry pi has had difficulties getting it working,
... main reason: modules designed to work with Arduino that uses 5V signal
... designers not considered with [rpi] 3.3V signal
... nor do the sellers of these modules care.
... typical sainsmart relay module contains an opto-isolator wired to be "active low",
... problems with this design;
... normally the opto-isolator is powered with 5V, input is expected to either go to 0V or 5V.
... but if put 3V3 on the input pin, ... the armature keeps stuck [problem: relay always on].
... one could program the GPIO input pin so becomes high-ohmic [set GPIO to input mode = high impedance], [relay will be off]
... downfall of approach is that there might appear a voltage on the GPIO larger than 4V,
... might cause the dreaded "latch up" phenomenon as the GPIO's of a PI are NOT 5V TOLERANT!
... see
https://en.wikipedia.org/wiki/Latch-up for an explanation
... maybe the two diodes (LED's) might prevent latchup in practice, so it might work, but your mileage might vary!
... obvious solution would be to lower then Vcc voltage to 3.3V, but but GPIO 3.3Volt not enough to light up the two LED's
... this renders these relay modules very hard to use with a 3.3V based system like Rpi.
... problem exacerbated by sellers, especially on e-bay almost never let you see the schematics.
... one solution would be short out the indicator LED, but that means
soldering ( a skill that anyone calling himself an
... electronic engineer cannot go without by the way, and its not as hard as it looks, just mind not to touch any of the metal of the soldering
... iron during use). (Note 1)
... best solution use another transistor to turn on and off the LED current. (Note 2)
... or simply buy a better suitable relay board, something simple without an opto-isolator like this: (Note 3)
Note 1 - I am an electronics hobbyist, and I hate SMDs, not to mention soldering them. See the two video/article below.
Are Electronics Hobbyists Useless?
https://www.youtube.com/watch?time_cont ... iXFhKUa1BU
Electronics Still Thrives as a Hobby – Lou Frenzel | May 17, 2018
Most electronic hobbyists hate surface-mount devices (SMD). - A survey report
http://www.electronicdesign.com/analog/ ... ives-hobby
Note 2 - I found the following thread useful for the best solution mentioned above. I think the NPN transistor in open collector mode is actually a 3.3V to 5V logical level converter and digital buffer.
Sainsmart relay Fri Oct 05, 2012
[urlhttps://
www.raspberrypi.org/forums/viewtopic.php?f=44&t=19222][/url]
Note 3 - mahjongg's schematic of the recommended relay module is a bit complicated. So I removed the not very relevant details and attach the simplified version below.
![5bRaJT9[1].jpg](./download/file.php?id=23153&sid=52d255f02d79db1302ea59ebdad95d20)
- ky-019 type d v0.1
- 5bRaJT9[1].jpg (49.34 KiB) Viewed 4353 times