Turn 12v Solenoid on through GPIO using Transistors


I’m not experienced in Electronics and i’m suffering to turn a 12v and 600mA solenoid on.

I have an external 12v power supply that will be used to turn it on, initially I used some relay boards to turn the things on, but the answer time wasn’t as fast as I needed, so I decided to use transistors as switch.

I used a BD135 NPN transistor which has a beta of 150, later I saw that this beta was not enough to turn my solenoid on, because the max current that the GPIO provides is 1/2 mA and I needed something around 4mA.

After that, I decided to buy a logic N-Channel MOSFET (P33N10) as it would start working from 2V, the logic level of the Jetson Nano is supposed to be 3.3v, but when I tried it nothing happened.

Am I missing some technical detail? is there another way to make it work?

You can refer to some MOSFET (like Q48 etc.) design in nano carrier board schematic: https://developer.nvidia.com/jetson-nano-carrier-board-design-files

One option is to use ULN2003. Since your solenoid takes 600 mA you can connect two channels in parallel. Each channel handles 500 mA.


If you want to use discrete components you can build a Darlington transistor with high beta.


Please note a diode in parallel to your inductive load. It is important to clamp voltage spikes when you power off your solenoid. ULN2003 has these diodes built-in.

@GrayDaemon I was thinking about using TIP120, is there any detail that may not work with this transistor in my Solenoid?

Thanks @Trumany ! but i’m not in this level yet! :)

I’d prefer something smaller than TIP120, there is a chance it will be half open when driving only 3V 1 mA from Jetson. The datasheet says it needs 2.5V to open but you have resistor divider (R2 plus internal 8,12 kOhm) that will drop the voltage on base. If you have this transistor you can try (using 2nd circuit above) , the chance that it will work is about 70% (but it can behave unstable depending on ambient temperature)

Hi @GrayDaemon I found out what happened, I originally bought a FQP33N10L mosfet that has 1-2v Vgs, the store sent me a FQP33N10 that has a Vgs 2-4, as my output voltage is supposed to be 3.3v the mosfet would never work, I requested new ones and if I have problems I’ll tell you. Thanks for your attention.

Hi @leandrovrabelo,

(mostly for others reading this thread)

to prevent all possible problems reliably and one-shot I suggest the following schematic with a cheap 7414 TTL Schmitt trigger:


Yes, it is a bit excessive, but allows wide range of FETs and bipolars to be used without looking into datasheets or doing extra calculations.

For even better FET operation you can add 1 kOhm resistor between pins 14 and 12.

Great ideia, how this is an inverting logic gate, may I connect the output of one logic gate to the other input? So my code wouldn’t need to be changed. I will turn on 12 solenoids according to its own parameters.

Yes definitely. Please be aware that in this case outputs can be floating i.e. “1” during Jetson power-up so all your solenoids will energize until Jetson is initialized. You need to tie Jetson outputs to 0 or +3.3V with 5.1-10k resistors to define power-up condition.

1 Like

Thanks! That’s a good tip.