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

Re: Relay won't flip

Sun Dec 22, 2019 11:30 pm

That diode, across the relay coil, can not be cut out. In this case it is a fly back diode that observes the energy of the relay coil when it is turned of. As you might know an inductor wants to "keep" the current flow. But if he can't the voltage across the coil will be flying high. For example I tested this with a 12v relay and the voltage at the collector of the transistor goes up to >200v and then it dies.

emma1997
Posts: 591
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Relay won't flip

Mon Dec 23, 2019 12:42 am

I'm convinced that diode is a holdover from the days of point contact germanium transistors. IMO practices like this tend to propagate throughout the ages more from a sense of superstitious ritual than science or engineering.

Depending on load inductance and circuit impedance I would be surprised to see 2x or in rare cases 3x kickback. Certainly with that silly 15ohm resistor not likely to see more than 120%. I say this from both theory and practical experience having captured dozens of traces on a variety of relays. With OPs 3v coil even a 1950's era CK722 with 8v Vceo would survive.

Not even a consideration for todays devices like penny 2n7002 at 60v even assuming an unlikely 8x pulse. 400v fets may actually cost a whole nickel. PCB space installed probably 10x the difference.

I suspect the same guys who put those diodes in there also drop voltage with resistors and favor bipolar transistors over fets (why not vacuum tubes? lol).

Speaking of diodes it would make more sense to use in place of that resistor. From an engineering standpoint easy peasy compared to wearing out your slide rule figuring how many ohms.

You kids! GET OFF MY LAWN!!!

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

Re: Relay won't flip

Mon Dec 23, 2019 8:59 am

Emma .

Do you understand what the OP wants to do ?

I am convinced you don't , that silly 15 ohm resistor is to drop 2V at 133 mA so that the relay coil only gets 3V at 133mA.

if you so sure you can do it with less components show us your circuit design.

So here is the project requirements.

using a pi gpio output pin to control a relay with a 3V DC coil with no external power supply for the 3V relay.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

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

Re: Relay won't flip

Mon Dec 23, 2019 9:43 am

emma1997 wrote:
Mon Dec 23, 2019 12:42 am
I'm convinced that diode is a holdover from the days of point contact germanium transistors. IMO practices like this tend to propagate throughout the ages more from a sense of superstitious ritual than science or engineering.

Depending on load inductance and circuit impedance I would be surprised to see 2x or in rare cases 3x kickback. Certainly with that silly 15ohm resistor not likely to see more than 120%. I say this from both theory and practical experience having captured dozens of traces on a variety of relays. With OPs 3v coil even a 1950's era CK722 with 8v Vceo would survive.

Not even a consideration for todays devices like penny 2n7002 at 60v even assuming an unlikely 8x pulse. 400v fets may actually cost a whole nickel. PCB space installed probably 10x the difference.

I suspect the same guys who put those diodes in there also drop voltage with resistors and favor bipolar transistors over fets (why not vacuum tubes? lol).

Speaking of diodes it would make more sense to use in place of that resistor. From an engineering standpoint easy peasy compared to wearing out your slide rule figuring how many ohms.

You kids! GET OFF MY LAWN!!!
Well I disagree with you that you can remove that diode. Yes the switching elements are getting beter and cheaper this day's. But the theorie and physics is not changing. That diode is to protect the transistor and to prevent a back EMF, what is also very important. Because you electronics can not interfere with other electronics. So, when you switch of the relay a large voltage spike is generated. This spike can give you strange behaviors of your electronics. For example this could reset you MCU or it will do something what was not planned. And it could also interfere with other products in a unwanted way.

You can read this link for more information

User avatar
davidcoton
Posts: 4671
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Relay won't flip

Mon Dec 23, 2019 1:08 pm

emma1997 wrote:
Mon Dec 23, 2019 12:42 am
You kids! GET OFF MY LAWN!!!
Have you considered that you are offering a minority opinion, and disagreeing with design engineers who have more experience than you, in many different environments? You are not arguing with kids, indeed it is your behaviour that appears childish. I should also point out that it is not your lawn, but the OPs. The OP is having enough difficult with your largely irrelevant and possibly dangerous advice.

You may be right, though I consider it unlikely. But this is not the time or place to advocate your minority ideas. Do proper quantitative research and publish a peer-reviewed paper in the scientific press. If you are right, you might even win a prize.
Signature retired

emma1997
Posts: 591
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Relay won't flip

Mon Dec 23, 2019 4:58 pm

Thanks for the feedback guys. I'm always open to criticism and new information as I have been wrong before. Not obvious ATM so something better than comments based on avatar misconceptions, minorities, or who's lawn would be more helpful.
pcmanbob wrote:
Mon Dec 23, 2019 8:59 am
Do you understand what the OP wants to do ?
I am convinced you don't , that silly 15 ohm resistor is to drop 2V at 133 mA so that the relay coil only gets 3V at 133mA.

if you so sure you can do it with less components show us your circuit design.
Yes, I do understand. Some of what I posted was for general concepts and some specific to the OP. I thought that was clear but if not apologize.

My point on this is diodes are a far better solution to drop 5v to 3v than resistors. More stable and less design calculation. I am open to any real problem with that 'theory'.

PS Less need for schematic with only one part.

Brandon92 wrote:
Mon Dec 23, 2019 9:43 am
Well I disagree with you that you can remove that diode. Yes the switching elements are getting beter and cheaper this day's. But the theorie and physics is not changing. That diode is to protect the transistor and to prevent a back EMF, what is also very important. Because you electronics can not interfere with other electronics.
I will agree only if it's somehow necessary to protect a 400v (or even 60v) transistor from a 6v spike. Again my point is the actual flyback voltage generated is insignificant compared to Vceo of modern devices. In fact even if your 12v measurements (which conflict with mine BTW) are valid still the 8v old 1950's process survives with OP's 3v relay. Notwithstanding modern penny fets at 10x or 100x that.


davidcoton wrote:
Mon Dec 23, 2019 1:08 pm
Have you considered that you are offering a minority opinion, and disagreeing with design engineers who have more experience than you, in many different environments? You are not arguing with kids, indeed it is your behaviour that appears childish.
...
You may be right, though I consider it unlikely. But this is not the time or place to advocate your minority ideas. Do proper quantitative research and publish a peer-reviewed paper in the scientific press. If you are right, you might even win a prize.
Yes, obviously a minority opinion but possibly not the 'more experience' part (emma is actually my youngest born '97 and I am not a teenager). Maybe some here have not taken the time to investigate the phenomena we discuss or dig into the theory. I have. Writing papers myself in 'scientific press' or 'prizes' are of little interest but I'd be glad to put together a work order to demo for any who can afford my rather high rates.

There is definitely some (small) chance I'm out of touch on this and would be glad to hear credible evidence. For now I will consider Laws of Physics not Suggestions of Physics.

It should be easy to understand:

1. Replacing 15ohm resistors with diodes for better regulation and less design effort.
2. Eliminating classic/ritual relay diodes since EMF spikes are far below modern transistor breakdown.
3. Replacing BJT with MOSFET so unnecessary base resistor goes away and no Vsat/heat.

In other words cut component count of that part of the circuit from four to one. The extra parts do not cause huge difficulty and if it helps to sleep better please leave them in.

Again I would like to hear any reliable evidence that would set me on the straight and narrow. It would be greatly appreciated and again thanks for your input.

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

Re: Relay won't flip

Mon Dec 23, 2019 7:35 pm

Okay, lets pull this to the test on the bench.

My test setup is a function generator that drives a BC547 via a 1k resistor. The relay is a G5v-2 from omron and the flyback diode is an 1n4148. And the power supply is set to 12V.

Channel 1 (yellow) is connected to the output of the function generator.
Channel 3 (pink) is connected to the collector of the transistor.

So the first scope picture is with a diode directly: here you can see that the relay is turned off fast and that there is a small overshoot.
RigolDS7_withdiode.png
RigolDS7_withdiode.png (61.37 KiB) Viewed 468 times
This scope picture is made without the diode: here you can see that the relay is not turned off fast (what could give other problems) and that there is an large overshoot (10 times the supply voltage)
RigolDS8_withoutDiode.png
RigolDS8_withoutDiode.png (107.28 KiB) Viewed 468 times
Now the ground wire of the probe is connected to its own tip (so it is basically a coil) and it placed on top of the relay.
This picture shows with a diode:
RigolDS6_shortprobe_withDiode.png
RigolDS6_shortprobe_withDiode.png (61.24 KiB) Viewed 468 times
This picture is without the diode:
(see next post)

You can see that without the diode a lot of noise is produced in comparisons to when the diode is connected. This could interfere with other electronics.

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

Re: Relay won't flip

Mon Dec 23, 2019 7:36 pm

see my post above
RigolDS5_sortprobe_withoutDiode.png
RigolDS5_sortprobe_withoutDiode.png (84.94 KiB) Viewed 467 times
To the OP, sorry for the "off topic" information.

emma1997
Posts: 591
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Relay won't flip

Mon Dec 23, 2019 9:19 pm

Thanks for that work Brandon and I don't think it is off topic at all. OP and anybody who puts relays on PI would benefit from the excellent information here.

If we assume a 10x flyback as shown in your pics then 30v generated from a 3v coil would be no problem with that 60v or 400v fet I recommend. Or even the 45v spec for your BC547 bipolar. My readings for similar relays were not even half that but since it's still not clear whether a ground spring instead of clip was used I'll defer for now. Still note those measurements far below the breakdown of your transistor with OPs 3v.

So if I were doing this a 2n7002 transistor would be chosen or maybe something like 2 cent MPSA42 (300v for crazy safety margin). Again that's accepting the 10x EMF readings. I hope my comments on no base resistors with MOSFETs and swapping half watts for diodes may make sense to a few.

Yourself, Bob, David, etc are obviously smart and experienced so no one can go wrong following their advice. It would not be a mistake for OP to ignore my comments and stick with the tried and true classic guidelines. I was only showing an example more economical and easier to design and build but by no means the only way.

I do have a variety of Omron models around including the OP's exact part and may revisit when time allows. I also have for hobby use similar 4ch Rigol. It was an amazing deal for $300. I have access to but hardly ever use the $20k high end one at the school but still rely on that Rigol myself far more often.

Thanks again for taking time to do this. Meanwhile maybe some new data will come out that does contradict at least one of my radical views. Anyway no problem with beginners sticking with old and tested methodologies. Better safe than sorry, right?

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

Re: Relay won't flip

Tue Dec 24, 2019 5:50 pm

emma1997 wrote:
Mon Dec 23, 2019 9:19 pm
If we assume a 10x flyback as shown in your pics then 30v generated from a 3v coil would be no problem with that 60v or 400v fet I recommend. Or even the 45v spec for your BC547 bipolar. My readings for similar relays were not even half that but since it's still not clear whether a ground spring instead of clip was used I'll defer for now. Still note those measurements far below the breakdown of your transistor with OPs 3v.

So if I were doing this a 2n7002 transistor would be chosen or maybe something like 2 cent MPSA42 (300v for crazy safety margin). Again that's accepting the 10x EMF readings. I hope my comments on no base resistors with MOSFETs and swapping half watts for diodes may make sense to a few.
Well how much the fly back voltage will rise is also depanding on the breakdown voltage of the transistor itself. If the "flyback" voltage is higher that the breakdown voltage of the tansitor itself. The transistor is "clamping" that voltage to his breakdown voltage. Thats why you see that the flat on the top.

Just for fun I did this test with another transitor and two mosfets: tip41c, IRF44n, IRF1310n with the following breakdown voltages: 100V, 55V and 100V. The bigger relay is this type

The following images (click here for a bigger picture)
Here you can see that the breakdown voltage of the switching element will limit the voltage. But this is not wat you really want, this will damage the switching element in the long run.
Image

For example in this video from w2aew -- #183: Why diodes are used around relay coils. (what is a very interesting video btw) He used a transistor with a higher breakdown voltage, so when the transistor was turned of the voltage raise to 260V with a 5V supply voltage.

Emma, however it is possible to chose a switching element that could resist that high voltage. But it is not recomended for a couple things. For example the fast voltage transient as show below (IRF1310n with the bigger relay). The voltage will rise in <1us to 110V and this could interfere with other components on your pcb.
RigolDS9.png
RigolDS9.png (70.46 KiB) Viewed 392 times
This type of transient could latch-up a microcontroller for example and/or reset the microcontroller. Or this transint could be pick-up by a pcb trace and gives a "false" value on that trace what could give you problems down the line.

So it is better to dump this energy in that flyback diode that in other parts of your PCB or in the devices that are around your PCB.

By the way I would advise you to do the same test and also hear the different in sound when you use the flyback diode or not. And remember that the flyback diode is not only to protect the transistor.

emma1997
Posts: 591
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Relay won't flip

Tue Dec 24, 2019 6:17 pm

True. I should not have overlooked davidcoton's comment on that early in this thread. Probably because I've personally had less experience with the RFI side of this than the voltage issue. I'm obsessed with power and relay tech and as a ham RF too. Not so much regarding the PI though. Not yet anyway.

I am very curious about how this effects Wifi/BT range. Specially newer versions which seem to be notoriously sensitive. I plan to run some more range tests during the break.

Thanks again for the new data. Very nice. I'd like to do similar checks to see how close we can get on these readings. Specifically see what difference using those long lead alligator clips vs spring type ground which are known to be considerably more reliable. I've been using the springs almost exclusively. Can't locate my long lead probe clips ATM but hope to find them before vacation ends.

BTW Happy Holidays Everybody!

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

Re: Relay won't flip

Tue Dec 24, 2019 7:34 pm

emma1997 wrote:
Tue Dec 24, 2019 6:17 pm
True. I should not have overlooked davidcoton's comment on that early in this thread. Probably because I've personally had less experience with the RFI side of this than the voltage issue. I'm obsessed with power and relay tech and as a ham RF too. Not so much regarding the PI though. Not yet anyway.

I am very curious about how this effects Wifi/BT range. Specially newer versions which seem to be notoriously sensitive. I plan to run some more range tests during the break.
If you are "obsessed" with power electronics and relay you will find out that it could be (reasonable) hard to make a circuit that is not producing that large voltage spikes. For example I was working with a buck converter that in some situation could produce a voltage spike of 100V/ns (and this is not a measurement mistake) :shock: But this make it more fun to solve the problem :D.
emma1997 wrote:
Tue Dec 24, 2019 6:17 pm
Thanks again for the new data. Very nice. I'd like to do similar checks to see how close we can get on these readings. Specifically see what difference using those long lead alligator clips vs spring type ground which are known to be considerably more reliable. I've been using the springs almost exclusively. Can't locate my long lead probe clips ATM but hope to find them before vacation ends.

BTW Happy Holidays Everybody!
No problem. I did tested it with the ground springs with the bc547, but in this case I didn't see much different in the trace. So I used the long probe clips for this test. However a good probe technique can make or brake your measurement. Also a very nice holiday wishes to you.

StevenThePig
Posts: 8
Joined: Thu Dec 19, 2019 12:25 am

Re: Relay won't flip

Wed Dec 25, 2019 12:45 am

pcmanbob wrote:
Sun Dec 22, 2019 8:23 pm
Looking at the linked document I don't see a relay coil listed that works at 3V , so are you sure the coil on your relay is 3V ?

may be you should post a picture of the relay showing its makings.

if your relay has a 5V coil then you can drive it like this


Image

What makes you think a transistor can't switch 12V , all you need to do is select a transistor that can switch the voltage/current you need to supply to what ever it is you are trying to control.

Even the small 2N2222 transistor can handle voltages up to 50V DC, just not at very high currents.
Thank you everyone for your help. But this solved the problem. It worked perfectly. Thank you.

LTolledo
Posts: 2848
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Relay won't flip

Wed Dec 25, 2019 3:26 am

pcmanbob's circuit always work....

on my part, I substituted 2N3904 (have lots of those) for 2N2222 (have these on stock as well but not a lot)

if you need to drive more, its better to use transistor array (some have built in clamping diode and input resistor), making lesser parts count.
example are the 7-channel TD62003APG and the 8-channel TBD62083APG. :D
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

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

Re: Relay won't flip

Wed Dec 25, 2019 8:47 am

LTolledo wrote:
Wed Dec 25, 2019 3:26 am

if you need to drive more, its better to use transistor array (some have built in clamping diode and input resistor), making lesser parts count.
example are the 7-channel TD62003APG and the 8-channel TBD62083APG. :D
Or if the above are not readily available the good old ULN2803A is a good substitute and also has the input resistor and clamping diode.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

gordon77
Posts: 4681
Joined: Sun Aug 05, 2012 3:12 pm

Re: Relay won't flip

Wed Dec 25, 2019 9:15 am

StevenThePig wrote:
Wed Dec 25, 2019 12:45 am
pcmanbob wrote:
Sun Dec 22, 2019 8:23 pm
Looking at the linked document I don't see a relay coil listed that works at 3V , so are you sure the coil on your relay is 3V ?

may be you should post a picture of the relay showing its makings.

if your relay has a 5V coil then you can drive it like this...

What makes you think a transistor can't switch 12V , all you need to do is select a transistor that can switch the voltage/current you need to supply to what ever it is you are trying to control.

Even the small 2N2222 transistor can handle voltages up to 50V DC, just not at very high currents.
Thank you everyone for your help. But this solved the problem. It worked perfectly. Thank you.
The 3v relay is OK with 5v or did you use a 5v relay?

Return to “Troubleshooting”