The PCB bottom side says it is High level triggered, same as the spec. One very good thing about the spec is that it says, the AC200V 10A limit is only the theoretical number, the recommended current limit is only 6A.tlfong01 wrote: ↑Mon Jun 18, 2018 7:06 amLast week I bought some 20 different models of relay boards from ShenZhen, for experimentation. I found one model similar to the Xsource one. So I am going to check it out.
This cheap relay broad cost me only 4 Chinese Yuen. So I don't worry frying it by careless mistake.
Re: Relay Module KY-019 5V
- Attachments
-
- Zspt1eD[1].jpg (152.17 KiB) Viewed 5394 times
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
Now I am using a multi meter to check the connections on the PCB and guessing the schematic.tlfong01 wrote: ↑Mon Jun 18, 2018 7:12 amThe PCB bottom side says it is High level triggered, same as the spec. One very good thing about the spec is that it says, the AC200V 10A limit is only the theoretical number, the recommended current limit is only 6A.tlfong01 wrote: ↑Mon Jun 18, 2018 7:06 amLast week I bought some 20 different models of relay boards from ShenZhen, for experimentation. I found one model similar to the Xsource one. So I am going to check it out.
This cheap relay broad cost me only 4 Chinese Yuen. So I don't worry frying it by careless mistake.
- Attachments
-
- UALnDnv[1].jpg (137 KiB) Viewed 5326 times
Last edited by tlfong01 on Mon Jun 18, 2018 9:10 am, edited 1 time in total.
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
This is the second version of the schematic. I think they are 90% correct.
I think what you suggested is to put the 4K7 in parallel with R1. Or as many others suggested, simply short out LED 2.
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
There is no led2 Sw (as you show it) on my version. The second led is in the output to the relay, you see it connected to the flyback diode
Re: Relay Module KY-019 5V
I am again confused. In version 2 of schematic, there is no LED connected to the fly back diode. Perhaps I should check one more time.
Now I am checking out the Vin-turn-on and Vin-turn-off points using an adjustable regulated power supply with voltmeter and current meter. The voltage adjustment is very user friendly: pressing left button voltage goes down, and right button goes up.
As I vary the voltage from 0.5V to 4.5V The LED 2 in green changes from dark to dim, and to bright green. My cheap DVM is not accurate in current measurements under 10mA, so I am not taking this value. Anyway, Vin is critical, Iin (current to optocoupler) is not important for my test now.
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
This thing costs me CNY40, but I think it is good value for my money. The regulator used is MP2307 3A, 23V, 340KHz Synchronous Rectified Step-Down Converter. Another good thing is that the lowest voltage output is 0.00V, not like others only from 1.2V. The resolution of 0.03V is also good.tlfong01 wrote: ↑Mon Jun 18, 2018 8:36 amNow I am checking out the Vin-turn-on and Vin-turn-off points using an adjustable regulated power supply with voltmeter and current meter. The voltage adjustment is very user friendly: pressing left button voltage goes down, and pressing right button voltage goes up, holding button voltage changes fast.
- Attachments
-
- c9cOvSg[1].jpg (95.11 KiB) Viewed 5315 times
Last edited by tlfong01 on Mon Jun 18, 2018 9:29 am, edited 1 time in total.
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
Your pcb is different to mine, the components look in the same place but the tracks are different! My input goes direct to Pin2 of the opto coupler.tlfong01 wrote: ↑Mon Jun 18, 2018 8:36 amI am again confused. In version 2 of schematic, there is no LED connected to the fly back diode. Perhaps I should check one more time.
Now I am checking out the Vin-turn-on and Vin-turn-off points using an adjustable regulated power supply with voltmeter and current meter. The voltage adjustment is very user friendly: pressing left button voltage goes down, and right button goes up.
As I vary the voltage from 0.5V to 4.5V The LED 2 in green changes from dark to dim, and to bright green. My cheap DVM is not accurate in current measurements under 10mA, so I am not taking this value. Anyway, Vin is critical, Iin (current to optocoupler) is not important for my test now.
- Attachments
-
- Zspt1eD[1].jpg (152.17 KiB) Viewed 5315 times
-
- FKRCERU[1].jpg (218.26 KiB) Viewed 5315 times
Re: Relay Module KY-019 5V
Really?, so it means your relay board is indeed Low level triggered?
Test results
Sample 1 turn off = 1.06V min, turn on = 1.20V max
Sample 2 turn off = 1.15V min, turn on = 1.33V max
Sample 3 turn off = 1.15V min, turn on = 1.37V max
Sample 4 turn off = 1.07V min, turn on = 1.22V max
Sample 5 turn off = 1.04V min, turn on = 1.18V max
For these 5 samples, there seems no problem for Rpi's Low of 0.6V max and High 2.4V min.
Last edited by tlfong01 on Wed Jun 20, 2018 1:14 am, edited 1 time in total.
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
I also bought a couple of NPN driver, High level trigger modules, for only 3 yuen each. Now I am checking out their Vin turn on and Vin turn off voltages.
Test results
Sample 1 - Vin on = 2.43V, Vin off = 2.28V
Sample 2 - Vin on = 2.43V, Vin off = 2.32V
Sample 3 - Vin on = 2.39V, Vin off = 2.28V
Sample 4 - Vin on = 2.36V, Vin off = 2.28V
Sample 5 - Vin on = 2.39V, Vin off = 2.28V
- Attachments
-
- HWP2npw[1].jpg (189.26 KiB) Viewed 5272 times
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
Now these opto high/low select modules costs me 5 yuan each.
Test results
Sample 1
Select High - Vin on = 1.99V, Vin off = 1.55V
Select Low - Vin on = 2.90V, Vin off = 3.45V (Rpi relay newbie's sorrow!)
Sample 2
Select High - Vin on = 1.92V, Vin off = 1.62V
Select Low - Vin on = 2.90V, Vin off = 3.27V (Rpi relay newbie's sorrow!)
Sample 3
Select High - Vin on = 1.95V, Vin off = 1.59V
Select Low - Vin on = 3.01V, Vin off = 3.42V(Rpi relay newbie's sorrow!)
Sample 4
Select High - Vin on = 1.95V, Vin off = 1.53V
Select Low - Vin on = 3.01V, Vin off = 3.49V (Rpi relay newbie's sorrow!)
Sample 5
Select High - Vin on = 1.81V, Vin off = 1.66V
Select Low - Vin on = 3.09V, Vin off = 3.47V (Rpi relay newbie's sorrow!)
- Attachments
-
- 8pSUU9R[1].jpg (152.67 KiB) Viewed 5262 times
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
I have made a summary of the test results.
- Attachments
-
- 2WdOfXG[1].jpg (157.75 KiB) Viewed 5215 times
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
So far these weeks I have been playing with single channel relay boards. My plan is to first get some experience on single channel boards, then try 4 channel boards, then 8, then 16. The first 4 channel relay board is the one attached below. I think this board is similar to the one discussed below.
Relay Issues - Sun Jun 10, 2018 4:46 am
viewtopic.php?t=215582
So I ordered a 24v relay
https://www.amazon.com/gp/product/B0789 ... SLEZQ&th=1
There are jumpers to switch between LOW and HIGH triggers. Currently they are HIGH as LOW turned all of the relays on and I wasn't able to turn them off. ... I've seen posts saying external power should go through JD-VCC but this relay doesn't have that available. I feel like I must have this wired wrong but I'm too inexperienced to know. Do I need to wire this up with transistor/resistors? ...
The Amazon seller Knacro says their relay is High /Low level trigger selectable, with optocoupler isolation, and for Arduino. No schematic is given. I guess when the module is compatible to Rpi in High level trigger mode, but not in Low trigger mode.
I have found a similar High/Low trigger selectable module. Now I am trying to guess a schematic, then check out the Vin-turn-on-relay and
Vin- turn-off-relay values.
- Attachments
-
- JWQmNkg[1].jpg (176 KiB) Viewed 5189 times
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
I am not too sure the use of the JD-Vcc jumper. So I tested 4 such relay boards. I found that only the dual relay board has the JD-Vcc jumper. It appears that most of the new versions of relay boards no longer have JD-Vcc jumpers.tlfong01 wrote: ↑Wed Jun 20, 2018 9:00 amSo far these weeks I have been playing with single channel relay boards. My plan is to first get some experience on single channel boards, then try 4 channel boards, then 8, then 16. The first 4 channel relay board is the one attached below. I think this board is similar to the one discussed below.
Relay Issues - Sun Jun 10, 2018 4:46 am
viewtopic.php?t=215582
So I ordered a 24v relay
https://www.amazon.com/gp/product/B0789 ... SLEZQ&th=1
There are jumpers to switch between LOW and HIGH triggers. Currently they are HIGH as LOW turned all of the relays on and I wasn't able to turn them off. ... I've seen posts saying external power should go through JD-VCC but this relay doesn't have that available. ...
- Attachments
-
- jKF2hIa[1].jpg (142.04 KiB) Viewed 5173 times
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
The JD-VCC link normally allows you to use the connected vcc supply or an external supply for the relay coils.
- Attachments
-
- relay mod.jpg (13.78 KiB) Viewed 5158 times
Re: Relay Module KY-019 5V
Your schematic is good. Now I know why you earlier used a 4K7 across optocoupler anode to IN. But I still don't know exactly why using two power supplies, and is there any risk of connecting Rpi's 3V3 power pin to relay module's Vcc pin (after removing the JDVcc/Vcc jumper).
So I googled and found the following discussion. I think I need some time understanding the argument there. I am slow because I am not that good in US English - it is only now that I learnt how the US guys use the verb "call'.
SainSmart 2-Channel Relay Module 4.5 out of 5 stars 114 customer reviews | 26 answered questions
https://www.amazon.com/dp/B0057OC6D8/ref=cm_sw_su_dp
5V 2-Channel Relay interface board, and each one needs 15-20mA Driver Current
Standard interface that can be controlled directly by microcontroller (Arduino , 8051, AVR, PIC, DSP, ARM, ARM, MSP430, TTL logic)
Docooler 5V Active Low 2 Channel Relay Module Board for Arduino PIC AVR MCU DSP ARM
https://www.amazon.com/dp/B00DIMGFHY/ref=cm_sw_su_dp
Customer questions & answers
Neil in NC 3.0 out of 5 starsDon't expect documentation nor help August 5, 2013
When this arrived I was pleased to see that it appears to be well made, should work fine in my application. The problem is that there was not even a scrap of paper, schematic, pinout diagram, NOTHING. When I emailed the seller, he replied (in broken English) that they have no documentation.
The good news (so far) is that this is a pretty common board, I was able to find documentation by searching various things with Google. Long story short, leave the [JD-Vcc] jumper in unless you want to isolate the relay supply from the signal supply.
The verb 'call' has many meanings. ..., it can mean 'cry out',
https://ell.stackexchange.com/questions ... we-call-bs
andrewshilliday/garage-door-controller - Bad wiring schematic #16 - lamping7 opened this issue on Dec 22, 2015 · 22 comments
https://github.com/andrewshilliday/gara ... /issues/16
https://github.com/andrewshilliday/gara ... /README.md
gwhiteCL commented on Jun 10, 2017
I'm an EE. Unless you can explain exactly what the risk is to the RPi, I'm going to have to call BS on this.
Per the circuit diagram for the relay board (https://www.sainsmart.com/sainsmart-2-c ... ry-pi.html)
the path between Vcc and the Input Pin is through 3 components: a resistor (R1), the input side of the 817C optocoupler, and an onboard LED. The resistor is 1K, and the LED is red. Per the 817C spec sheet, the forward voltage of the 817C is typically 1.2v. A red LED Vf is 1.8v. So, the total Vf for these two components is ~3v.
If the relay board is powered with 5V as @andrewshilliday originally suggested, then operation will be as follows.
When the RPi output is high (3.3v), the Vcc-In voltage will be 1.7v (5v - 3.3v) which is less than the total Vf for the 817C & LED, so they will remain off, no current will flow through the optocoupler (or the RPi GPIO pin), and the relay will not be energized.
When the RPi output is pulled low, the Vcc-In voltage will be 5v, which (being greater than 3v) is enough to turn on the 817C & LED. This leaves ~2v across the R1 resistor (1k), for a current of ~2mA. This is sufficient to put the optocoupler output into saturation, which results in the relay being energized.
I confirmed this with my bench supply and multimeter, I'm seeing 1.98 mA (Vcc=5v, In=0v).
Per http://www.mosaic-industries.com/embedd ... ifications , the RPi GPIO pins are capable of sinking 2mA without issue.
If the RPi GPIO pin is inadvertently put in input mode, I don't see an issue here either. If the internal RPi (~50k) pull-down resistor is enabled, the RPi input voltage will be ~1.96v, with ~40 uA flowing through the pull-down, no problems there. If instead the internal RPi pull-up resistor is enabled, the LED and optocoupler diode will prevent current from flowing, so the RPi input voltage will be 3.3v, also totally fine.
So, I'm not seeing any realistic reason that wiring this up as @andrewshilliday originally suggested would cause ANY issue for the RPi. If you think I've missed something, I'd love to hear it.
The only downside that I can think of for this simple setup is a functional one. When the RPi boots, my understanding is that the GPIO outputs get pulled low (I haven't confirmed that). If that is the case, then the relay will get briefly energized whenever the RPi boots, which would activate your garage door opener.
[tlfong01's remark - Rpi usually boots with GPIO pin set to input. And if you set the GPIO pin to output, you can set the initial output value to HIGH (or Low, as you wish).
Furthermore, I think connecting Vcc to 3.3v might not result in reliable operation. With the 3v Vf, that only leaves 0.3v across the R1 resistor, so only 300 uA through the optocoupler. That may not be enough current to reliably put the output stage into saturation.
The total current draw from my 5v supply with both relays energized is approx. 120mA. It seems to me that you can safely drive this off of the 5v GPIO pin as long as the power supply you are using can provide this much current (in addition to whatever the RPi and USB peripherals consume).
- Attachments
-
- 2EYTuQR[1].jpg (87.66 KiB) Viewed 5038 times
Last edited by tlfong01 on Fri Jun 22, 2018 3:23 am, edited 1 time in total.
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
Now I summarized the test results of one 4 channel and two 2 channel boards. As expected, the 4 channel board Low trigger select mode still has a problem. The 2 channel optocoupler low select with JD-Vcc jumper has no problem, because I only bought them recently, so I think they are designed compatible to both Arudino and Rpi.
- Attachments
-
- hRH3MQ3[1].jpg (132.57 KiB) Viewed 5120 times
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
Hmm, if you have to set the GPIO to input mode to turn off the relay, that implies that the relay module has a pull-up resistor to >3.3V.
That would also make the GPIO input > 3.3V which is likely to slowly kill the Pi.
That would also make the GPIO input > 3.3V which is likely to slowly kill the Pi.
Re: Relay Module KY-019 5V
I am still confused. In your schematic, is there any JDVcc/Vcc jumper? (Errata - sorry, there is indeed a JDVcc/Vcc jumper,I missed it. My apologies) Or did you cut any trace on your PCB (the two Vin's)? You seem to have converted the relay board from Low level trigger to High level trigger, ...
I have done some reverse engineering and drawn the schematic below. I am still reading around to clarify things.
- Attachments
-
- jdvcc_all_2018jun2104.jpg (206.08 KiB) Viewed 5095 times
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
Yes there is a link, shown as 1-2, and l show a link between them.tlfong01 wrote: ↑Thu Jun 21, 2018 8:34 amI am still confused. In your schematic, is there any JDVcc/Vcc jumper? (Errata - sorry, there is indeed a JDVcc/Vcc jumper,I missed it. My apologies) Or did you cut any trace on your PCB (the two Vin's)? You seem to have converted the relay board from Low level trigger to High level trigger, ...
I have done some reverse engineering and drawn the schematic below. I am still reading around to clarify things.
Re: Relay Module KY-019 5V
I agree the get around of "turning off relay by setting GPIO to input mode" might slowly kill the Rpi. I need to google more to confirm.
For now, I tend to believe the EE guy @gwhiteCL, saying that it is OK to connect 5V power to Rpi GPIO through optocoupler diode and current limiting resistor 1K.
Bad wiring schematic #16 - lamping7 opened this issue on 2015Dec22
gwhiteCL commented on Jun 10, 2017
https://github.com/andrewshilliday/gara ... /issues/16
I'm an EE. Unless you can explain exactly what the risk is to the RPi, I'm going to have to call BS on this. ...
If the RPi GPIO pin is inadvertently put in input mode, I don't see an issue here either. ...
If the internal RPi (~50k) pull-down resistor is enabled, the RPi input voltage will be ~1.96v, with ~40 uA flowing through the pull-down, no problems there.
If instead the internal RPi pull-up resistor is enabled, the LED and optocoupler diode will prevent current from flowing, so the RPi input voltage will be 3.3v, also totally fine.
So, I'm not seeing any realistic reason that wiring this up as @andrewshilliday originally suggested would cause ANY issue for the RPi. If you think I've missed something, I'd love to hear it. ...
Furthermore, I think connecting Vcc to 3.3v might not result in reliable operation. With the 3v Vf, that only leaves 0.3v across the R1 resistor, so only 300 uA through the optocoupler. That may not be enough current to reliably put the output stage into saturation. ...
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
Now I am connecting Vcc to 3.3V and check out the Vin turn-on-relay and Vin turn-off-relay points. Looking at the results, I am convinced that the operation might not be reliable.tlfong01 wrote: ↑Fri Jun 22, 2018 3:47 amBad wiring schematic #16 - lamping7 opened this issue on 2015Dec22
gwhiteCL commented on Jun 10, 2017
https://github.com/andrewshilliday/gara ... /issues/16
Furthermore, I think connecting Vcc to 3.3v might not result in reliable operation. With the 3v Vf, that only leaves 0.3v across the R1 resistor, so only 300 uA through the optocoupler. That may not be enough current to reliably put the output stage into saturation. ...
- Attachments
-
- 9l1l4JJ[1].jpg (182.35 KiB) Viewed 5019 times
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
One thing I can do is the following:
- Remove JDVcc/Ccc jumper. Connect JDVcc to relay power 5.0V, Connect Vcc to Rpi power 3.3V (from Rpi 3.3V power pin)
- To turn off relay, set GPIO pin to input mode
However, there is one catch, ...
- Attachments
-
- AEqjU5Q[1].jpg (113.87 KiB) Viewed 5006 times
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
Now I am testing some NPN Low trigger relays.
- Attachments
-
- LeQyKJM[1].jpg (149.93 KiB) Viewed 4936 times
Last edited by tlfong01 on Sat Jun 23, 2018 5:04 am, edited 1 time in total.
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
Now I have tested 4 opto isolated, Low level trigger modules, and another 4 opto isolated, High Level trigger ones.
This time suprisingly, PCBs, components, layouts are all the same, only the traces are different!
This time suprisingly, PCBs, components, layouts are all the same, only the traces are different!
- Attachments
-
- no opto
- dKxPvAP[1].jpg (153.5 KiB) Viewed 4936 times
I am an electronics and smart home hobbyist.
Re: Relay Module KY-019 5V
Now I am thinking of using HC14 to do the level conversion.
- Attachments
-
- xhgtHY6[1].jpg (183.97 KiB) Viewed 4906 times
I am an electronics and smart home hobbyist.