JGrave
Posts: 4
Joined: Wed Feb 12, 2020 3:09 pm

Which resistor and diode to use ?, for tip120 for 24v solenoid valve.

Wed Feb 12, 2020 4:02 pm

Greetings to all in the forum. I have found good schemes to control 12v soleniod valves, which I show in the image. But I have 24v 9.5w solenoid valve. Does the same resistors and diodes help me? If not, which ones should I use?

Resistor: 180 ohms (I've seen schemes with 390 ohms)
Diode: 1N4004

Thank you.


Image

https://forum.allaboutcircuits.com/thre ... ed.130596/

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

Re: Which resistor and diode to use ?, for tip120 for 24v solenoid valve.

Wed Feb 12, 2020 7:25 pm

Most of those tutorials and nearly all internet forum pundits still push circuits and parts from the early 60's.

Switching to a modern semiconductor like MOSFET or IGBT can have several benefits. For example no resistors or diodes may be needed at all depending on current and voltages involved. Also, for the same power, cheaper and verified in my recent tests significantly less noise and heat.

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

Re: Which resistor and diode to use ?, for tip120 for 24v solenoid valve.

Wed Feb 12, 2020 10:38 pm

Despite emma1997's assertions, there are good reasons for including the diode and resistor.

Resistor: With a TIP120 or other bipolar transistor, it's essential. With a FET, it is not required to make the circuit work, but as stated in the thread you linked, it will give some protection to the Pi if the FET fails. The value shown is a little low for effective protection: with a bipolar transistor calculate the highest value that will saturate the transistor (given worst case gain and the collector current required by the solenoid). With a FET, just use something around 1K to 3K3.

Diode: this not only protects the transistor (which arguably is not necessary, but I prefer conservative design), but also vastly reduces the possibility for emitted RF interference when the solenoid is de-energised. It is short-sighted, anti-social and irresponsible to omit it.
Signature retired

JGrave
Posts: 4
Joined: Wed Feb 12, 2020 3:09 pm

Re: Which resistor and diode to use ?, for tip120 for 24v solenoid valve.

Thu Feb 13, 2020 4:27 pm

Thank you very much for your help. The IRL540N mosfet is Ok ?. And 1K resistor.

https://www.mouser.com/datasheet/2/196/ ... 732926.pdf

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

Re: Which resistor and diode to use ?, for tip120 for 24v solenoid valve.

Thu Feb 13, 2020 5:04 pm

If I have interpreted the spec correctly, it's fine.
Signature retired


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

Re: Which resistor and diode to use ?, for tip120 for 24v solenoid valve.

Thu Feb 13, 2020 9:42 pm

JGrave wrote:
Thu Feb 13, 2020 4:27 pm
The IRL540N mosfet is Ok ?. And 1K resistor.
Yes, IRL540 is one of my favorites because they are so cheap. 100v and 35a at 10 cents is quite a good deal. 1k in series with the gate is also fine and certainly wouldn't hurt. However if you are truly moved by scare tactics a cement block on top would protect from most (small) meteor hits too. lol

Since you're dealing with 24v and not 3v or 5v, a diode across the solenoid makes a tiny bit more sense. Still not technically required. Using a higher voltage FET like IRF840 would make it generally pointless. But those HV FETs are not 10 cent parts, maybe even up to 30 cents ea.

IMO recommendations for these extra parts are typical internet FUD. However strangely no mention of a resistor from gate to ground which actually could serve a purpose in some rare cases. It would minimize possibility of a brief (milliseconds) coil activation during startup before ports are initialized. Unlikely but I've seen it happen with some computers. Less likely with Pi having those default pull-downs though.
davidcoton wrote:
Wed Feb 12, 2020 10:38 pm
Despite emma1997's assertions, there are good reasons for including the diode and resistor.
I would have to agree but IMO mostly to help beginners who have been 'scared straight' to get better nights sleep.
davidcoton wrote:
Wed Feb 12, 2020 10:38 pm
Diode: this not only protects the transistor (which arguably is not necessary, but I prefer conservative design), but also vastly reduces the possibility for emitted RF interference when the solenoid is de-energised.
IDK about that. The diode, while it may protect a poorly chosen old tech transistor, actually generated measurably more UHF noise in recent tests compared to no diode at all. Those sharply clipped spikes have much higher frequency harmonics if less total energy than a smoother unfettered EMF bump. Square law devices like BJTs and diodes tend to do that. Actually the MOSFET with clamp was noisier than without but not as bad as bipolar. So more EMF voltage but less radio interference.

I found great advantage to bare FET vs BJT in both RFI and EMF. In any case really depends on what's in your junk box. BJT, resistors, diodes... if you got 'em use 'em. They do work (sort of). Doubtful it matters in most applications.
davidcoton wrote:
Wed Feb 12, 2020 10:38 pm
It is short-sighted, anti-social and irresponsible to omit it.
Maybe. I do wear glasses and personally harbor enormous hatred for certain semiconductor devices. SPECIALLY those dam NPNs. Ever since mom locked me in a closet full of 2n170 as a kid. Something about that nipple on top. Grrrrrrr.... me KILL bipolar transistor !!!!
Last edited by emma1997 on Thu Feb 13, 2020 10:25 pm, edited 1 time in total.

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

Re: Which resistor and diode to use ?, for tip120 for 24v solenoid valve.

Thu Feb 13, 2020 10:23 pm

O boy, here we go again ;) :) As told before it is not only about he switching element.
emma1997 wrote:
Thu Feb 13, 2020 9:42 pm
IDK about that. The diode, while it may protect a poorly chosen old tech transistor, actually generated measurably more UHF noise in recent tests compared to no diode at all. Those sharply clipped spikes have much higher frequency harmonics if less total energy than a smoother unfettered EMF bump. Square law devices like BJTs and diodes tend to do that. Actually the MOSFET with clamp was noisier than without but not as bad as bipolar. So more EMF voltage but less radio interference.
If the diode is not present the frequency is indeed high and without the diode there is indeed "no" high frequency part. Because the energy is dissipated in the diode. However the energy in the diode or in the "air" should be the same, because it is stored in the coil. Also when the diode is not used the energy is also dissipated in the parasitic capacitor of the switching element itself, it will start to oscillate at a high frequency. Or it will be clamped by the (protection diode) in the MOSFET itself (if it has one).

"So more EMF voltage but less radio interference" Ehm, if there is more "EMF voltage, so more energy, then it will still be able to be interference with something. Maybe on a other band, but it is still there.

Also, about what for kind of test are you talking?

However the bipolar transistor is still a useful part in some cases ;)

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

Re: Which resistor and diode to use ?, for tip120 for 24v solenoid valve.

Thu Feb 13, 2020 10:57 pm

Brandon92 wrote:
Thu Feb 13, 2020 10:23 pm
If the diode is not present the frequency is indeed high and without the diode there is indeed "no" high frequency part.
I'm not sure what you meant to say there but we are certainly at least half in agreement. That last half.

BTW by 'high' I mean UHF/VHF not low frequency ringing shown in those traces you posted. I see a huge round pulse using FETs with far less ringing.
Brandon92 wrote:
Thu Feb 13, 2020 10:23 pm
However the bipolar transistor is still a useful part in some cases ;)
Absolutely. And as I said if that's what you have on hand they will work in this and most other similar applications. Unlikely 'best' choice though. However there are situations where a MOSFET will not work as well or even at all. IE bipolar make much better current source, dual diode, bandgap, etc etc etc.

You certainly have lots of experience like most of the regulars around here that I've learned so much from. Not always absolutely right though and there's even cases where noobs are more on top of things. (I will remind you again that I may be a Linux moron and no Pi expert but not a noob regarding EE).

Bottom line: use what you got.

We are all entitled to our theories and opinions. I for one would be VERY unhappy if everyone agreed 100% with mine.

JGrave
Posts: 4
Joined: Wed Feb 12, 2020 3:09 pm

Re: Which resistor and diode to use ?, for tip120 for 24v solenoid valve.

Fri Feb 14, 2020 2:53 pm

emma1997 wrote:Since you're dealing with 24v and not 3v or 5v, a diode across the solenoid makes a tiny bit more sense. Still not technically required. Using a higher voltage FET like IRF840 would make it generally pointless. But those HV FETs are not 10 cent parts, maybe even up to 30 cents ea.
The price does not matter, but the IRF840 is activated with 10V, not with 3.3V. Then I would have to add more components. I keep the IRL540N.

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

Re: Which resistor and diode to use ?, for tip120 for 24v solenoid valve.

Fri Feb 14, 2020 5:38 pm

I think IRL540 is a good safe choice. 10v for IRF840 is only to get max current and since your solenoid only draws a couple hundred ma or so 3v is probably more than enough. IME that part runs cooler than BJT even with 3v drive. TIP120 is also ok if you have one (with low voltage parts and high supply voltage like yours a coil diode is actually smart).

Whatever is easiest to get your hands on.

As mentioned before I am surprised nobody has brought up the gate pulldown resistor. Probably not needed but IMO more likely than the other parts discussed. If you have issues with short pulse at startup (depending on Pi pin chosen) this will fix it:
Attachments
MOSFET.JPG
MOSFET.JPG (24.65 KiB) Viewed 319 times

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

Re: Which resistor and diode to use ?, for tip120 for 24v solenoid valve.

Fri Feb 14, 2020 8:21 pm

I'm also more in EE than in linux ;) but there are indeed different opinions in the field. What is a good thing, then we can learn from each other :)
emma1997 wrote:
Thu Feb 13, 2020 10:57 pm
BTW by 'high' I mean UHF/VHF not low frequency ringing shown in those traces you posted. I see a huge round pulse using FETs with far less ringing.
Is there any change you might have an example?

I personally always use a pull-down resistor on the gate of the MOSFET. At start-up there is (probably) a time that the gpio is not defined and it could enable the MOSFET. Then you need a pull-down that is stronger than the internally pull-down that is on the gpio pin. This will ensure that the MOSFET is turned off. And you can only turn it on by setting the gpio high. This is also very important when you have for example a (half) H-bridge that you drive from a MCU. You don't want that the high-side and low-side MOSFET is turned on at the same time. However, it could make things interesting to see :twisted:

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

Re: Which resistor and diode to use ?, for tip120 for 24v solenoid valve.

Fri Feb 14, 2020 10:19 pm

davidcoton wrote: Despite emma1997's assertions, there are good reasons for including the diode and resistor.
...and here I am trying to look into an RPi to vacuum tube driver for an AC relay to solenoid valve.......
"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!"

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

Re: Which resistor and diode to use ?, for tip120 for 24v solenoid valve.

Sat Feb 15, 2020 1:05 am

LTolledo wrote:
Fri Feb 14, 2020 10:19 pm
davidcoton wrote: Despite emma1997's assertions, there are good reasons for including the diode and resistor.
...and here I am trying to look into an RPi to vacuum tube driver for an AC relay to solenoid valve.......
Don't forget the opto-isolator and the DC relay. A turbo-encabulator could be useful, too.
Signature retired

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

Re: Which resistor and diode to use ?, for tip120 for 24v solenoid valve.

Tue Feb 18, 2020 12:40 am

Hmmmmmm.... sounds like more of that there anti-social engineering fer sure !!! :)
Brandon92 wrote:
Thu Feb 13, 2020 10:23 pm
Also, about what for kind of test are you talking?
Well you deserve much of the credit inspiring me to do some testing of Pi4 noise vs transistor type. It became quite a subject of discussion at my local radio club. Originally starting with some range tests of Pi4's notoriously noisy USB3 and highly sensitive WIFI/BT with this relay stuff just incidental. Tail started quickly wagging the dog and some of my buddies were amazed at our results.

There are some scope screens on my thumb drive but unfortunately not at this current location. Forgot to yank it from the Rigol on my way out. When schedule allows I'll fetch and maybe start a new thread. Thanks again for the motivation.

Return to “General discussion”