katamara
Posts: 6
Joined: Thu Aug 16, 2018 2:47 pm

switch on/off 12V 7A

Thu Aug 16, 2018 2:58 pm

I have a power supply that is 12V 7A and I'd like to be able to use one of the GPIO pins to switch it on/off. I believe that this can be done using a premade relay board such as this one from Amazon:
https://www.amazon.com/HiLetgo-Channel- ... 00LW15D1M/

Am I on the right track?

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

Re: switch on/off 12V 7A

Thu Aug 16, 2018 7:10 pm

Hi.

Yes you can use a ready made relay board but probably not that one as it requires 12v to operate it and the pi gpio is only 3.3v.

Look for a relay board that says it's compatible with the pi 3.3v gpio.
Remember we want information.......................no information no help
The use of crystal balls & mind reading is not supported

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

Re: switch on/off 12V 7A

Fri Aug 17, 2018 12:39 am

katamara wrote:
Thu Aug 16, 2018 2:58 pm
I have a power supply that is 12V 7A and I'd like to be able to use one of the GPIO pins to switch it on/off. I believe that this can be done using a premade relay board such as this one from Amazon:
https://www.amazon.com/HiLetgo-Channel- ... 00LW15D1M/
Am I on the right track?

Relay with Jumper Select High/Low Level Trigger

Yes, I think so. There is 90% chance you can use it. My suggestion is summarized below.

  • 1. There is 99% chance that you should select High level trigger. Low Level trigger jumper selection won't work.
  • 2. There is 90% chance that your relay switches on when input is about 1.8V or above, and switches off when input is about 1.5V or below. So your 3.3V logic level Rpi GPIO pin is strong enough to do the job.
  • 3. There is 90% chance that you relay uses the EL354 or similar optocoupler and the biasing/limiting series resistor 220R. If indeed the case, then the input High Level trigger current should be roughly about:

    ((3.0V (Rpi GPIO pin High)) - 2V (optocoupler LED saturation voltage)) /220R
    == (3V - 2V) / 220R
    == 1V / 200R
    == 5mA (== what the ad says)

    Rpi GPIO pin can handle 5mA current without any problem.

    Suggested connection schematic
    https://i.imgur.com/VB4sst4.jpg

    Warning: I am only an electronics hobbyist, doing Micky Mouse DIY weekend/midnight projects at home, ... I already fried one Rpi3 so far this season. So I don't guarantee that my suggested circuits won't trigger burning smell, black/white smoke, fry a Rpi, or explode! :mrgreen:
  • 4. There are in general two brands of relays used in cheap (but OK for everyday light loading use) relay modules, Songle or TongLing, and both brand has relays of 3 driving voltages, 5V, 12V, 24V. You relay module uses Songle 12V relay, so your 12V power supply is perfect match to supply the 12V relay module. (Just to clarify, 12V Songle relay requires 12V power to energize, but the relay coil energizing current (about 50 mA for 5V relay, much smaller for 12V relay) switch on/off is by the NPN transistor 2N5401, handling 12V 50mA energizing current on/off. At the module front end, the input current to the optocoupler EL354 is much smaller, about 5mA for Rpi 3V3 logic GPIO. So there is no (well, little) worry that 12V relay module will fry a 3.3V Rpi. Furthermore, there is the optical isolation between the 12V relay coil circuit and the 3.3V optocoupler circuit. So I think there is only 1% chance that you fry your Rpi.
  • 5. I read the 4 user reviews of your module. Three users say good, one say relay module not working. I also read now and then in this Rpi and other Rpi forums 3.3V Rpi users complaining that their High/Low jumper select module not working (All 5V Arduino users should not have this problem). There is 50% chance that those miserable Rpi users wrongly select the Low trigger option which won't work for Rpi. I often hear those poor guys weeping in the dark. Of course eBay couldn't care less. However, if the miserable weeping guys try their luck again and jumper select the High Level option, then they might laugh loudly forever after.
You might also like to read my old post below for more details.

/ to continue, ...

Appendix 1 - Relay module with High/Low level trigger jumper select
RE: RELAY MODULE KY-019 5V Postby tlfong01 » 2018-Jun-13 Wed 3:44 pm
https://www.raspberrypi.org/forums/view ... 0#p1327656

Appendix 2 - Power a 5V relay from [Rpi 3V3] GPIO pins
Power a 5V relay from GPIO pins - raspberrypi.stackexchange.com asked 2015mar, viewed 22,939 times
https://raspberrypi.stackexchange.com/q ... -gpio-pins
Attachments
pCRDgJx[1].jpg
pCRDgJx[1].jpg (120.75 KiB) Viewed 638 times
Last edited by tlfong01 on Sat Sep 08, 2018 5:28 am, edited 1 time in total.
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

katamara
Posts: 6
Joined: Thu Aug 16, 2018 2:47 pm

Re: switch on/off 12V 7A

Fri Aug 17, 2018 2:57 pm

I should clarify that I do not want to use the relay board on the AC side of the wall wart, I want to connect the relay board to the DC side.

I was also looking at this board: https://www.aliexpress.com/item/1pcs-5V ... 63296.html

I think this is similar to the one on Amazon.

I'm not really sure of how to read that suggested schematic.

I think I can just connect it like this: https://howchoo.com/g/m2qwmte5nzk/how-t ... spberry-pi except instead of it being a 9 volt battery, I would be using a 12 Volt 7 Amp DC wall wart.

Brandon92
Posts: 405
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: switch on/off 12V 7A

Fri Aug 17, 2018 3:11 pm

Hello,

The last relais board like you provide, says the following:
the module voltage 5V, 9,12V, 24V to choose from
This means that you can not drive it with your pi, because the the voltage of that is 3.3V.

Also, if you are using the "cheapest" relay, its possible that you can not switch the 12V @7A as much as you want. The worst case is that it will stay on forever and you can not turn it of.

katamara
Posts: 6
Joined: Thu Aug 16, 2018 2:47 pm

Re: switch on/off 12V 7A

Fri Aug 17, 2018 3:27 pm

So do you think if I use the board from amazon, I can hook it up like the video in the link above?
sorry for the newbie questions.

Brandon92
Posts: 405
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: switch on/off 12V 7A

Fri Aug 17, 2018 5:18 pm

katamara wrote:
Fri Aug 17, 2018 3:27 pm
So do you think if I use the board from amazon, I can hook it up like the video in the link above?
sorry for the newbie questions.
Well, to tell you the truth I can't tell you if the this one is suitable for you. This is because the don't tell the voltage to enable the relay. As the description of the product:
Using optocoupler chip isolation, strong drive capability, stable performance; trigger current 5mA

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

Re: switch on/off 12V 7A

Sat Aug 18, 2018 4:28 am

katamara wrote:
Fri Aug 17, 2018 2:57 pm
1. I should clarify that I do not want to use the relay board on the AC side of the wall wart, I want to connect the relay board to the DC side.

2. I was also looking at this board: https://www.aliexpress.com/item/1pcs-5V ... 63296.html
I think this is similar to the one on Amazon.

3. I'm not really sure of how t. o read that suggested schematic.

4. I think I can just connect it like this: https://howchoo.com/g/m2qwmte5nzk/how-t ... spberry-pi except instead of it being a 9 volt battery, I would be using a 12 Volt 7 Amp DC wall wart.

High/Low Trigger Relay Module

  • 1, 4. No problem. So you want to switch on/off a wall wart DC12V 7A power for a lamp or motor etc.
  • 2. The AliExpress relay board seems similar to the Amazon board, also jumper selectable high/low trigger.
  • 3. No problem. We can forget the schematic and look at it as a block diagram, as attached.
/ to continue, ...
Attachments
fja1kWW[1].jpg
fja1kWW[1].jpg (159.65 KiB) Viewed 532 times
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

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

Re: switch on/off 12V 7A

Sat Aug 18, 2018 4:50 am

tlfong01 wrote:
Sat Aug 18, 2018 4:28 am
katamara wrote:
Fri Aug 17, 2018 2:57 pm
2. I was also looking at this board: https://www.aliexpress.com/item/1pcs-5V ... 63296.html
I think this is similar to the one on Amazon.
  • 2. The AliExpress relay board seems similar to the Amazon board, also jumper selectable high/low trigger.

High/Low Trigger Relay Module

Now I am looking at the AliExoress board, attached below.

/ to continue, ...
Attachments
5virtVf[1].jpg
5virtVf[1].jpg (244.84 KiB) Viewed 527 times
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

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

Re: switch on/off 12V 7A

Sat Aug 18, 2018 5:41 am

tlfong01 wrote:
Sat Aug 18, 2018 4:28 am
I think I can just connect it like this: https://howchoo.com/g/m2qwmte5nzk/how-t ... spberry-pi except instead of it being a 9 volt battery, I would be using a 12 Volt 7 Amp DC wall wart.
  • So you want to switch on/off a wall wart DC12V 7A power for a lamp or motor etc.
  • 3. forget the schematic and look a block diagram

High/Low Trigger Relay Module

You might also look at a picture of my wal wart and relay. I will be using them to test out things.
Attachments
FXOALYD[1].jpg
FXOALYD[1].jpg (111.7 KiB) Viewed 517 times
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

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

Re: switch on/off 12V 7A

Sat Aug 18, 2018 8:28 am

tlfong01 wrote:
Sat Aug 18, 2018 5:41 am
You might also look at a picture of my wal wart and relay. I will be using them to test out things.

High/Low Trigger Relay Module

Now I am testing my 4 jumper select high low 5V relay modules. I always start any test with an offline, no Rpi, on table dry run. I am using a AAA battery x 2 pack = 1.5V x 2 == 3V to pretend to be the Rpi 3.3V GPIO pin 17 signal, cheating the module.

It is easy to cheat the module, because it has no eyes, but only a LED with a series resistor at the In connector point. The diode obeys the bipolar p-n junction diode law, ie, higher voltage, higher current, in a complicated, scary, quantum mechanics laws stipulated nonlinear voltage current characteristic fashion, as displayed by it datasheet.

Anyway, I used my wall wart 5V to power the relay, the AAA battery 1.6V x 2 == 3.3V to pretend to be the Rpi 3.3V GPIO signal to input at In. The jumper is set to select High Level trigger.

The relay as expected triggers at 3.2V signal, but the current at In is only about 0.9mA, much lower than the 5mA I calculated. I did not believe my eyes, so I used two cheap multimeters to cross check and check, but it was indeed 0.9mA. I tested all 4 modules, and all the them say my calculated trigger current of 5mA is rubbish.

So my calculation is all wrong! What is going on inside the stupid module? :shock:

I am indeed losing face. To regain some face, I need to prove that I don't always make wrong guesses. Sometimes I am not that stupid.

So I decided to show the if jumper select Low Trigger, low signal will trigger activate relay this time, but high signal is not high enough to deactivate the relay. In other words, jumper select Low trigger won't work.

So I jumper selected Low trigger, and test if Low signal (ground actually) activates the relay, and High signal (AAA x 2 == 3.2V) deactivates the relay.

I did see that when signal low, the LED grows bright red, and trigger current about 1.6mA, and relay clicks on happily. When I applied High signal 3.2V, the LED only grew dim, current 0.3mA, and the relay was silent, no happily clicking sound.

So I was at least right in guessing that the the relay won't work if jumper select Low trigger. :)
Attachments
zz1muoE[1].jpg
zz1muoE[1].jpg (122.06 KiB) Viewed 498 times
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

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

Re: switch on/off 12V 7A

Sat Aug 18, 2018 9:32 am

tlfong01 wrote:
Sat Aug 18, 2018 8:28 am
So my calculation is all wrong! What is going on inside the stupid module? :shock:
I am indeed losing face. To regain some face, I need to prove that I don't always make wrong guesses. Sometimes I am not that stupid, ...
So I was at least right in guessing that the the relay won't work if jumper select Low trigger. :)

12V High/Low Trigger Relay Module

Earlier while searching my junk parts box for 5V HighLow select relay modules, I had a pleasant surprise - I found one also jumper high/low not 5V, but a 12V module. :)

So I had a quick and dirty test of this 12V guy, before going for supper.
Attachments
ILENoUw[1].jpg
ILENoUw[1].jpg (57.23 KiB) Viewed 484 times
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

Brandon92
Posts: 405
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: switch on/off 12V 7A

Sat Aug 18, 2018 11:23 am

I would calculate it in this way:
Relay card high vs low.png
Relay card high vs low.png (7.35 KiB) Viewed 469 times
However I would not recommend the low setting. Because when the you set you gpio to high state. There is a higher voltage percent at the input of you pi. For example Vcc-Vf= 5-1.2 = 3.8V. And this is not a good idea. If the 12V relay has the same circuit: 12-1.2 = 10.8V.

This is also discussed in topic
mahjongg wrote:
Thu Aug 02, 2018 7:53 am
its a very bad idea to connect the VCC of the LED bar to 5V, at very low current the forward voltage of the LED might be (a lot) less than the normal 2V rating, and > 4V might end up on a GPIO, something that ought to *never* happen, as it might cause damage to your PI (cause a "latchup" in the chip that destroys the chip) especially if you do it multiple times for multiple GPIO's .

use 3.3V, only! The resistor arrays have 1K resistors, so the current flowing through the LEDs should be in the neighbourhood of 1mA, which for modern LED's should be enough.

If you need (much) more light you will need a transistor to switch the LED on (with VCC = 5V).
transistors with integrated gate resistors do exist, but are rare and expensive, a simpler/cheaper solution would be to use a FET, like a 2N7000
no extra resistor needed. Remember only to use a FET that turns on with just 3.3V gate voltage, the 2N7000 does (at least well enough for a few dozen mA).

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

Re: switch on/off 12V 7A

Sat Aug 18, 2018 2:42 pm

tlfong01 wrote:
Sat Aug 18, 2018 9:32 am
Earlier while searching my junk parts box for 5V HighLow select relay modules, I had a pleasant surprise - I found one also jumper high/low not 5V, but a 12V module. :)
So I had a quick and dirty test of this 12V guy, before going for supper.

12V High/Low Trigger Relay Module

I tested all the four 12V modules I found. The results is very disappointing. Von > 3.3V, which means only Arduino compatible, not at all Rpi compatible.

So I gave up on 12V relays.
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

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

Re: switch on/off 12V 7A

Sun Aug 19, 2018 3:02 am

Brandon92 wrote:
Sat Aug 18, 2018 11:23 am
1. I would calculate it in this way: ....
2. However I would not recommend the low setting.
> 4V might end up on a GPIO, something that ought to *never* happen, as it might cause damage to your PI (cause a "latchup" in the chip that destroys the chip) especially if you do it multiple times for multiple GPIO's .

Relay Module Input Voltage and Current Calculation

2. I agree that it is a bit risky to Rpi, if using relay module jumper selecting Low level trigger so that the optocoupler LED acts as a pull down load for Rpi GPIO, sinking current into Rpi GPIO.

1. Ah, now I found why your calculated LED sourcing current of 0.9mA correctly matches the real world, because you assume series limiting resistor of 2k2, and LED non saturation voltage of 1V2.

I wrongly assumed LED is fully saturated, therefore LEDsat = 2V, also I wrongly assume that the series resistor of 220R, therefore I calculated the fake trigger current of 5mA, as the ad fakely says.

Just now I did another experiment to confirm your correct calculation.
Attachments
klWIZgS[1].jpg
klWIZgS[1].jpg (179.04 KiB) Viewed 407 times
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

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

Re: switch on/off 12V 7A

Sun Aug 19, 2018 4:34 am

tlfong01 wrote:
Sun Aug 19, 2018 3:02 am
Brandon92 wrote:
Sat Aug 18, 2018 11:23 am
1. I would calculate it in this way: ....
1. Ah, now I found why your calculated LED sourcing current of 0.9mA correctly matches the real world, because you assume series limiting resistor of 2k2, and LED non saturation voltage of 1V2.
Just now I did another experiment to confirm your correct calculation.

12V Relay Module Input Voltage and Current Calculation

Now I have done another experiment on a similar relay, but 12V instead of 5V relay coil power. I sursprsingly found that two of my four 12V relays have the input idode biasing/current limiting resistance of value 1002, and two have 103.
Attachments
CFKrbxg[1].jpg
CFKrbxg[1].jpg (224.4 KiB) Viewed 394 times
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

User avatar
rpdom
Posts: 12739
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: switch on/off 12V 7A

Sun Aug 19, 2018 5:05 am

tlfong01 wrote:
Sun Aug 19, 2018 4:34 am
I surprisingly found that two of my four 12V relays have the input idode biasing/current limiting resistance of value 1002, and two have 103.
1002 and 103 are two ways of writing 10K:

1002 is 100 x 10^2 = 100 x 100 = 10,000
103 is 10 x 10^3 = 10 x 1,000 = 10,000

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

Re: switch on/off 12V 7A

Sun Aug 19, 2018 5:36 am

rpdom wrote:
Sun Aug 19, 2018 5:05 am
tlfong01 wrote:
Sun Aug 19, 2018 4:34 am
I surprisingly found that two of my four 12V relays have the input idode biasing/current limiting resistance of value 1002, and two have 103.
1002 and 103 are two ways of writing 10K:

1002 is 100 x 10^2 = 100 x 100 = 10,000
103 is 10 x 10^3 = 10 x 1,000 = 10,000

Many thanks for point out that. I wrongly thought that one was 1K, another was 10K. I just found a 1K variable resistor to replace the SMD resistor. Your correction just came in time to save me another time wasting careless mistake.

Now I understand why I hate SMD, because I have been for years reading king size (no magnifying glass needed!) carbon/metal film resistors with colour rings such as Brown Black Orange for 10K, Brown Black Red for 1K, you never go wrong, so human eyes friendly!

I now realize that my mental arithmetic skill has aged too fast for weekend/mid night electronics hobbyist work. Perhaps I should use my hand calculator to always double check my brain calculator work.

I also realize that why I always try to avoid using capacitors. I can never remember that 104 is 0.01uF or 0.1uF. I always comfort myself that don't worry, both 0.1u and 0.01uF are capacitors ... :lol:
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

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

Re: switch on/off 12V 7A

Sun Aug 19, 2018 8:11 am

tlfong01 wrote:
Sun Aug 19, 2018 5:36 am
rpdom wrote:
Sun Aug 19, 2018 5:05 am
1002 and 103 are two ways of writing 10K:
1002 is 100 x 10^2 = 100 x 100 = 10,000, 103 is 10 x 10^3 = 10 x 1,000 = 10,000
Many thanks for point out that. I wrongly thought that one was 1K, another was 10K

Modifying 12V relay module from Arduino only compatible to also Rpi compatible

From I forgot how long ago, I have been wrongly reading SMD resistor 103 as 1K. So my calculations were wrong by one order of magnitude.

Now I am replacing the 103, ie 10K SMD resistor by a smaller value, hoping that the high level trigger voltage would become smaller, perhaps around the Rpi 3V3 GPIO signal friendly range of around 2.5V.

I planned to do the resistor replacement in a couple of steps:

Testing Procedure

  • 1. Remove the SMD 1K3 resistor from the relay module board.
  • 2. Solder on two connecting wires to the two pads originally for the SMD resistor.
  • 3. Connect a 220R current limiting resistor, in series with a 103, ie 10K trim pot (10 turns, I guess).
  • 4. Connect 12V power to relay board, variable regulated power supply unit, VRPSU (0V to 10V) as trigger signal to module input IN.
  • 5. Adjust ARPSU output to fixed value of about 2.5V.
  • 6. Turn trim pot CW and CCW, by trial and error, to find a value that relay will click or unclick.
  • 7. Check the trim pot + 220R resistor total value in step 6, and replace it by a single resistor.

Results

  • 8. I found 6K seems a appropriate value. So I used 4K7.
  • 9. Then I adjusted the reg PSU to find the relay turn on and turn off values of about 1.7V and 2.0V.

So far so good. Next step is to check out the precise values of Von, Voff, Ion, Ioff.
Attachments
KNvzwAT[1].jpg
KNvzwAT[1].jpg (116.34 KiB) Viewed 366 times
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

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

Re: switch on/off 12V 7A

Sun Aug 19, 2018 9:16 am

tlfong01 wrote:
Sun Aug 19, 2018 8:11 am
Results
  • 8. So I used 4K7.
  • 9. Then I adjusted the reg PSU to find the relay turn on and turn off values of about 1.7V and 2.0V.

So far so good. Next step is to check out the precise values of Von, Voff, Ion, Ioff.

Modifying 12V relay module to Rpi 3.3V GPIO compatible

After changing the original optocoupler input diode series 10K resistor to 4k7,

the 12V relay module is now 3.3V Rpi compatible! :mrgreen:
Attachments
jEY3eVN[1].jpg
jEY3eVN[1].jpg (117.88 KiB) Viewed 353 times
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

Brandon92
Posts: 405
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: switch on/off 12V 7A

Sun Aug 19, 2018 9:19 am

I you are chancing resistors. I think its a better idea to change the resisitor to a lower value. So that it can work on the "high setting". So there is no possibilities that the higher voltage will destroy you pi.
Also I was wondering. Why there are using a optocouple, if the ground for the relay powersupply is the same as the ground of the pi. Or do I see it wrong?

tlfong01 wrote: the 12V relay module is now 3.3V Rpi compatible! :mrgreen:
If the relay is in the of stage. And you disconnect the connection to "control" the relay. What is the voltage at that pin. This voltage will be present at you pi.

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

Re: switch on/off 12V 7A

Sun Aug 19, 2018 12:17 pm

Brandon92 wrote:
Sun Aug 19, 2018 9:19 am
1. I you are chancing resistors. I think its a better idea to change the resisitor to a lower value. So that it can work on the "high setting". So there is no possibilities that the higher voltage will destroy you pi.

2. Also I was wondering. Why there are using a optocouple, if the ground for the relay power supply is the same as the ground of the pi. Or do I see it wrong?

3. If the relay is in the of stage. And you disconnect the connection to "control" the relay. What is the voltage at that pin. This voltage will be present at you pi.

1. Yes, for modules that can jumper High/Low level trigger mode, the very important thing for Rpi relay newbies to remember is the following:

Always jumper select "H"

Or you might be in big trouble.

2. Ah, if select high level trigger, to get total optical isolation, you might need to use a paper cutting knife to cut the opticalcoupler (3V3 signal) ground trace to make it separate from the relay power (5. 12, 24V coil power) ground. I don't have to worry about this, because I don't connect Rpi GPIO pins, or use level shifter whose 5V ground is separated from relay power ground. (I have not throughly thought about this, so there might be bug in my circuit design.

3. Actually I don't plan to use the high select or high trigger type. My plan is to use low level current sinking type. But you need to have Vcc and JdVcc jumper in the relay board. Again, I don't have to worry this, because I have Vcc and JDVcc separated in my DIY wiring.

This is a bit confusing, perhaps you can check out my old posts to clarify the two kinds of separation:

  • 1. separate Vcc/JDVcc, and
  • 2. separate optocoupler control signal ground and relay coil power ground.
Two ways to do total opto isolation

A. Total optical isolation, low trigger, with Vcc and JdVcc separated)
RE: RELAY MODULE KY-019 5V Postby tlfong01 » 2018-Jul-14 Sat 5:37 pm
https://www.raspberrypi.org/forums/view ... 0#p1340703

B. Total optical isolation, high trigger, with Rpi signal ground and Relay power signal ground separated
RE: SWITCH ON/OFF 12V 7A Postby tlfong01 » 2018-Aug-18 Sat 12:28 pm
https://www.raspberrypi.org/forums/view ... 4#p1354349
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

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

Re: switch on/off 12V 7A

Sun Aug 19, 2018 2:05 pm

tlfong01 wrote:
Sun Aug 19, 2018 9:16 am
Modifying 12V relay module to Rpi 3.3V GPIO compatible
After changing the original optocoupler input diode series 10K resistor to 4k7,
the 12V relay module is now 3.3V Rpi compatible! :mrgreen:

Using DC 12V 3A wall wart to test 12V relay module driving 12VDC 0.15A fan

Now that I have a Rpi 3V3 GPIO signal compatible 12V relay module, I am going to test
if the relay switch can handle a small current of 150mA of a DC12V fan.

I am still doing a table run, without the Rpi. I will be using a AAA 1.5V x 2 battery pack to pretend/simulate the Rpi GPIO logic high/low signal. Flipping a switch by hand is of course quicker than running a python program to switch on the relay!

This small exercise of DC12V 150mA relay switching is my preparation of a much bigger power control of a 1.5KW induction cooker. So I am very careful in thinking how best to run the Live and Neutral wires.

I will always remember the following:

Live wire first goes into COM, and then leaves out of NO, and not the other way round.

This way the fan or other appliance will not be dangerously live or hot if the relay is off.

I will also place the whole circuit, adapter, relay, fan etc in a plastic tray, to avoid dangling wires electrically shocking me.

Update
RE: RELAY MODULE KY-019 5V Postby tlfong01 » 2018-Aug-20 Mon 12:04 pm
https://www.raspberrypi.org/forums/view ... 0#p1355138
Attachments
HinYj7F[1].jpg
HinYj7F[1].jpg (84.83 KiB) Viewed 316 times
Last edited by tlfong01 on Tue Aug 21, 2018 4:03 am, edited 1 time in total.
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

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

Re: switch on/off 12V 7A

Sun Aug 19, 2018 3:01 pm

tlfong01 wrote:
Sun Aug 19, 2018 12:17 pm
Brandon92 wrote:
Sun Aug 19, 2018 9:19 am
3. If the relay is in the of stage. And you disconnect the connection to "control" the relay. What is the voltage at that pin. This voltage will be present at you pi.

Fault tolerant design of relay

I have not thoroughly thought about it. Let me now think aloud.

The two ads above say the following:

  • 1. Fault-tolerant design, even if the control line is broken, the relay will not move.
  • 2. Fault-tolerant design, even if the control line is broken, the relay will not operate.
I think both mean the following:

When relay is switched on, the COM and NO contact points are closed (connected), so the live power goes to drive the pump, fan etc.

I seldom read user guide about relays, so I should be using the wrong technical terms.

Anyway, if the following happen:

  • 1. the wire from Rpi GPIO 17 relay IN is broken
  • 2. the Rpi goes dead because of a power down etc.
  • 3. the Rpi goes crazy
I think situation (1) and (2) should not cause any trouble, because either Rpi GPIO pin 17 is acting as a source driver or sink driver, no current will flow in both cases, so the relay will not switch on, ...

For (3) I don't know how to deal with it. Any ideas?
I am an electronics hobbyist, started playing relays 3 months ago. I found things confusing. Luckily Google my friend makes me great again! :)

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

Re: switch on/off 12V 7A

Mon Aug 20, 2018 5:50 am

tlfong01 wrote:
Sun Aug 19, 2018 4:34 am
I sursprsingly found that two of my four 12V relays have the input idode biasing/current limiting resistance of value 1002, and two have 103.

Errata 2018aug20hkt1348

Actually 1002 and 103 are both 10K. As explained below.
rpdom wrote:
Sun Aug 19, 2018 5:05 am
1002 and 103 are two ways of writing 10K:
1002 is 100 x 10^2 = 100 x 100 = 10,000
103 is 10 x 10^3 = 10 x 1,000 = 10,000
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 “Automation, sensing and robotics”

Who is online

Users browsing this forum: No registered users and 9 guests