Transistor and solenoid and arduino not acting as expected

Hi all, thanks in advance,
I am not understanding the behavior of the transistor in relation to the solenoid and power source and Arduino.

In the first circuit, I am connecting my power source directly to a solenoid through a transistor, the transistor gets extremely hot, and even when I disconnect the gate voltage the solenoid still remains powered on, I am unsure what is the cause.
I noticed the solenoid resistance seems to be changing and it wants to draw more than 2 A when I use my multi meter it will spike up above two amps. But the power source is only rated for two.

In the second circuit when I have the same power source split in powering the Arduino and solenoid. There is a weird behavior where the Arduino and solenoid keep flickering on and off when I send a signal to the gate.
I suspect the solenoid is trying to draw more than 2 A and the current keeps fluctuating so it’s creating an inconsistent current within the Arduino, which is inconsistently sending a signal to the gate of the transistor.
However, this is speculation I do not know how these things work.

Can anybody please enlighten me if I’m messing anything up here?
Please note I do have a fly back diode on the solenoid.

  • What is the resistance of your solenoid ?

  • You must use a logic level MOSFET if the Arduino is used to control a circuit like this.

  • Your IRFZ44N is not going to work with an Arduino.

I dont know.

Its this device from amazon.

Beduan Brass Electric Solenoid Valve, 1/2" 12V Air Valve Normally Colsed for Water Air Gas Fuel Oil https://a.co/d/76OT1Kx

One datasheet seems to say 12v and 20watt.

Use your DMM to measure the solenoid’s resistance.

The FET needs a resistor to ground to discharge the gate parasitic capacitor. Without the resistor the FET will stay on as you have observed.

The multi meter says the resistance is 4.1 ohms.

However, the datasheet had said 20 W so I assumed it would be 7.2 ohms from calculations.

Also, I noticed that the solenoid can run on lower than two amp power supply that I have.

12V / 4 Ω = 3A


  • You must use a logic level MOSFET if the Arduino is used to control a circuit like this.

  • Your IRFZ44N is not going to work with an Arduino.

You need a driver circuit to get the IRFZ44N fully into conducting mode. Otherwise it will get very hot.

Try something like this:

This inverts the logic, turn on the solenoid with LOW, turn off with HIGH.

And yes, with your flyback diode in place.

Sorry, but I don’t understand.
Is this a generic example or what I should build for my example?
Will this work with an Arduino?

I did notice that when I direct connected the power source through the MOSFET it got really hot really quickly. I was surprised does that mean something is not working properly?

I don’t get how changing the circuit would reduce the amount of heat generated in the MOSFET from the current flowing through.

Thank you so much I’m going to buy a
IRLZ44N

Thank you so much. I will try it now.

Hi, @rickarduinotinker
You also need a back EMF diode across the solenoid to protect your controller and MOSFET.

PLEASE read this link before going any further.

It uses a 5V solenoid circuit, but the basics still apply.

In post #1, in your circuit diagram you did not show if your Arduino had a gnd connection.
It is very important to make sure you show these things.

Tom.. :grinning: :+1: :coffee: :australia:

Sorry, I see the mistake about the arduino not connected to ground, it is connected to ground.
Yes, I will add a fly back diode as well. Thank you.

Now I’m trying to find out why my transistor is getting so hot, and what is the best economical logic level transistor to purchase?

When your project is running, measure the DC volts between Drain and Source and measure the voltage across the solenoid, when activated.

Can you please post your code?

Thanks.. Tom.. :grinning: :+1: :coffee: :australia:

When conducting, your FET behaves as a resistor with a resistance value RGS that depends on the Gate-to-Source voltage (VGS) applied. If RGS is high and the current through the FET is also high, the power (watts) dissipated at the transistor will be high. I will get hot.

If you look at the IRFZ44N spec sheet you'll find that when a nice 10V is applied to its Gate, RGS is only 0.028Ω, and if you apply this voltage the power dissipated by the transistor will be very low. Low heat.

But, the voltage applied by an Arduino pin is much lower than 10V. If VGS is lower, RGS will be higher and so does the dissipated power and the FET will get hot. And the FET may not even let the required current pass through it and create intermittence. A total waste.

Your solution is to use a driver circuit, or a logic level FET, such as RFP30N06LE. They are inexpensive, and the hassle of adding a driver circuit may not be so attractive.

Just so you know, I did build the circuit I posted before, and it works like a charm. I used 12V, not 7, and 1 1KΩ resistor, not a motor. The voltage at the Source drops to 0.001V when the PNP transistor is activated.

When the NPN is 'activated'

Sorry..
When the base of the NPN goes to gnd, NPN ceases to conduct.
The voltage at the NPN collector and MOSFET gate rises to 12V.
The MOSFET conducts and current flows though the solenoid.

Tom... :grinning: :+1: :coffee: :australia:

Hey Tom, I will do the measuring as you suggest.
Perhaps as another posted, there may not be enough gate voltage and the resistance has shot up tremendously in the MOSFET.
I will do the test you suggest, I see it is an ingenious one.

Also, I’m wondering if the fact that my power supply is only rated for 2 A and it is powering both my Arduino and the solenoid, which is demanding 3 A, but can run closer to 1.7 A. I am wondering if this is creating a flickering power source and causing the arduino The switch on and off.

What would the expected behavior be if a two amp power source was used in such a situation?

Hi, @rickarduinotinker

That would depend on the power supply.
Some will shut down, others will current limit and lower their voltage.

Measuring the 12V supply while operating should tell you if the supply cannot hold up.

Tom.. :grinning: :+1: :coffee: :australia:

So when I don’t use my micro controller, and just use the power source in the gate of the MOSFET. The voltage dropped is .07, which seems to indicate a .02 ohm resistance, which is what is being shown in the spec sheet. It is not getting hot now.

It is the test when I hook it up to the microcontroller it gets really hot, I’m guessing not enough voltage is getting through when I use PWM, from Arduino, Uno, and as you guys are teaching me, the resistance of the MOSFET will jump up.

I want to do the test again with the microcontroller, but I’m scared it’s gonna burn the MOSFET.