# Why is my transistor allowing a voltage to pass before being actuated?

I want to use a transistor as a switch, allowing 12V to pass through and actuate a solenoid. The solenoid is 12V and draws about 500mA from my variable power supply.

Using some instructions I found, I came to using a 10 ohm resistor in between the 5V source and the transistor. The 24 ohm resisistor is meant to represent the solenoid. The measured voltage in Multisim is very close to what I measure on the actual circuit.

I want to use an Arduino to turn the solenoid on and off at specific intervals. The transistor gets very hot when the solenoid is connected, but does actuate when 5V is connected to the transistor base. Aside from the transistor getting quite hot in this circuit, I think that it should be fine. I found this issue when I had the same circuit, but with a pump instead of a solenoid, which draws around 80mA at 12V, but would run even when the base wasn't connected, though slower due to having less voltage. The resistor at the base of that circuit is a 4.7k ohm.

7.25V measured coming from the "solenoid" without any voltage going into the base. The 10ohms is meant for the resisor between the switch and base

I understand the importance of using a diode to reduce the chance of breaking the circuit, but I don't currently have any. If I were to get some, what type would I use for this circuit?

• 10 Ohm is excessively low and is what is causing heating try 1k or even 3k. Running with no base is weird. I think it might be the collector injecting base current causing it to turn on (a non-ideality). Add a 10K pull down resistor to the base to leech that current away so it doesn't flow through the emitter and turn on. Sep 13, 2021 at 1:27
• Do you just have one 2N2222 transistor that you're using in a variety of places, or when you say "the" transistor do you mean "yet another one from my bag of transistors"? While it's generally good practice to have a resistor to hold the base low, I would expect less than 10 microamps to flow. If it's just the one -- it's bad. Sep 13, 2021 at 2:04
• @TimWescott yea its multiple 2n2222 resistors, and they all act the same way. Ill add a pull down and see if it helps Sep 13, 2021 at 2:24
• I added a 100k resistor to ground after the 5v and 10 ohm resistor, and it seems to make no difference. The pump still runs before 5v is applied to the base line. The transistor might get less hot or get hot less fast though Sep 13, 2021 at 2:39

This wikipedia article shows two possible pinouts of the transistor package, which have collector and emitter swapped. Be very careful that you have correctly identified which variant you have. The base-emitter junction is a zener diode, so if you do swap collector and emitter, that could also result in 8V appearing at "what-you-think-is" the collector. This will turn your pump regardless of the voltage you apply at the input.

10Ω at the base is too small, for two reasons. That's a huge load on your ardiuno's output, which won't be able to provide enough current. Secondly, you don't need that much base curent to get 500mA into the collector.

To get the collector-emitter voltage as low as possible when the transistor is switched on, you need to saturate the transistor, for sure, but not to that extent. Considering the datasheet's most pessimistic gain of 40, you require a base current of at least $$\\frac{500mA}{40} = 12mA\$$. Better we bump that up to 15mA, to ensure saturation, while remaining within the Arduino output's capabilities.

Given that you have 5V at the input, and 0.7V at the base, that's $$\5.0V - 0.7V = 4.3V\$$ across the base resistor, and to achieve 15mA, Ohm's law tells us:

$$R_{1A} = \frac{4.3V}{15mA} = 290\Omega$$

• i also thought that C and E might be swapped. it would also cause more heating because of the lower beta and larger gate current. As a test: If C and E are swapped, then using the circuits as is - and with a much larger base resistor like 1k - will fail to actuate the relay. Sep 13, 2021 at 3:44
• Looking at the pin outs, I think you may be right. That’s what I get for going off memory. I am curious where you found the gain the data sheet, as I went off an assumed 10, got 50mA which leads to needing a 100 ohm resistor, and it seems I may have messed up there as well. Sep 13, 2021 at 11:57
• According to the Wikipedia I most likely have the wrong pin out, but according to the data sheet it’s correct. Looking at the flat side I have the left connected to the solenoid. I’ll try using a 1k resistor when I get home Sep 13, 2021 at 12:15
• I don't know why some manufacturers use a different pinout, but that's how it is for this device. The gain is listed as "DC Current Gain" under "ON Characteristics" on page 2 of the datasheet I linked to. Sep 13, 2021 at 12:48
• "I don't know why some manufacturers use a different pinout" -- a really-o truly-o 2N2222 transistor comes in a metal case. If you're using a plastic something-or-other-2222 then all bets are off, and you need to look at the manufacturer's data sheets. Sep 14, 2021 at 2:12

Your transistor will likely get damaged when you turn it off because the inductance of the solenoid will tend to want to force current to flow through the transistor. You need to add a zener diode (>> 12 V) between collector and emitter (or collector and base).

To properly guarantee that the transistor turns on, you need a forced beta of about 10. It is possible that 20-50 would work though. Given a collector current of 500 mA, and a beta of 10, you need 50 mA of base current. An Arduino single output cannot supply that. What is happening in your circuit is that the transistor is only partially turned on (VCE may be quite high), and it is dissipating a lot of power.

Basically, you can't do this with a single transistor. Add another 2N2222: E -> Q1's base via 68 Ω; C -> +5V, and B to the Arduino. This now needs only a few mA of base current and can be supplied directly by the Arduino. The base current for Q1 is now (5 - 0.7 (Q1) - 0.7(Q2))/68 = 53 mA.

You still need a zener from Q1's collector to its base.

In your 80 mA case, you need 8 mA of base current -- and so a (5-0.7)/8m = 560 Ω. Again, this is close to the maximum of an Arduino, but likely it would work.

• Thank you very much for your answer. Good to know about the arduino not being able to supply that much amperage. When using the 5v out pin, and manually connecting the line to the base, it seems to supply enough voltage to open the solenoid. And even without connecting anything to the base, it lets through enough voltage that my pump runs at a slower speed. I'll try to get some zener diodes, as well as regular ones as they seem useful, but tomorrow. Is there any specific one that would work best? I'll also try setting up the double transistor circuit for the solenoids. What's VCE btw? Sep 13, 2021 at 2:49
• Zener diodes coming in tuesday, and I've learned that there are no "regular" diodes. I have a 12v to 5v converter, ill try that with a new transistor to see if the pump will stay off until the transistor gets 5v. Sep 13, 2021 at 2:58
• @Killer2294 VCE is the voltage between the collector and emitter. Sep 13, 2021 at 3:22
1. The 2N2222 transistor is the wrong part for this job. It is a small signal transistor, not a power device, and is not intended for switching your load current. The max current spec is around 500 to 600 mA depending on the manufacturer, so you are pushing its maximum rating. It is getting hot because the package it is in cannot dissipate the 0.84 W of heat in the device. This number is based on worst case saturation voltage and base-emitter junction voltage at 500 mA collector current.

2. The transistor conducts current (!) without a driving signal because your circuit leaves the base floating. Leakage current through the collector-base junction can bias the transistor into a lightly-conducting state. To prevent this, add a resistor from the base to the emitter. 10 K should be small enough to give the leakage current a bypass path, without shunting away too much base current when the drive signal is applied.