You sure could. Make sure the 12V supply is able to accept current flowing into it, as well as providing current flowing out.

But it's more efficient to use an "H-bridge" circuit to reverse both ends.
To move in one direction, you put one end at 0V and the other end at 24V.
To move in the other direction, you put one end at 24V and the other end at 0V.

The half-H-bridge is just a pair of switches, one to 24V and one to 0V, so that the output can be either 24V or 0V depending on which one you turn on. Turning on both at the same time creates a short circuit, so don't do that. The H-bridge is just two halves, one for each end of the solenoid.

Of course, the solenoid has to be mechanically designed to work in both directions, too. There's no point moving a solenoid both ways, if one way causes it to bump into an end stop and not move.

The solenoid must use a permanent magnet in the moving piece, because iron that isn't magnetized will be attracted to either a north or south field equally well - reversing the current will reverse the magnetic field but that won't achieve anything.

Answer from Stack Exchange Broke The Law on Stack Exchange
🌐
Reddit
reddit.com › r/askelectronics › controlling solenoid with 3.3v / 5ma
r/AskElectronics on Reddit: Controlling solenoid with 3.3V / 5mA
April 5, 2023 -

Hello all,

So to give a brief summary, I'm developing a control board for some of my milling machine's peripherals. The bit that has been giving me trouble is a solenoid valve for the misting system. I've gone through a few tests a few times now that seemed to work, and then ordered a PCB with the changes, but problems seem to keep coming up (hence I'm asking here now as I'm a bit tired of it).

 

The hardware

The output voltage of the GPIO on my mill's controller (MicroMill 2000HD/LE)seems to be 5mA @ 3.3V (I was told 5mA @ 5V by the manufacturer, but this turned out to be wrong. Waiting on further responses from them...). I found out that the parallel port pins of my mill PC was being passed directly through to this GPIO port, with a 1K pull-up to 5V (diagram). It seemed to happily source ~53mA when quickly shorted, but I presume somewhere in the range oif 10mA is safer.

 

The solenoid I am using operates at 12V DC (7W), consuming ~600mA.

 

The schematic

Here's the schematic. The OUT1 pin is 3.3V. On the right side, the optocoupler should control the solenoid connected to J9.

 

I decided to use an optocoupler (CPC1301GR) in order to control the solenoid with the GPIO, as this one has a low input control current. My choice of resistor (900ohm) should draw ~3.67mA. I am also aiming to isolate the peripherals (e.g. solenoid) from the rest of controller, hence another reason why I chose an optocoupler.

 

The results

Unfortunately, it's misbehaving (as you may have guessed). If I briefly toggle OUT1 (thus not fully saturating the solenoid coil), the optocoupler is able to 'shut off'. However, leaving OUT1 high for a few moments (thus saturating and actuating the solenoid valve), then setting OUT1 low, causes the optocoupler to remain conducting (across pins 3/4) until I remove power.

 

I am noticing now in the optocoupler datasheet in the "CTR vs. LED Current (IF)" graph, I should have a CTR at around 4000% from the 3.67mA that should be sourced from OUT1, thus resulting in ~147mA that can be drawn across the optocoupler pins 3/4 (if I have understood the datasheet correctly). However, I don't understand how the solenoid could be actuating with this little current (unless the optocoupler has become damaged at this point).

 

So obviously my design is bad, and I should redo this. So I am wondering, how should this circuit actually be properly designed (i.e. did I miss anything important?), or should I consider an alternative approach not using an optocoupler? If any more info is needed, I would be happy to provide.

 

Thanks for reading all this, and any help/advice is appreciated!


Some updates: I have updated the design to this using some advice on designing around parallel port data pins. The Microcap sim of the design with OUT1 high can be seen here as well.

From playing around with it so far, this looks like it will be a more reliable design.

🌐
All About Circuits
forum.allaboutcircuits.com › home › forums › hardware design › general electronics chat
Driving a solenoid | All About Circuits
October 28, 2024 - 12V --> solenoid 12V --> AP63205 -->LDO 3.3V --> MCU The two 12V voltages are in common for both the solenoids and the input of AP63205. ... Yes it is correct my solenoids work at 12V, but I also have an MCU that works at 3.3VDC and my doubt is that the solenoids when the switching happens, the input capacitor may discharge and create issues for the MCU.
Discussions

Can you actuate a solenoid with three different voltages? - Electrical Engineering Stack Exchange
Example, one end (S1) of a solenoid hooked to 12 V and the other end (S2) to either ground or 24 V. Could you use an op-amp to raise and lower S2 to control the flow of current through the solenoid? More on electronics.stackexchange.com
🌐 electronics.stackexchange.com
April 11, 2023
arduino - Controlling a 12V solenoid lock with 3.3V - IRLZ44N - Electrical Engineering Stack Exchange
I would like to drive a solenoid lock from a 3.3 V MCU with a N-channel IRLZ44N MOSFET. Here are the specs and diagram: Solenoid Lock: 12 V – 2 A (K02-12V DC 2A Electric Magnetic) Below is the diag... More on electronics.stackexchange.com
🌐 electronics.stackexchange.com
June 17, 2022
What happens if I supply 3.3v to a 5v rated solenoid?
Sorry if this is a dumb question guys, but this is my first time with any Arduino/electrical work. But I have a mkr gsm 1400 and I was wondering if there's any cons to supplying my 5v solenoid with 3.3v instead since there's no digital 5v pin outs on my board. More on forum.arduino.cc
🌐 forum.arduino.cc
5
0
October 15, 2018
solenoid - My MOSFET operated circuit works with 5v but not 3.3v - Electrical Engineering Stack Exchange
I am using a circuit nearly identical to the one used in this question by Dyte. My version is pictured below: I am powering the solenoid (water valve) with 12v, using a RFP30N06LE MOSFET (datasheet... More on electronics.stackexchange.com
🌐 electronics.stackexchange.com
September 11, 2017
🌐
Arduino Forum
forum.arduino.cc › other hardware › motors, mechanics, power and cnc
3.3v switching valve solnoid - Motors, Mechanics, Power and CNC - Arduino Forum
September 26, 2017 - I have a solenoid valve that works with 5v and 800ma I want to control it with atmega328p 3.3v and "IRLML2502" if not propose a name of another "mosfet"
🌐
Banggood
banggood.com › buy › 3.3v-solenoid.html
3.3v solenoid - Buy 3.3v solenoid with free shipping | Banggood Shopping
B100 IC Transistor Capacitor Tester Multifunctional Integrated Circuit Tester Transistor Capacitor Diode Checker Auto Mode 1300 Chip Models 420 Transistor Types 5V 3.3V Testing ... SONOFF MINI-D Dry WiFi Smart Switch with Matter Dry Contact Output AC/DC Input Compatible Alexa & Google Home for Garage Doors Boilers Low Power DC Motors/Solenoid Valves
🌐
ATO
ato.com › transmission & actuator › solenoid valves › mini solenoid valves
3V Mini Solenoid Valve, 2 Way | ATO.com
3V Mini Solenoid Valve, 2 Way - High quality and reasonable price mini solenoid valve for sale online. The rated voltage of mini electric solenoid valve is 3V. 2 way solenoid valve is widely used in analytical instrument, medical device and machinery manufacturing.
Price: $49.37
🌐
Alibaba
alibaba.com › solenoid-3.3v-suppliers.html
Solenoid 3.3v Suppliers, Manufacturer, Distributor, Factories, Alibaba
Alibaba offers 7 Solenoid 3.3v Suppliers, and Solenoid 3.3v Manufacturers, Distributors, Factories, Companies. There are 3 OEM, 1 ODM, 1 Self Patent. Find high quality Solenoid 3.3v Suppliers on Alibaba.
Top answer
1 of 4
3

You sure could. Make sure the 12V supply is able to accept current flowing into it, as well as providing current flowing out.

But it's more efficient to use an "H-bridge" circuit to reverse both ends.
To move in one direction, you put one end at 0V and the other end at 24V.
To move in the other direction, you put one end at 24V and the other end at 0V.

The half-H-bridge is just a pair of switches, one to 24V and one to 0V, so that the output can be either 24V or 0V depending on which one you turn on. Turning on both at the same time creates a short circuit, so don't do that. The H-bridge is just two halves, one for each end of the solenoid.

Of course, the solenoid has to be mechanically designed to work in both directions, too. There's no point moving a solenoid both ways, if one way causes it to bump into an end stop and not move.

The solenoid must use a permanent magnet in the moving piece, because iron that isn't magnetized will be attracted to either a north or south field equally well - reversing the current will reverse the magnetic field but that won't achieve anything.

2 of 4
0

Could you use an opamp to raise and lower S2 to control the flow of current through the solenoid?

Thats fine, there are a few problems. One is overvoltage from the solenoid actuating. If it simply to turn the solenoid on and off, then an opamp would be an expensive way to do this.

You can use hit and hold if circuits if you need different current/voltage levels: How do I use a hit and hold circuit with a solenoid?

🌐
Reddit
reddit.com › r › AskElectronics › comments › 1kjthx0 › switching_24v_solenoid_from_33v_logic_levels_mos
Switching 24V solenoid from 3.3V logic levels
A subreddit for practical questions about component-level electronic circuits: design, repair, component buying, test gear and tools.
Find elsewhere
🌐
Electronic Design
electronicdesign.com › markets › automation › article › 21806574 › whats-the-best-way-to-drive-a-solenoid
What’s the Best Way to Drive a Solenoid? | Electronic Design
The delay time (where the solenoid is driven at 100% duty cycle) is set by the values of R1 and C1. For a standard 3.3-V logic level, the time is approximately 0.33 × RC.
Top answer
1 of 2
1

The Rds(on) is only guaranteed with a minimum drive voltage of 4.0V. 3.3V is less than 4.0V.

Possibly the MOSFET is heating up which typically decreases the Vgs for a given current. If you got the IRLZ44 from some dodgy source it's possible it does not meet specs. Although it's bad design to use an IRLZ44 with 3.3V drive, I would expect it to typically work under nominal conditions. That kind of time constant sounds like thermal or possibly leakage (as in an open or almost open connection to the gate).

There are many, many MOSFETs which are rated with 3V, 2.5V and even 1.8V drive, but few, if any, in a through-hole package. Here is one example, 0.005\$\Omega\$ maximum with 2.5V drive and 0.075\$\Omega\$ maximum with 1.8V drive.

If the MOSFET fails with a drain-gate short it could damage (ie. destroy) the MCU. Electrical noise could reset the MCU. You could use an optocoupler or add some transistors to drive the MOSFET which would provide protection. You might also be worried about the solenoid lock being destroyed if the MOSFET fails on- I think most of them are only rated for very intermittent duty.

2 of 2
1

Although it is stated that it is a "logic-level gate drive" where "Gate Threshold Voltage: 1<VGS<2" in the mosfet datasheet, mosfet is acting weirdly with a gate voltage of 3.3V.

It is specified for Vgs of 4V, but not 3V3.

Why does it take 10 seconds for the current to rise to 1.8 amps (Gate: 3.3v)? While working perfectly with a gate voltage of 5.0v.

Most MOSFETs have negative tempco on their threshold voltage, and positive tempco on RdsON.

My guess is that there isn't enough voltage on the gate to turn it on fully. You can confirm this by measuring Vds and Id, which will give you RdsON. If it is much higher than the specified datasheet RdsON, then it's not turned on enough. So the MOSFET works in linear mode, and as it heats up, its threshold voltage decreases, which means it turns on more, and current increases. If current increases over 10 seconds, you should feel the MOSFET get hotter.

You either need a MOSFET that will turn on with a Vgs below 3V3 (so, another MOSFET). If you have a 5V power supply on your board, you can use a 3V3 to 5V level converter/driver, for example a 74HCT logic gate, to drive this MOSFET with 5V.

🌐
Hackaday
hackaday.io › project › 156847-simple-pcb-to-control-a-33v-solenoid
Simple PCB to control a 3.3V Solenoid | Hackaday.io
This project is a small PCB to control a low-power solenoid valve directly from a micro-controller
🌐
Arduino Forum
forum.arduino.cc › other hardware › general electronics
What happens if I supply 3.3v to a 5v rated solenoid? - General Electronics - Arduino Forum
October 15, 2018 - Sorry if this is a dumb question guys, but this is my first time with any Arduino/electrical work. But I have a mkr gsm 1400 and I was wondering if there's any cons to supplying my 5v solenoid with 3.3v instead since there's no digital 5v pin outs on my board.
Top answer
1 of 2
2

The threshold voltage of the BS170 is too high to operate off 3.3V.

if you look at the BS170 datasheet you will see from Fig1 on page 3 that at 3.3v it will only pass about 200 mA which is almost certain not enough to drive the solenoid.

The MOSFET will possibly pass enough current to heat up significantly so be careful operating in this state.

You depict a TO220 package - the only data sheet I could find was for smaller packages - is it really a BS170?

You need to find a device that will turn on adequately with only 3.3v drive or amplify the voltage up to a reasonable drive level.

Older MOSFETs we designed for 10V gate drive, a number of logic-level devices were the designed to be driven by 5V logic. There are even fewer that will work from 3.3v.

You need to know how much current the solenoid requires in order to select the MOSFET.

http://www.mouser.com/ds/2/308/BS170-1118810.pdf

2 of 2
0

Do you have an actual schematic of your circuit? The graphic you showed has the gate on the middle leg of the MOSFET's package, that isn't the case for the MOSFET whose datasheet you linked. Values of your pull-down resistors would be helpful too.

Without further information, I would say the threshold voltage is too large to be turned on by the 3.3V logic. The max threshold voltage of your transistor under tested conditions is 2V, this isn't a huge amount of leeway.

Measuring 12V between drain and source doesn't mean that the solenoid should be activated. If you measure across a 12V battery whose terminals are unconnected you will measure 12V. The transistor is not turned on so there is effectively an open circuit between the drain and source, you will measure 12V but not current will flow.

🌐
Reddit
reddit.com › r/arduino › can someone suggest a 3.3v solenoid that can be powered from arduino?
r/arduino on Reddit: Can someone suggest a 3.3V solenoid that can be powered from Arduino?
March 28, 2016 -

I'm looking for a solenoid that I can control from an Arduino pro mini 3.3V. The solenoid would be used as a means to open a springloaded hinged box. I'd want that solenoid to pull in for a short time freeing the lid to open. I'm thinking the 'movable pin' part should be about an inch or two long and have at least 0.5 inch travel. Can this be powered by one of the io pins or will I need to use a relay to provide power? I know nothing about solenoids and their power consumption so perhaps what I'm planning is a bad idea.

🌐
Electro Tech Online
electro-tech-online.com › electronics forums › electronic projects design/ideas/reviews
Help wiring a 3 prong solenoid valve with a solid-state relay | Electronics Forum (Circuits, Projects and Microcontrollers)
July 25, 2023 - Due safety precautions should be taken with any circuit involving mains voltage or electrostatic-sensitive components. Alec's First Law:- Every problem has a solution (given the right information and resources). ... Typically, the two parallel blades on the solenoid are the power connections & the third is a ground connection, if needed.
🌐
BC Robotics
bc-robotics.com › tutorials › controlling a solenoid valve with arduino
Controlling A Solenoid Valve With Arduino - BC Robotics
October 1, 2023 - Reply ... You will need to move the 12v power supply to the breadboard and just connect the ground between the breadboard and the ground pin on the pi. The Pi would run on its normal power supply.
🌐
Electro Tech Online
electro-tech-online.com › electronics forums › general electronics chat
Driving Solenoid 48V from 3.3V | Electronics Forum (Circuits, Projects and Microcontrollers)
September 20, 2012 - The solenoid is like a spring. (my schematic) If you pull the bottom end down to ground, you have 48 volts across the solenoid. That is like pulling 48 inches across a sprint. Then you open up the MOSFET, it is like letting go of the spring. Both want to shoot up.
🌐
Axiomatic
axiomatic.com › home › automation › hydraulic valve drivers & controllers › 3a solenoid drivers
3A Solenoid Drivers | Axiomatic Technologies Corporation
August 27, 2026 - The 3 Amp Solenoid Drivers simplify control of proportional solenoids by supplying a current proportional to a user selectable input control. They are suited for industrial applications interfacing with a PLC. This linear solenoid driver line-up utilizes high frequency switching output (PWM) to provide a DC current output...