I'm a software guy trying to do a small electronics prototype project and need help with selecting a transistor. I know this must sound like a very basic question here, but this looks like a great resource and someone out there ought to find this easy to answer.

I would like to control a solenoid using a microcontroller. The micro output is 3.3 V and can drive a maximum current of 20 mA. The solenoid has two versions: a 12 V and a 24 V one, maximum power 30 W.

I know I need to use a diode across the solenoid to stop back EMF from damaging the transistor, but my main issue is figuring out which transistor to use. The datasheet parameters are a little overwhelming for me.

Here is what I managed to figure out: I understand that to go from 20 mA to 2.5 A (12 V solenoid) I would need a high-gain transistor or a MOSFET. I then realised that with 3.3 V, I probably won't be able to drive the gate of a MOSFET, so I focused on finding a Darlington transistor such as the BD677. But I get lost in ensuring it will actually work: for example, will the micro-controller output be enough to drive the transistor into saturation mode? Any help would be much appreciated.

  • 1
    \$\begingroup\$ Welcome to Electrical Engineering@SE. There are things helping to get useful answers, e.g. tags to get the attention of users interested in the topic. A post is read many times, taking more time overall than writing(& editing) it: Making your post pleasant to read includes spaces before units. Tell exactly what you want and what you used leading to the question you want answered: e.g., add hyperlinks to datasheets where device details are important. \$\endgroup\$
    – greybeard
    Commented Mar 12, 2023 at 6:30
  • \$\begingroup\$ (One "trick" is to find what others have done: "logic level" "solenoid driver".) \$\endgroup\$
    – greybeard
    Commented Mar 12, 2023 at 8:09
  • 1
    \$\begingroup\$ Coconha - Hi, You wrote an "answer" but it was replies to other users & it was being flagged as "not an answer", so I have put the relevant part into a comment in (hopefully) the right place. || Since you asked the question, unless you are writing the full & final answer to your own question (i.e. unless you are giving your own new solution, without using another answer & don't need further help) please don't use the box labeled "Your Answer" below. \$\endgroup\$
    – SamGibson
    Commented Mar 12, 2023 at 18:36
  • 1
    \$\begingroup\$ (continued) If you don't need further help then, in order to effectively mark the topic as solved, please consider "áccepting" your choice of the best answer (i.e. click the "tick mark" next to the "best answer", to turn its tick mark green). This shows that you don't need more help and future readers can quickly see there was a confirmed solution. || If you do need further help, you can ask for additional explanation of an answer in a comment below the answer(s) where you need clarification. Thanks. \$\endgroup\$
    – SamGibson
    Commented Mar 12, 2023 at 18:42
  • \$\begingroup\$ What's the motion of the solenoid? If you need to pull it in and hold it then you can reduce the current after it's finished moving. \$\endgroup\$
    – D Duck
    Commented Mar 12, 2023 at 22:30

3 Answers 3


A darlington transistor, like a TIP120 would definitely work, but darlington pairs have a nasty problem; when on, they still have 0.7V (more like 1V, at currents of 2A or so; edit, user greybeard corrected me: likely to be well over 1V at currents of 2A or more, and the BD677 is even worse in this respect) between collector and emitter. With 2A through it, that transistor will dissipate well over 2W of power, requiring heat-sinking.

It might be hard to find a single BJT that can handle 2.5A and have enough current gain \$\beta > \frac{2.5}{0.02}\$. Also, even though your IO is able to source 20mA, I would not want to draw that much current unless I absolutely had to.

As user PStechPaul has said, there are MOSFETs that have all the characteristics your require, but may I suggest a two-transistor solution. The goal is to reduce the load on the microcontroller output, and simultaneously produce enough gate-drive voltage to switch any MOSFET, so that component options is broader:


simulate this circuit – Schematic created using CircuitLab

Q1 can pretty much be any signal transistor, the only constraints being \$V_{CE(MAX)} \ge 24V\$, and \$\beta \ge 20\$. \$\beta\$ is sometimes called \$h_{fe}\$.

I use a potential divider formed by R2 and R3 to ensure that M1's gate does not exceed 20V, a common constraint for many MOSFETs. If you operate this circuit from 12V, you do not require R3.

I keep R2 as low as I can, to charge the MOSFET's gate as quicky as possible.

There are a couple of issues with this design. Firstly, Q1 inverts the microcontroller signal. The signal must now be low to enable coil current.

Secondly, at power on it's likely that the microcontroller output is high impedance, which means Q1 will be off, and the default state will be with the coil energised.

One way to solve this last issue, would be to pull Q1's base high, switching it on, while the microcontroller is not yet initialised, but that's an added complication I won't talk about here.

Another solution to both issues, is to replace the low-side MOSFET switch with a high-side version:


simulate this circuit

Now you have Q1 off at power on, and M1's gate is high, so it's also off.

There's no longer any need for R4, since gate discharge current via Q1 is now throttled by R3.

In both cases, gate drive voltage is not a problem, so you don't need to worry about finding a device with low \$V_{GS(TH)}\$.

You should aim to dissipate less than 0.5W of power in the MOSFET, to avoid the need for a heat-sink. That power will be \$P=I^2 \times R_{DS(ON)}\$:

$$ \begin{aligned} R_{DS(ON)} &< \frac{0.5}{2.5^2} \\ \\ &< 80m\Omega \\ \\ \end{aligned} $$

  • 1
    \$\begingroup\$ TIP120 [about] 1 V @ 2 A Judging from the ST datasheets, this is typical, and close to ST's BD677. Specified max is 2 V@3 A/12 mA for the TIP120, but 2.8 V@2 A/ 40 mA for the BD677. Specmanship. \$\endgroup\$
    – greybeard
    Commented Mar 12, 2023 at 7:40
  • \$\begingroup\$ @greybeard You are the better specman! I didn't look at the datasheet, I admit I guessed! \$\endgroup\$ Commented Mar 12, 2023 at 8:05

The BD677 will work, but it has about 2.5V Collector-Emitter saturation voltage, and at 2.5A, that will be almost 7 watts, and there will be only 9.5V for the solenoid with a 12V supply. If you can use a 24V power supply, the power dissipation will be only about 3W. In either case, an adequate heat sink will be required.

There are many NMOS devices that will work at 3.3V logic level. The BUK9880-55A has about 80 milliohms ON resistance at 3V, which will dissipate about 1/2 watt at 2.5A. It's a surface mount device, but easily enough soldered to a perfboard. You can drive the gate directly from the microcontroller, but add something like a 10k resistor from gate to source to make sure it's off if the input is floating.

  • \$\begingroup\$ Thanks PSTechPaul I realised I did not even know that "logic level MOSFET" was a thing. I did some more searching about these and learned how to search for Vgs(th) and RdsON. I found this mosfet that seems to have a very low RdsON for 3.3 VGS: PMV20XNER \$\endgroup\$
    – Coconha
    Commented Mar 12, 2023 at 9:39

PStechPaul stated one main point early on: a BD677 should work here.

Let me try to go through relevant points in the ST BD677 datasheet top to bottom:

  • package: leaded, supports screw mount, especially to a heat sink
  • \$T_J\$ max: one factor in needs a heat sink
    With max. 7.7 W to dissipate, how hot will the junction get at 70°C ("industrial") ambient?
    With \$R_{_{th}JC}\$ not stated explicitly, compute it from \$R_{_{th}JC} = \frac{T_J - 25°}{P_{\small TOT}}\$: 3.125°/W
    Allowable \$R_{_{th}JA}\$ (ambient) is (125-70)°/7.7 W = 7.14°/W, leaving 4°/W for mounting(!) and heat sink - if you are comfortable with a case temperature of 100°C. (While the device doesn't take short-term damage at 150°C, there usually is a reliability derating at more than 125°.)
    (Heat sink data(datasheets) - a topic in itself. Preventive maintenance, anyone?)
    This takes considerable space, especially without forced air flow.
  • \$V_{CE(sat)}\$: manufacturer's guaranteed maximum.
    If the solenoid needs 10 V minimum for actuation and supply voltage is 12 V, 3 V doesn't mean it isn't going to work - just that the combined solenoid & transistor guaranties leave you to your own devices.
    This is the one point where BD677 and BD677A differ:
    While neither is "fully specified" up to 2.5 A, the latter is up to 2 A.
  • \$h_{FE}\$: 750@3 V where \$V_{CE(sat)}\$ was specified at \$I_B = I_C\$ / 50
  • Figure 2: Typically, diagrams show typical performance.
    DC current gain is high at 1 A to 2.5 A, even at -40°C - nice to know
  • Figure 6: typical saturation voltage at \$I_C\$ = 2.5 A is about 1.1 V over the whole temperature range even at \$I_B\$ just 10 mA -
    much lower than the "extrapolated guarantee" of not much higher than 3 V
    doesn't get much lower for lower currents
  • Figure 8: \$V_{CE(sat)}\$ is higher at lower temperatures -
    say, 0.1 V at freezing point
  • Table 4, Revision history (you didn't expect this?)
    there has been a "Technology change" somewhere about Jan 2008:
    the only devices the data sheet applies to strictly are newer ST BD677.
  • \$\begingroup\$ Didn't mention \$V_{CE}max\$ and \$I_C max\$ because that is how datasheet to be scrutinised get selected in the first place. \$\endgroup\$
    – greybeard
    Commented Mar 12, 2023 at 11:11
  • \$\begingroup\$ It's good that you found a much more complete datasheet than I posted. \$\endgroup\$
    – PStechPaul
    Commented Mar 12, 2023 at 20:45

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.