Switching on a solenoid

I need to use a TIP41 to turn on a solenoid (approx 22R coil resistance)

I reckon I need close to 500mA so I determined a base current ot 10mA assuming hFE of 50 (TIP41 is 30-75 from what I’ve read. )

So, with all of that theory, I find that the 2N2222 gradually overheats. The collector is at +12v (supply) and the emitter is at 6.6v.

The 4013 Q (pin 1) is 0v.

This schematic clearly needs checking!

3 Likes

@Robert93820 this one is a little beyond me but seems like something inside of your area of expertise.

Any thoughts?

1 Like

If Bob can’t sort it, it can’t be sorted! :grin:

4 Likes

Hi Gerard
Firstly what voltage are you powering the 4013 with.
If the 2222A is getting hot it would indicate that ir is not switching fully on. You have it configured as common collector or emitter follower where the base must be always about 0.6V above the emitter. You measure 6.6V at the emitter which means you are dropping 5.4V across the transistor so @ 55mA that equates to about 300mW dissipated by the 2222A.

First things first though, what is the voltage applied to the 4013 and the Q voltage when switched.

Is all this been driven by something like Arduino or RPi. If not why not just use an on/off switch for the solenoid.
Cheers Bob

3 Likes

Hi Bob,

The 4013 is off +5v although I think that family of CMOS will happily run from +12.

I can’t check right now but I’ll do some detailed checking in the morning and advise.

Gerard

1 Like

I haven’t built this iteration of the PCB yet so I’m not wedded to even using the 2N2222/TIP41 combination. A FET would probably be a better option, to be honest.

For interest sake, this is the PCB design…

…it works really well except for ‘you know what’!!!

Edit: Note the analog sensors. Your design…thanks.

2 Likes

Hi Gerard

Yes it will.

The 4013 has a pretty limited current capability of only a few mA what you need to do is convert this into the 500mA or so for the solenoid.

You could try rearranging the 2 transistors into a darlington type by doing the following
Remove R5
Connect the emitter of Q1 to the base of Q2
Connect R6 from Q2 base to Q2 emitter
Connect the collector of Q1 to the collector of Q2.
Leave the 4013 at 5V for the moment and R4 at 1k and see how it goes. If you have to raise the 4013 to 12V you might have to increase the value of R4.
The voltage at the base of Q1 should be about 1.2V (2 base emitter junctions in series).

You could also replace the whole lot with a darlington transistor such as BD649, BD681, TIP122, all available from Jaycar. leave R4 in circuit to prevent damage to the 4013 but you might have to juggle the value depending on which transistor you use but 1k would be a pretty good starting point.

I have not tried this circuit at all but should work. The advantages of the darlington arrangement is a very high hfe. You are multiplying the hfe of both transistors and you can get quite large currents with a very small input current.
You don’t have much available from the 4013. At 5V VDD the sink current is min 1.3mA to typ 2.6mA and source min 1.6mA and typ 3.2mA. NOT the 5mA you indicated. You have to have VDD at 15V to get anywhere near that. Could be part of the problem, not switching the 2222A fully on properly.

Give it a try and keep us posted.
Cheers Bob

4 Likes

Hi Gerard
Add on
Just saw this, slipped up a bit

If 4013 pin 1 (Q) is 0V then the emitter of the 2222 should be at 0V, off. you could have one or both transistors faulty.

Yes probably but you still have to charge the FET input capacitor and I don’t think the 4013 is up to that. Not enough current.

What are you using the 4013 for. I assume it is being used as a latch. Not sure if it latches with that circuit as I have not played around with that IC for some years now. Probably does though.
Cheers Bob

1 Like

What I’m proposing based on a TIP122…

The 4013 is there because I didn’t want to have the ESP32 microcontroller directly connected to the transistor base.

1 Like

Hi Gerard
That should basically work.
However looking at the data sheet for the 122 I note the following.


Now I am unsure if that base voltage of 5V is the maximum you can apply or if it is the voltage with 120mA of base current or is the base emitter drop irrespective of current.

With regard to blowing up the 4013 I would try
Remove the 4013
Connect the base of 122 to 12V via the 1k resistor.
Measure:- Voltage at 122 collector. This will allow current calc knowing solenoid resistance.
Voltage at 122 base to calculate base current.
A problem is the limited current the 4013 is able to provide. The above experiment will give an idea as to what the value of R4 has to be to stay within that limit. I don’t have a TIP122 here and the nearest Jaycar is 35km away or I could do this myself.
Cheers Bob

1 Like

OK, what I found.

Hooked the base resistor, R4 (1k0) to +12v and I put the real solenoid in circuit. The readings are as per the pic.

After that, I realised that +12V is actually a bit less due to the fact that I have a series diode on the power supply I’m using (reverse polarity protection) so I tweaked my bench power supply up so get +12v into the circuit.

What changed (and is accurate) is the base current is now 10mA and Vbe is 1.4V. The current through the collector>emitter is 380mA.

I doubt the 4013 is up to the task.

1 Like

Hi Gerard
A couple of quickies
How did you measure 380mA
What is the emitter-collector voltage on the TIP122.
The 1.4V sounds right. If you look at a darlington arrangement this voltage is what would appear across the 2 base emitter junctions of the transistors in series. 0.7V each which is about right.

I think this is about right. The 4013 is meant to drive into a very high impedance load. A few microamps usually.

Even if you used a Mosfet with it’s high impedance input you still have to charge the gate capacitor which will look like a short circuit to source at switch on.

Just answer those couple of questions for me and will have a think about the easiest way to do this.

This is off topic but a series diode connected to your power supply I assume more or less permanently is not going to prevent you accidentally connecting a device under test with reverse voltage. Think about it. Reverse volts protection has to be built into the DUT. If you want connect a diode in series temporarily to the DUT so you connect power to this diode. More or less make the diode a temporary part of the DUT and not a semi permanent part of the power supply.
Cheers Bob

1 Like

OK, Vce on the TIP122 is 750mV which, I think, is correct.

The 380mA is what the bench power supply is reporting.

When I connect the solenoid directly to the power supply, it draws 440-450mA. I think the difference (380 vs 440) can be attributed to the myriad small wires hooking the whole mess together.

If that’s the case, then the TIP122 must be fully conducting under these test conditions.

Hi Gerard
That all looks OK. The curves in the data sheet all appear to be much higher currents but at that current 750mV looks good.

Most likely correct. But I think that can be ignored at the moment. With a rats nest of small wires you can get little voltage drops all over the place adding up.

That solenoid current when directly connected @ about 450mA looks like a solenoid .resistance of about 27Ω, all good.

Looking at the curves this TIP122 should give pretty similar results at a base current of about 2mA.
Can you replace R4 with about 5k and repeat those measurements please. Base current of 10mA and collector current of about 400mA is only a hfe of 40. I think it should do better than that. If it still gives similar results at about 2mA base current that would indicate a hfe of about 200 which would be a bit more like it.

One more thing. When you require the solenoid to be activated is the MCU signal ON or HIGH all the time or do you just pulse it and latch with the 4013. I don’t know if it latches or not with that circuit. If the signal is ON all the time there is probably a much easier way to do this without the problem of 4013 current limitations.
Cheers Bob

OK, I’ll give that a go.

I suspect I need to improve the way I’m hooking up the test circuit to make it more “real world”.

With the MCU, you’ll be on my software writer’s side here. He hated the latch idea.

I designed the hardware to use a latch. Pulse to turn on, pulse to turn off. But a single HIGH from an MCU pin to turn on the solenoid and then it goes LOW to turn off the solenoid will work equally as well. But I hate to admit defeat!!!

I’ll see how I go with the 5k R and report the findings.

Hi Gerard

Yeah, know the feeling well.

I think you know by now I like the simple things. Adding complexity just because you can is in my experience fraught with danger and is usually just something else to go wrong.

Anyway we will sort this one way or the other.
Cheers Bob

Hi Gerard
I have been doing a bit of research with not good results. I think you are going to have to forget that 4013. Here is a copy of part of the data sheet


Note the required voltage.
Now I am assuming this ESP32 has a logic level output of the dreaded 3.3V. If you note even at an operating VCC of 5V the 4013 would be pretty marginal if it worked at all. I think the 4013 was invented when 12V was the norm.

Now to do anything in this day and age where everyone wants to have a warm feeling (there is an old saying about wetting your pants) by saving power and thus the planet by going to 3.3V and less it is a bit difficult to do anything useful with it. For instance you want to switch enough voltage and current to operate your solenoid. You need enough current to drive a Transistor or Mosfet. You would be lucky to get it with a 4013 unless you use 12V, then you can’t drive it with the 3.3V from the ESP32. So I think you can forget the 4013.
I don’t know the current capability of the ESP32. About all I can find out is what a great little invention it is. Nothing important although I haven’t bothered to look very hard. 3.3V would be enough to drive a transistor if it can provide the base current required. It probably would drive your darlington transistor directly if this worked at a low enough current to suit.

That might be your better option. The base voltage of the TIP122 should be 1.4V. Subtract this from 3.3V = 1.9V. This is what a resistor would have to drop @ say 5mA. This equates to 380Ω.

This would be a worthwhile experiment . Leave the solenoid and TI122 connected to 12V. Switch the TIP122 with 3.3V connected to base via a 390Ω resistor then repeat the previous voltage measurements. This means a direct connection to your ESP32 but I think you have to discard the 4013.

There are another couple of High side switch alternatives. By High Side I mean you switch 12V to the solenoid. Your circuit is LOW side switching where you switch to ground.

Firstly the Gravity high side switch SKU DFR0457. This is an opto coupled device which should be OK direct from your ESP32. The down side is the Gravity connector but if your soldering skills are up to it you could connect directly to the connector pads.

Secondly is a POLOLU switch SKU Pololu2810. This drives into a transistor base but should be OK directly from ESP32 I/O. There is a mechanical ON/OFF switch but just leave it OFF and ignore. Apply signal (3.3V) to the ON connection.

Have a look anyway, this might be your easiest solution (1 of 3) but I think latching with a 4013 is out.
Cheers Bob

Thanks for that investigating.

I may have a ‘get out of gaol’ card though. In my design, I am using a 3v3<->5v level shifter TXS0108EPWR and I have one spare element so 5v is still available.

Datasheet… TXS0108E 8-Bit Bi-Directional, Level-Shifting, Voltage Translator for Open-Drain and Push-Pull Applications datasheet (Rev. L)

Results from varying the 1K…
Value…Base I…Solenoid I
5k0…1.7mA …340mA
3k9…2.03…350
3k0…2.84…350
2k0…4.37…360
1k0…8.43…360

Gerard

This is not exactly what I asked for
Does the base voltage remain at 1.4V. It should be close.
Are you supplying the base at 12V or 5V. If the base voltage is about 1.4 by my reckoning the applied voltage would be about 10V. A few voltages would tell a bit more of the story.

Looks like a good unit but restricted in output voltage to a recommended 5.5V but if you are using 5V not important.
I am assuming this will be inserted between the 4013 and TIP122 base. That would enable the 4013 to be powered from 3.3V and operate properly with a 3.3V signal from the MCU.

The data sheet is a bit confusing though. One bit says the Max output current can be 50mA continuous. The other bir says that the output pull up resistor is 4kΩ which would be a short circuit current of 1.3mA. Got me a bit confused but if the option is available try it .

Theoretically then with a 5V supply for 10mA base current you would need 360Ω series resistor.
5(V) - 1.4(V) = 3.6(V) /.01(A) = 360(Ω)
5mA - 720Ω
and so on.
Cheers Bob

Sorry, I can check again.

The base is derived from +12v but I can also do +5v

I’m waving the white flag on the 4013! It serves no purpose now.

The TXS0108 would be inserted between the ESP32 GPIO pin X and the TIP122.