7

I was wondering what the best way to run a solenoid would be from an Arduino board. I was thinking about using a MOSFET that runs into a relay to turn on the solenoid but am not sure how to go about it.

Oli Glaser
  • 54,990
  • 3
  • 76
  • 147

2 Answers2

9

You can drive the solenoid using only the MOSFET (or a bipolar transistor)
It would help to know what type of solenoid you wish to drive so we can select suitable components. Here are a couple of circuits to give you the general idea for MOSFET/Bipolar:

MOSFET solenoid

The resistor can be ~10k - 100k (the range can be wider as Steven notes, e.g. 1k\$ \Omega \$ - 10M\$ \Omega \$ - too high a resistance and you risk susceptibility to noise though), it's to make sure the gate is pulled to ground if the input is floating. The diode can be almost any general purpose diode capable of handling a reasonable amount of current.

Darlington Version:

Darlington solenoid

Oli Glaser
  • 54,990
  • 3
  • 76
  • 147
  • Oli, I don't think noise will be an issue. Even when driven from an open drain output the pull-up will provide a low impedance. The resistor is just there in case the gate would float for some reason, but if the driver is disconnected/defective the device won't work properly anyway, and by the way, a 10 M\$\Omega\$ resistor generates only 400 \$\mu\$V Johnson noise at room temperature over a 1 MHz bandwidth. – stevenvh Jul 11 '12 at 09:57
  • @Steven - I wasn't thinking of Johnson noise, rather just in the (unlikely) event the input is left floating in a noisy environment (as mentioned). You could say the resistor is not needed at all if you're sure it's always driven properly (e.g. uC pin active before solenoid supply active) – Oli Glaser Jul 11 '12 at 10:04
  • Agreed, and IMO initializing I/Os should be (one of) the first thing to do after the uC is reset. Leaving the gate floating for a ms won't hurt it (even when the solenoid's power is already active). – stevenvh Jul 11 '12 at 10:09
  • @stevenvh 10 years on :-). No harm in most cases. I was designing a multi track tape deck drive (in 1977) and there was a brief glitch at startup for this reason. This latched a fast-rewind commend into the deck and it despooled the tape. Nothing in the code explained it :-) . Solution was both good pulldowns and a ***STOP!!!*** commend as soon as the system initialised :-) – Russell McMahon Apr 12 '21 at 05:17
2

If the solenoid needs an AC drive you'll indeed need the relay, otherwise you can directly drive the solenoid with the MOSFET. They're the same kind of load.

enter image description here

Oli suggests 10 kΩ to 100 kΩ for R2, but you can even use a 1 MΩ for this. Make sure that you have a logic FET. Other FETs may need a too high gate voltage to turn on. A relay may need around 50 mA or less, a solenoid probably a couple of hundreds of mA. Select a FET with a low \$R_{DS(ON)}\$, so that even at higher currents dissipation will be low. FETs with an \$R_{DS(ON)}\$ of less than 200 mΩ are perfect and well available.

If the relay/solenoid needs 24 V or less the Si2304DS is a possibility: \$R_{DS(ON)}\$ is less than 200 mΩ, so even at 1 A it will dissipate only 200 mW. Can drive more than 1 A at 3 V gate voltage.

stevenvh
  • 145,145
  • 21
  • 455
  • 667