I'm trying to drive a solenoid with a GPIO on a Raspberry Pi. Here's the schematic:

enter image description here

The current through the solenoid and MOSFET should be:

enter image description here

So the voltage drop across the MOSFET should be:

enter image description here

leaving us with 13.8V across the solenoid, which should be enough to actuate the 12V solenoid.

Naturally I've tried actuating it directly:

enter image description here

This works just fine.

Suspecting that maybe the MOSFET wasn't fully switched on, I took the Raspi out of the mix and tried applying 4V directly to the gate:

enter image description here

but it doesn't actuate...

I've also tried replacing the solenoid/diode with a simple LED/resistor combo and it lights up as expected in both the Raspi/non-Raspi configurations, so the MOSFET appears to be switching as expected...

What am I missing here?? Why won't the solenoid actuate when I have the MOSFET in the mix?



As pointed out by Respawned Fluff and The Photon, I was fundamentally confused about some of the parameters of my MOSFET. Specifically, \$V_{gs(threshold)}\$ is not the point at which \$R_{ds}\$ becomes \$R_{ds(on)}\$. \$V_{gs(threshold)}\$ on this MOSFET is 2-4V, so I thought I could switch it on with 3.3V. However, the value I needed to switch this guy on is actually 10V (read from the \$R_{ds(on)}\$ row on the datasheet).

Per Respawned Fluff's suggestion, I added a MOSFET driver between my logic output and the MOSFET and, sure enough, things started working perfectly. I probably also could have swapped out my MOSFET for a logic-level one. Here's the final working circuit:

enter image description here

The MOSFET driver is MIC4452YN.

  • 1
    \$\begingroup\$ You should apply higher voltages to your Vgs. In a thumb-rule you have to apply 0.5 VCC for better action in saturation regime. \$\endgroup\$
    – HOPE
    Commented Oct 25, 2015 at 10:13

2 Answers 2


Well, the datasheet of your MOSFET does try to spoonfeed you how to use it properly (as a switch):

enter image description here

You need 10V Vgs to get that Rds(on). You're giving it 4V Vgs and expecting the same Rds(on)? Alas it doesn't work that way. It seems to me you've used the Vgs(th) value in your design, but that only guarantees you 250uA on the drain:

enter image description here

That actually translates (in the datasheet test conditions with Vds=Vgs) to 4V/250uA=16Kohm Rdson at threshold. So most of the voltage drop would be on the MOSFET and almost nothing on the solenoid's coil if that's the Rdson you're actually getting. (Put your solenoid in series with a 10K or 15K resistor, straight to the source sans MOSFET and see if it still turns on. I bet it won't.) Of course this Rdson a worst case scenario since that Vgsth is the max [=worst case] value. More on how to navigate a MOSFET datasheet is found in my previous answer to a very similar question. Expecting awesome Rds(on) at Vgs(th) is a perennial newbie gotcha, it seems.

Your Amazon solenoid doesn't have anything resembling a datasheet, but you can measure the voltage drop across the solenoid's coil and/or the current through it to see exactly what's going on.

A respectable solenoid datasheet has data that lets you know exactly how much voltage you need to turn it on (and how much current it draws at that point). For example, this series:

enter image description here

If were using their "12V" (nominal) solenoid, at least 9.6V are needed to turn it on and it will pull at least 1.52mA at this point. (It also gives you the turn-off voltage.) Since you don't have such data available for your solenoid, you'll have to determine it experimentally (e.g. using it directly with a variable voltage source) and then decide what you need to switch it on.

  • \$\begingroup\$ Dang I had read \$V_{gs(th)}\$ MAX=4v as "don't put more than 4v here or you'll fry your chip". I confirmed that applying 15v at the gate does cause the solenoid to actuate, so now I just need to figure out how to switch that from my pi. I've tried some things with a BJT I had sitting around but to no avail. Apparently I need to review my microelectronics notes from school, too much time in software it seems... :) Thanks for the detailed answer and I'll definitely be giving your other answer a read. \$\endgroup\$
    – mgalgs
    Commented Oct 25, 2015 at 15:40
  • \$\begingroup\$ Actually probably smarter for me to find a different MOSFET that fits my operating parameters better, rather than trying to shoehorn the RadioShack into my application. This FQP30N06L from SparkFun seems to fit the bill (somewhere north of 10A through \$I_d\$ when \$V_{gs} = 3.3V\$ and \$V_{ds} > 11V\$ ) \$\endgroup\$
    – mgalgs
    Commented Oct 25, 2015 at 16:15
  • \$\begingroup\$ @mgalgs: That FQP30N06L is also a standard 10V MOSFET so won't make a difference. IF you want to change the MOSFET, you'll want a 2.5V mosfet for RPi to drive comfortably, e.g. FDN335N. You could also buy a MOSFET driver IC. The are a lot of them on the market. A driver like that allows you translate low-level logic voltages into the higher voltage needed for a standard (=10V Vgs) MOSFET. An example that would work here is MCP1402 \$\endgroup\$ Commented Oct 25, 2015 at 16:23
  • \$\begingroup\$ Actually FD335N can't handle the max current that your solenoid needs (2.15A) because it tops at 1.7A itself. Something like FDMA430NZ would be fine, but will very difficult to solder correctly by hand (has power pad). Alas it's rather difficult to find high-current and low-voltage MOSFETs that don't come in tricky packages like that. A MOSFET driver is less difficult to work with in that respect. \$\endgroup\$ Commented Oct 25, 2015 at 16:32
  • \$\begingroup\$ @mgalgs: Unfortunately I can't paste here a parametric search URL for digikey because it's too long for this box, but you can get it from pastebin.com/1cwrkjD1. The first hit there is a ZXMN2F34FHTA which would work and is not the craziest thing to solder. (SOT-23) \$\endgroup\$ Commented Oct 25, 2015 at 16:49

Note Figure 1 of the datasheet of your MOSFET:

enter image description here

The Rds(on) value applies to the left part of the curves, low values of \$V_{DS}\$ where \$I_D\$ depends strongly on \$V_{DS}\$. For higher values of \$V_{DS}\$, you enter the saturation regime and the current now depends mainly on \$V_{GS}\$ rather than \$V_{DS}\$.

For your device, in order to get to the point where it can deliver 2 A, you need to apply around 5.5 V to the gate. For a robust design you probably should apply 1 V or so above this to ensure you are operating in the linear regime rather than saturation at your operating point.

  • \$\begingroup\$ I think your last sentence is incorrect. I think you want to state that he should be operating in the saturation regime. \$\endgroup\$ Commented Oct 25, 2015 at 6:09
  • 3
    \$\begingroup\$ @MichaelKaras When they handed out terminology MOSFETs were away partying. "Saturation region" in a MOSFET is not "turned on hard" but ~~ linearish controlled region. ie NOT the same as bipolar term saturation. Highly illogical (I think) but we seem top be stuck with it. \$\endgroup\$
    – Russell McMahon
    Commented Oct 25, 2015 at 10:59
  • \$\begingroup\$ Man my eyes usually glaze over when I see these graphs in the datasheet. And therein lies my problem :). Applying a higher voltage to the gate works, as you (and the datasheet) predicted. Thanks! \$\endgroup\$
    – mgalgs
    Commented Oct 25, 2015 at 15:43
  • \$\begingroup\$ @MichaelKaras, see this diagram on Wikipedia for the names of the operating regions in MOSFETs. \$\endgroup\$
    – The Photon
    Commented Oct 25, 2015 at 16:04
  • \$\begingroup\$ @ThePhoton - I am familiar with the terms and regions. I was just blanking out and thinking in terms of a current mode BJT when I read your sentence as pointed out by Russell McMahon. \$\endgroup\$ Commented Oct 25, 2015 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.