I'm building a pump for which I need 4 medium strength solenoids (20-50N). 24V is probably the minimum I will need to put through them, but this is something I need to test, once I've got them working. At 24V they draw 400mA.
I've found various posts with very useful info, especially https://playground.arduino.cc/Learning/SolenoidTutorial and https://forum.arduino.cc/index.php?topic=417030.0
Will the attached sketch below work for one? If so what resistance should R1 be? And if so can you see any problems with hooking up 4 working at different intervals?
The power supply is an LRS-350-24RS, and the Mosfet has a max gate source voltage of 35V. The 5v-24v optocoupler is off ebay - https://www.ebay.co.uk/itm/152904980799
Many thanks for your help!!
-
Did you draw that schematic?Majenko– Majenko2018年04月17日 15:03:07 +00:00Commented Apr 17, 2018 at 15:03
-
The resistor should be on the other (left) side of the optoisolator. The diode parallel to the solenoid should be the other way around.Gerben– Gerben2018年04月17日 15:05:46 +00:00Commented Apr 17, 2018 at 15:05
-
I also think you need a pull down resistor on the gate of the mosfet.Gerben– Gerben2018年04月17日 15:07:12 +00:00Commented Apr 17, 2018 at 15:07
-
You are attempting to source current into the MOSFET gate to turn it on? Then the transistor in the Opto is upside down.CrossRoads– CrossRoads2018年04月17日 15:12:35 +00:00Commented Apr 17, 2018 at 15:12
-
@ Majenko Yes, but based closely on what I've seen from other postsOliver Walters– Oliver Walters2018年04月17日 15:16:16 +00:00Commented Apr 17, 2018 at 15:16
2 Answers 2
No, it won't:
- The diode D1 is backwards.
- The opto-coupler is wired completely wrong.
You don't actually need the opto-coupler as long as the threshold voltage of the MOSFET is low enough for the Arduino to switch. However if you do want (or need) to use it you should wire it like this:
schematic
simulate this circuit – Schematic created using CircuitLab
R1 is a pull-down that keeps the MOSFET off when not being turned on (just like with a button). The value doesn't matter much. R2 is a resistor just like you use for any LED with an Arduino. D1 must be connected reverse biased or it will just short out your solenoid. The opto-coupler must be connected with the transistor the right way around or it will not work (or melt, or create a black hole...)
To ditch the opto-coupler you can just treat it like any other load on the Arduino (as long as the MOSFET's threshold voltage VGS is below 4V):
schematic
-
@ Majenko OK cheers for that. Surely you need the optocoupler for this to work, as the Ardunio cannot take 24V, so where would you return the Arduino signal to the MOSFET back to?Oliver Walters– Oliver Walters2018年04月17日 15:32:49 +00:00Commented Apr 17, 2018 at 15:32
-
Why would it be "taking" 24V?Majenko– Majenko2018年04月17日 15:33:29 +00:00Commented Apr 17, 2018 at 15:33
-
Is there any reason for using a schottky diode, instead of a regular diode?Gerben– Gerben2018年04月17日 16:02:19 +00:00Commented Apr 17, 2018 at 16:02
-
1@Gerben They tend to have faster switching from reverse to forward bias, making them absorb the back-EMF better.Majenko– Majenko2018年04月17日 16:03:02 +00:00Commented Apr 17, 2018 at 16:03
-
1@TDHofstetter The pulldown resistor is there because the Arduino's GPIOs default to INPUT (Hi-Z) so the input to the MOSFET is floating until it's actively driven by the Arduino - and there is a delay at startup caused by the bootloader, so there's a couple of seconds where the relay could trigger erroneously at power up.Majenko– Majenko2022年05月29日 21:08:23 +00:00Commented May 29, 2022 at 21:08
The MOSFET, to be driven from Arduino directly, needs to have a Logic Level gate. I've been using AOD514. Logic level gate, Low Rds, rated for 30V. https://www.digikey.com/product-detail/en/alpha-omega-semiconductor-inc/AOD514/785-1357-1-ND/3060919 SMD only, they seem to have cancelled their thru-hole line of parts that I used to use. I have up to 32 of them on a board with the gates driven by 74HC595 shift registers for driving 1A loads (only limited by trace widths, not the transistors), with diodes added at the coil if needed. http://www.crossroadsfencing.com/BobuinoRev17/
-
Ah great thanks. I hadn't cottoned on when Majenko mentioned this above. Have now read up and will change to this LogicFET docs-emea.rs-online.com/webdocs/0791/0900766b8079135d.pdf .Oliver Walters– Oliver Walters2018年04月18日 13:25:40 +00:00Commented Apr 18, 2018 at 13:25