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

Re: switch on/off 12V 7A

Mon Aug 20, 2018 8:19 am

tlfong01 wrote:
Sun Aug 19, 2018 2:05 pm
I am going to test if the relay switch can handle a small current of 150mA of a DC12V fan.

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

I used an AAA 1.5V battery x 2 = 3V pack to switch on/off 12V relay and found everything OK. Then I used a NE555 timer as square wave generator, with an output of about 1Hz, 5Vpp, to input to input In of relay. The COM is connected to DC12V, and NO to cooling fan DC12V 150mA.

The scope displays the NO output and In output as expected. The ground line of the NO signal is a bit noisy. No scary back emf thing.
So far so good.

Errata 2018aug21hkt0842

In the picture below, the white Sanyo wart is 5.5V 3A, to power the NE555 Timer, which in turn sends 1Hz 5Vpp square wave signal to the 12V relay module at its IN input. (The black Sony wart is 12V 3A, to power the 12V relay module's magnetic coil switching circuit, at the Vcc input). Ah, yes my 'warts' are high class brands, no cheapies! :) )
Attachments
oHoI825[1].jpg
oHoI825[1].jpg (154.91 KiB) Viewed 1283 times
Last edited by tlfong01 on Tue Aug 21, 2018 12:50 am, edited 1 time in total.
I am an electronics and smart home hobbyist.

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

Re: switch on/off 12V 7A

Mon Aug 20, 2018 8:57 am

Brandon92 wrote:
Fri Aug 17, 2018 3:11 pm
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.

I think what the Ali Express 5V relay spec says is the following:

  • 1. The relay coil power supply is 5V.
  • 2. The input signal is compatible to 5V TTL logic, 9V TTL logic, 12V TTL logic, or 24V TTL logic.
/ to continue, ...

Appendix

RE: RELAY MODULE KY-019 5V Post by tlfong01 » 2018-Jun-13 Wed 3:44 pm
https://www.raspberrypi.org/forums/view ... 0#p1327656
tlfong01 wrote:
Wed Jun 13, 2018 7:44 am
I am testing a module with opto isolation and High/Low level selectable.
If High Level Trigger is selected
Vin to turn on relay = 1.8V
Vin to turn off relay = 1.5V

RE: SWITCH ON/OFF 12V 7A Post by tlfong01 » 2018-Aug-19 Sun 5:16 pm
https://www.raspberrypi.org/forums/view ... 4#p1354837
tlfong01 wrote:
Sun Aug 19, 2018 9:16 am
After changing the original optocoupler input diode series 10K resistor to 4k7,
the 12V relay module is now 3.3V Rpi compatible! :mrgreen:
Vin to turn on relay == 2.0V
Vin to turn off relay == 1.6V
I am an electronics and smart home hobbyist.

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

Re: switch on/off 12V 7A

Mon Aug 20, 2018 8:13 pm

Maybe is was unclear last time.

But this is what I thought:
When you use the relay in the "low setting". The Vcc (doesn't matter witch one) is higher than the 3.3V that you pi provide. When looking at the picture from this post:
Brandon92 wrote: I would calculate it in this way:
Relay card high vs low.png
That a higher voltage is pressend at the input of you pi, this occurs in two stations:
  • When the pi set the gpio to high
  • When the the program is NOT running, the gpio pin is then (probably) a input (so high impedance). And this make it even easier to blow up you pi.
This is why I want you to measure the pin to the pi of your relay board. With no connection, +/- the same as the gpio pin is a input.

And that is why you only use the "high setting". And in some cases this means that you need to change the resistor to a lower value. (and remove the ground like between the relay power and the pi power. (as you told before)

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

Re: switch on/off 12V 7A

Tue Aug 21, 2018 2:46 pm

tlfong01 wrote:
Mon Aug 20, 2018 8:57 am
Brandon92 wrote:
Fri Aug 17, 2018 3:11 pm
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.

AliExpress's 5/9/12/24V logic compatible 5V relay

Yes, the ad is confusing. Let me write down some points and see which ones you agree.

1. The 5V relay has a jumper to select High Level or Low Level trigger.

2. Let us talk about the select High trigger for now, and leave the Low trigger later, perhaps in another post.

3. The relay is powered 5V, at the Vcc connector point.

4. The AliExpres ad does not mention Arduino or Rpi. So let us talk about the general case, the 'thing' controls the relay by applying a signal at the In connector point.

5. If the thing applies a signal larger than 2.5V, the relay will switch on.

6. If the thing applies a signal smaller than 2.0V, the relay wil switch off.

7. Now suppose the thing is a standard 5V TTL thing, with Low signal above 2.7V, and
Low below 0.8V. So this thing can control the relay without any problem.

8. Now suppose the thing is an Arduino, with High of 4.2V+, and Low 0.7V-. No problem.

9. Now suppose the thing is a Rpi, with High of 2.4V+, and Low 0.6V-. No problem.

10. Now suppose the thing is a non standard 12V TTL, with High of 10V+,and Low 1V-. No problem.

11. Now suppose the thing is a non standard 24V TTL, with High of 20V, and Low 1.2V-. No problem.

12. I read in another relay review by a guy who know nothing about electronics. He only knows that his car battery is 12V. He read that his relay is 5, 9, 12, 24 volt compatible. So he applies the car battery's 12V to the relay, and the relay happily clicks.

13. Another guy also know nothing about electronics, but he uses his 9V battery with a manual filp switch to apply 9V or no volt to the relay, also no problem. In this case the guy uses a 9V battery to control his relay which in turn controls 24VAC or 200VAC pump. So he is happy.

14. What I am trying to say is that the relay's input side couldn't care less what is the 'thing' giving the signal to it. It just obeys a simple rule: 2.5V or higher, switch on, 2.0V or lower, switch off. Never mind what the the thing outside giving the signal, may it be a 9V battery, or a 12 V or 24V car battery, or Arduino, or PIC, or Wintel PC, or Rpi, ...

15. So that is what the Ali Express relay spec says, 5V, 9V, 12V, 24V, all are welcome.

Ah, time to go to bed. Sorry for the typos. See you tomorrow.
I am an electronics and smart home hobbyist.

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

Re: switch on/off 12V 7A

Tue Aug 21, 2018 8:44 pm

  1. Yes, i would not use the "low setting" ;P
  2. Okay
  3. Okay
  4. Okay
  5. Yes/No, If the current through the LED, from the optcouple, is big enough so that the tranistor will be fully turn "open"
  6. Same as above, only then the current is to low
  7. Okay
  8. Okay (as long as the current is save for the arduino)
  9. Okay (as long as the current is save for the pi)
  10. This could result in a current that's is to high for the LED inside the optocoupler (not calculated).
  11. This could result in a current that's is to high for the LED inside the optocoupler (not calculated).
  12. If the relay is not reated for that kind of voltage. The coil could burn out or the led.
  13. If the relay is not reated for that kind of voltage. The coil could burn out or the led.
  14. As long as you are in the "save" operation area of the product, yes
  15. Same as above :)

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

Re: switch on/off 12V 7A

Wed Aug 22, 2018 11:53 am

Brandon92 wrote:
Tue Aug 21, 2018 8:44 pm
  • 1. Yes, i would not use the "low setting" ;P
  • 2. Yes/No, If the current through the LED, from the optcouple, is big enough so that the tranistor will be fully turn "open"
  • 3. Same as above, only then the current is to low
  • 4. Okay (as long as the current is save for the arduino)
  • 5. Okay (as long as the current is save for the pi)
  • 6. This could result in a current that's is to high for the LED inside the optocoupler (not calculated).
  • 7. This could result in a current that's is to high for the LED inside the optocoupler (not calculated).
  • 8. If the relay is not reated for that kind of voltage. The coil could burn out or the led.
  • 9. If the relay is not reated for that kind of voltage. The coil could burn out or the led.
  • 10. As long as you are in the "save" operation area of the product, yes
  • 11.Same as above :)

Newbie Discussion Notes on 5V/12V High Level Trigger Relay's Input Voltage Requirements V1.0

1. Thank you for your comments. I made 15 comments, you agree with 4 of them without question. So let us discuss the remaining 11 points, as listed above.

2. I would suggest that we do a structured discussion, or eat the big elephant bite by bite, so make the discussion not getting too complicated.

3. I suggest to limit/confine/qualify the topic on the input side, because this the part that causes all the trouble and controversy.

4. Now let us start with your Point 1 - I agree that it is might not be a good idea to use or buy jumper set Low Level trigger. So for now we will only talk about High Level trigger relays. So we can put aside your Point 1. But see update 1 below.

5. Your Points 2, 3 - I agree with you that we need to make sure if the input voltage at Vin drives the LED in the optocoupler into (a) inactive, (b), active, (c) fully saturated state. I will later look at the spec and do some calculation and see if you agree or not.

6. Your Points 4, 5 - We need to make sure if the Rpi, Arduino, or anything that, because using High Level trigger mode, acts as a source driver, drives, within a safe limit, a current through the the LED to ground. I can calculate/experiment to find out.

7. Your Points 6, 7 - We also need to make sure if the Rpi or Arduino's driving current is not big enough to damage the LED. I can calculate/experiment to found out.

8. Your Points 8, 7 - We need to make sure if the logical power Vcc driving the LED, or the JdVcc driving the coil, is not too big to damage the LED, or the coil. I agree, we need to make sure that.

9. Your Points 9, 10 - We need to make sure the whole system (input side with the optocoupler, output side with coil and driving transistor, biasing resistor etc) operates in the safe region.

I agree with all your points above. So I will refine my original 15 points, take consideration of your concerns, and make a Version 2.

I suggest that we do a casual discussion, but keep strict principles (Ohm's Law, LED and BJT characteristics etc). So we won't have any deadline, or insist on reaching a yes or no conclusion.

There is a chance that after discussion, we will agree that we disagree. :)

No hurry to reply. Think and take your time. I am thinking aloud, so there should be many typo mistakes or unstructured things. My apologies.

Update 1 - 2018aug22hkt2042

I once said I always prefer Low level trigger, for a reason. That is, I almost never use Rpi GPIO to directly (source or sink) drive a relay, no matter the relay input side is an optocoupler or BJT only. I almost always use some sort of Logical Lever Converter.

In other words, if I can use a level shifter, then I prefer Low level trigger.

But since our discussion is on how newbies should buy or use relays. We should not expect or insist newbies to buy an assembled level shifter or solder 2N2222, ULN2803 etc. So for our discussion here, without using level shifter, I agree that it is a bad idea using Low level trigger, using Rpi as a sink driver.
I am an electronics and smart home hobbyist.

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

Re: switch on/off 12V 7A

Thu Aug 23, 2018 12:13 pm

Thank you for all that information, but unfortunately this is all way over my head.

I was hoping I could use the Raspberry Pi to control a 12 volt power supply on/off on the low voltage side. If anyone has a link to a circuit diagram or pre-made board or boards, that would be most helpful.

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

Re: switch on/off 12V 7A

Thu Aug 23, 2018 1:33 pm

Since a big part of the problem is that the boards I originally linked were 5V, here is a 3V relay board, https://www.ebay.com/itm/3V-One-1-Chann ... Sw~Q9bDN~Q

Would I be able to use this board to switch the 12V 7A DC on and off?


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

Re: switch on/off 12V 7A

Thu Aug 23, 2018 4:26 pm

No problem for the information, we had a slight discussion :p

Unfortenly you can't use this kind of relay. However I like this one (but you can't use it. The reason for this is that relay itself works on 3.3V and draw 120mA. And I read that is to much power, that the pi can't deliver to you. If you could find a simular product with a 5V relay, that would be okay. Because, by the looks of it, you can fully disconent the pi from the relay side. But if you use the avadable 5V powersuplly from you pi, than its not necessary.

However, the input, to enable the relay, need to be 3.3V. Otherwise it will not work.
Are you switching 12V with that relay, or do you switch the mains to that power supply.

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

Re: switch on/off 12V 7A

Sat Aug 25, 2018 1:01 am

Brandon92 wrote:
Thu Aug 23, 2018 4:26 pm
No problem for the information, we had a slight discussion :p

Unfortenly you can't use this kind of relay. However I like this one (but you can't use it. The reason for this is that relay itself works on 3.3V and draw 120mA. And I read that is to much power, that the pi can't deliver to you. If you could find a simular product with a 5V relay, that would be okay. Because, by the looks of it, you can fully disconent the pi from the relay side. But if you use the avadable 5V powersuplly from you pi, than its not necessary.

However, the input, to enable the relay, need to be 3.3V. Otherwise it will not work.
Are you switching 12V with that relay, or do you switch the mains to that power supply.

Wow, the more I read, the more I got confused.

Google pointed me the following discussion of EE Stack Exchange. I always think that the EE and Arduino guys are more electrically and electronically knowledgeable than the smartness challeneging Rpi guys.

How do I use a 5V relay with a 3.3V arduino pro mini [or Rpi]?
Electrical Engineering, Stack Exchange (asked 2016jan, viewed 41,485 times)
https://electronics.stackexchange.com/q ... o-pro-mini
Last edited by tlfong01 on Sat Aug 25, 2018 11:53 pm, edited 1 time in total.
I am an electronics and smart home hobbyist.

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

Re: switch on/off 12V 7A

Sat Aug 25, 2018 9:53 am

tlfong01 wrote:
Sat Aug 25, 2018 1:01 am
Brandon92 wrote:
Thu Aug 23, 2018 4:26 pm
No problem for the information, we had a slight discussion :p

Unfortenly you can't use this kind of relay. However I like this one (but you can't use it. The reason for this is that relay itself works on 3.3V and draw 120mA. And I read that is to much power, that the pi can't deliver to you. If you could find a simular product with a 5V relay, that would be okay. Because, by the looks of it, you can fully disconent the pi from the relay side. But if you use the avadable 5V powersuplly from you pi, than its not necessary.

However, the input, to enable the relay, need to be 3.3V. Otherwise it will not work.
Are you switching 12V with that relay, or do you switch the mains to that power supply.

Wow, the more I read, the more I got confused.
Sorry to hear that my information was not clear. So, I hope this makes it more clear:

We wants to buy a relay card, no surprisehere ;), and the rated voltage for the relay itself is 3.3V. In stead of the 5V. This means that he need to use the 3.3V power rail of the Rpi. And this is not really a good idea*. But now it turns out that you can only draw / use around 50mA from the 3.3V rail. And to turn the relay good on, it needs atleast 120mA (from the datasheet). This means that the relay wont turn on. And you use to much power from the 3.3V rail, and the Rpi doesn't like that.

*It could cause a voltage dip, current spike, ect. that the logic on that power rail doesn't like. And potential damage something or crash the Rpi.

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

Re: switch on/off 12V 7A

Sun Aug 26, 2018 6:00 am

Brandon92 wrote:
Sat Aug 25, 2018 9:53 am
tlfong01 wrote:
Sat Aug 25, 2018 1:01 am
Brandon92 wrote:
Thu Aug 23, 2018 4:26 pm
Unfortenly you can't use this kind of relay. However I like this one (but you can't use it. The reason for this is that relay itself works on 3.3V and draw 120mA. And I read that is to much power, that the pi can't deliver to you.
However, the input, to enable the relay, need to be 3.3V. Otherwise it will not work.
Wow, the more I read, the more I got confused.
I hope this makes it more clear:
the rated voltage for the relay itself is 3.3V. In stead of the 5V.
This means that he need to use the 3.3V power rail of the Rpi. And this is not really a good idea*. But now it turns out that you can only draw / use around 50mA from the 3.3V rail. And to turn the relay good on, it needs atleast 120mA
This means that the relay wont turn on. And you use to much power from the 3.3V rail, and the Rpi doesn't like that.

Ali Express Dual Power 3V Relay

But the Ali Express 3V relay module is a dual power design. That means you can:

  • 1. Connect Rpi's 3.3V rail power to the Vcc input of the relay, for signal control. Rpi 3.3V GPIO pin needs less than 5mA to source drive the optocoupler EL817C.
  • 2. Connect another 3.0V power for energizing the relay coil. This 3V relay power can be a 3V wall wart, a AAA x 2 = 3V battery pack, or a 3.74V rechargeable 16450 lithium battery. The Songle 3.0V relay coil needs 120mA (usually sinking current controlled by a NPN BJT switch transistor) to pick up.
I think this dual power design is somewhat similar to the relays with a Vcc/JDVcc jumper, which when removed, separates the control signal power (Vcc, usually 3.3V for Rpi, or 5V for Arduino), from the JDVcc relay coil power (JDVcc, usually 5V, but can be 12V, 24V etc, depending on the rated voltage of the Songle/TongLing relay)

Moreover, I think this 3V relay module is designed not only for 3.3V Rpi/Arduino. I think it is compatible to 5V Arduino, 3.3V TTL, 5V TTL, 12V TTL, 24V TTL, and even, (when using as a signal source to switch on/off the relay), 3V battery pack (AAA x 2), 4.5V battery pack, 3.74V (eg 18450) lithium cell, 9V battery, 12V/24V car battery. :mrgreen:

Appendix
Ali Express Dual Power 3V Relay
https://www.aliexpress.com/item/3V-Rela ... 86562.html
Attachments
0QirgNE[1].jpg
0QirgNE[1].jpg (224.74 KiB) Viewed 1063 times
I am an electronics and smart home hobbyist.

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

Re: switch on/off 12V 7A

Sun Aug 26, 2018 6:24 am

tlfong01 wrote:
Sun Aug 26, 2018 6:00 am
I think this dual power design is somewhat similar to the relays with a Vcc/JDVcc jumper, which when removed, separates the control signal power (Vcc, usually 3.3V for Rpi, or 5V for Arduino), from the JDVcc relay coil power (JDVcc, usually 5V, but can be 12V, 24V etc, depending on the rated voltage of the Songle/TongLing relay)

Moreover, I think this 3V relay module is designed not only for 3.3V Rpi/Arduino. I think it is compatible to 5V Arduino, 3.3V TTL, 5V TTL, 12V TTL, 24V TTL, and even, (when using as a signal source to switch on/off the relay), 3V battery pack (AAA x 2), 4.5V battery pack, 3.74V (eg 18450) lithium cell, 9V battery, 12V/24V car battery. :mrgreen:

Appendix
Ali Express Dual Power 3V Relay
https://www.aliexpress.com/item/3V-Rela ... 86562.html
Yes, you could use a external power supply that provide the 3.3v with correct power delivery. But because it is for an someone is for someone that is not so familiar with electronics 3.3v is 3.3v. And they are going to use the Rpi 3.3v rail. So, it is easier to by a 5v relay version.

Yes, The input voltage range may be large in this case (Minimum led current 《-》 maximum led current). What means that you can use different voltages at the input. But the relay side want to see only 3,3v. Otherwise the relay (coil) can burn out.

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

Re: switch on/off 12V 7A

Fri Aug 31, 2018 4:36 am

Brandon92 wrote:
Sun Aug 26, 2018 6:24 am
1. Yes, you could use a external power supply that provide the 3.3v with correct power delivery. But because it is for someone that is not so familiar with electronics 3.3v is 3.3v. And they are going to use the Rpi 3.3v rail. So, it is easier to by a 5v relay version.

2. Yes, The input voltage range may be large in this case ... What means that you can use different voltages at the input. But the relay side want to see only 3,3v. Otherwise the relay (coil) can burn out.

Newbie Proof Relay modules

Yes, I very much agree with you that even though the 3V relay board is compatible to Rpi, it is not newbie proof.

The newbies might be confused or mix up (1) Signal power for Rpi control and (2) Relay power for driving relay coil.

Other newbies might read that the module input can accept a wide range of inputs, so they might try connect 12V to the module input, but wrongly connect to the relay power side, and fry the module.

So one clean solution that is Rpi newbie proof is to get the relay board hats particularly designed for Rpi.

The hats fit the Rpi and there is no chance that the newbie would connect the wrong relay power or control signal. Below are some examples and references of newbie friendly Rpi relay modules.

PiFace Raspberry Pi Relay Board - £27
https://uk.farnell.com/piface/piface-di ... dp/2434230

WaveShare Raspberry Pi Relay Board - $19
https://www.waveshare.com/wiki/RPi_Relay_Board

SeeedStudio Raspberry Pi Relay Board - $25
https://www.seeedstudio.io/Raspberry-Pi ... -2409.html

ModMyPi PiOT Raspberry Pi Relay Board - £30
https://www.modmypi.com/raspberry-pi/re ... elay-board

Using the Seeed Studio Raspberry Pi Relay Board - JM Wargo 2017feb14
https://johnwargo.com/internet-of-thing ... board.html

ModMyPi PiOT Relay Board Activation/Deactivation Features
The PiOT relay board features multiple start-up modes to combat "chatter" on the GPIO which can lead to unexpected behavior. Variable delayed start-up allows users to pause activation of the relays for a short period during boot, ensuring that GPIO pins are correctly set prior to use, or the alternative handshake mode utilises a specific pulse train to enable activation and de-activation of the relay board at the user's will. No more accidental switching of relays at boot!


Anything that the newbie can go wrong, will go wrong.
Murphy's Law
I am an electronics and smart home hobbyist.

Return to “Automation, sensing and robotics”