Use a 2N 3904 Transistor to switch 12v with MCU?

MisterBill2

Joined Jan 23, 2018
18,167
OK, I followed that link to the amazon page and now I see the device. And I see that the draw at 9 volts is indeed 2.5 amps. Now given that most of that load is from the thermo-electric cooler, that should certainly be very tolerant of noise and ripple on the power source. Do you have that device and it's power supply already? If so, check the specifications of the power supply, you may be able to run the fans from that.
 

ElectricSpidey

Joined Dec 2, 2017
2,757
Thank you @ElectricSpidey - super helpful response. Will investigate that path. Are you opposed to the Buck for the de-humidifier?
No. the de-humidifier should be fine on the buck.

I also read your comment on the relays, so I can only assume that the "modules" accept a lower voltage on their inputs than 5 volts, in that case they should work fine, but if they draw much current...you are getting real close to that 3 amp limit.
 

BobaMosfet

Joined Jul 1, 2009
2,110
No. the de-humidifier should be fine on the buck.

I also read your comment on the relays, so I can only assume that the "modules" accept a lower voltage on their inputs than 5 volts, in that case they should work fine, but if they draw much current...you are getting real close to that 3 amp limit.
Thoughts- noise is a voltage phenomenon. Figure out what you can live with, this isn't a medical device. Use caps, ferrite beads and cores to control it. You can't eliminate it entirely, and you can't not accept it (per FCC).

Don't use relays. Relays are an inductive nuisance. You have to charge a coil, and discharge it. That takes time, and creates current spikes. Even with snubbers you'll get noise.

200mA isn't much. Use a 2N2222 BJT- they work GREAT for switching fans and motors up to 800mA from GPIO logic levels.

As for the LM7805- how much current it can output is a matter of Thermal junction temperature. Dissipation of what it doesn't regulate should be mitigated. LM7805 requires about 2V above what it regulates. As such, you lower your 12V to 7V using a zener and a BJT. The leaves only 2V for the LM7805 to dissipate, allowing it to deliver a higher current.

Even so you need to calculate your thermal and your dissipation for your LM7805 so that you know how much current you can get out of it, when running it at a temperature range your happy with (perhaps ambient, perhaps higher), before it will shutdown (thermal overload).

Having said that, let's run the numbers without limiting input voltage to LM7805 to 7VDC:

LM7805 (TO220)
12V input
5V output
Desired output current: 200mA
Heatsink? No
Desired Max Temp: 38.8C (it's touchable)

Voltage to Dissipate: 7
Watts to Dissipate: 1.4
Max Allowed Junction Temperature rise: 111.2C/W
Max Allowed Watts to Dissipate: 2.224

Actual Current LM7805 can output within above specs: 0.318A (318mA).

2N2222 Specs:
1582835876107.png

Simply calculate what you need on the base, based on the above information and your need for the motor/fan and voila. Your fan/motor start/stop current will be something close to the stall current (you should know that), and it's running current under average load should be known to know if 200mA will satisfy it. Choose a resistor for the 2N2222 that will give the motor what it needs for start-stop. It will only draw what it needs under load otherwise, which should be less. Remember to put a snubber diode around the fan/motor.
 

Thread Starter

haukeg

Joined Dec 9, 2018
66
OK, I followed that link to the amazon page and now I see the device. And I see that the draw at 9 volts is indeed 2.5 amps. Now given that most of that load is from the thermo-electric cooler, that should certainly be very tolerant of noise and ripple on the power source. Do you have that device and it's power supply already? If so, check the specifications of the power supply, you may be able to run the fans from that.
Yes, I have the power supply - it shows 9.0V / 2.5A. The fans run on 12V for full throttle. Lower voltage lowers throttle. So my aim was to take a larger 12V 3+A power supply and do the stepping down to try and achieve loads for all devices. Thanks.
 

Thread Starter

haukeg

Joined Dec 9, 2018
66
No. the de-humidifier should be fine on the buck.

I also read your comment on the relays, so I can only assume that the "modules" accept a lower voltage on their inputs than 5 volts, in that case they should work fine, but if they draw much current...you are getting real close to that 3 amp limit.
Yeah, the 1 Channel 5V Relay's I have show a spec of: Trigger Voltage -- Low: 0-1.5V ; High:3-5V (can be switched on High or Low with jumper adjustment).
 

Toughtool

Joined Aug 11, 2008
63
VIN: This board can be powered by an external power supply by using this pin. Supply a voltage between 3.3V to 12V to this pin and the linear voltage regulator on the board will power the board.
Actually I think the ESP8266-12E itself is a 3.3 volt device and can not use a power supply greater than the 3.3 volts it is designed to use. The ESP8266-12E NodeMCU is a development board that has an ESP8266-12E mounted on it along with a regulator and a CP2102 serial to USB converter to level shift the serial data stream both ways. . There is also a version with a CH340G serial to USB converter. However, access to the ESP866-12E NodeMCU GPIO data pins must be 3.3 volt logic levels.

Additional note: It is recommended to power the NodeMCU at 5 volts at the Vin pin, not 12 volts. The NodeMCU can get it's power from the USB port connection and I believe this is connected internally to the regulator via the Vin pin. Connecting a computer's USB port while the NodeMCU is powered with 12 volts at the Vin pin could be disastrous.
 
Last edited:

Thread Starter

haukeg

Joined Dec 9, 2018
66
@BobaMosfet . First off...best user name ever!

Figure out what you can live with, this isn't a medical device.
Totally, I really am not hyper concerned about ripple for the MCU, just wanted to be cognizant.

200mA isn't much. Use a 2N2222 BJT- they work GREAT for switching fans and motors up to 800mA from GPIO logic levels.
Swapping the fan relay for the 2N2222 sounds like a great option, thanks. Good to know about the inductance issues...

Your fan/motor start/stop current will be something close to the stall current (you should know that), and it's running current under average load should be known to know if 200mA will satisfy it.
I tested the fans and found ~88mA on free current and about ~120mA on stall current. So with 2 fans I am looking at a spike load of ~240mA to consider in the circuit. So should I assume it's ok that with the 200mA peak base current - the 240mA stall current is not an issue since the free current will be below 200mA?

Even so you need to calculate your thermal and your dissipation for your LM7805 so that you know how much current you can get out of it, when running it at a temperature range your happy with (perhaps ambient, perhaps higher), before it will shutdown (thermal overload).
Yeah, the LM7805 was an early selection but I worried about thermal issues and shut down. The Zener + BJT approach is interesting, could you share a little more on how to configure? But based on your calcs it looks better than I assumed.

Finally, I didn't see any suggestions for powering the 9V 2.5A de-humidifier, if you have any ideas for that let me know please. I would say a LM7809 but they are limited to 1-1.5A I believe. So maybe I stick with the Buck Converter for this purpose (the one I have is rated to 3A)?

So all in all I realize that I should consider somewhere upwards of ~ 2940mA (2.94A) - making my 3A power supply risky (no overhead - as @ElectricSpidey pointed out) and should consider a 5A or so.

Fans: ~240 mA (12v)
De-humidifier: 2.5A (9V)
MCU: ~200mA (5V)
*Have not considered any current draw from the Relay Modules or the Buck Converters.
 
Last edited:

MisterBill2

Joined Jan 23, 2018
18,167
Yes, I have the power supply - it shows 9.0V / 2.5A. The fans run on 12V for full throttle. Lower voltage lowers throttle. So my aim was to take a larger 12V 3+A power supply and do the stepping down to try and achieve loads for all devices. Thanks.
If you can find a 9 or 10 volt supply tou can run both the fans and the dehumidifier without regulators. That will save power and money as well, and make the whole system simpler and more reliable.
 

Thread Starter

haukeg

Joined Dec 9, 2018
66
If you can find a 9 or 10 volt supply tou can run both the fans and the dehumidifier without regulators. That will save power and money as well, and make the whole system simpler and more reliable.
Are you suggesting using a boost converter to get 12V for the Fans or simply running them at 9V (with less airflow)?
 

MisterBill2

Joined Jan 23, 2018
18,167
Are you suggesting using a boost converter to get 12V for the Fans or simply running them at 9V (with less airflow)?
I am indeed suggesting running the fans on a lower voltage and less air flow.
And now here is another thought, which is two power supplies, if you already have them, unless there is some reason for not using two separate supplies that we are not aware of.
 

Thread Starter

haukeg

Joined Dec 9, 2018
66
I am indeed suggesting running the fans on a lower voltage and less air flow.
And now here is another thought, which is two power supplies, if you already have them, unless there is some reason for not using two separate supplies that we are not aware of.
I see, I am wanting as much airflow as I can get from these two fans so that doesn't get me where I need, but thanks for the suggestion. But I hadn't considered a boost on the 9V power supply, that could be worth considering given the 12V amperage is so low?

I am hoping to use a single power supply for all based on the enclosure I am using and just for simplicity - if possible of course, which is why I am asking all these questions :)
 

Toughtool

Joined Aug 11, 2008
63
Here is an Amazon listing for a 5 amp @4/$14.00 DC to DC converter. One should be able to power the 9 volt 2.5 amp dehumidifier from your 12 volt supply. Use a second for the 5 volt for the NodeMCU. You would have two more for two other voltage levels.
Says: "updated from LM2596 and better than it, with reverse voltage protection, over-temperature and short-circuit protection."


[4-Pack] 5A DC-DC Adjustable Buck Converter 4~38v to 1.25-36v Step Down Power Supply High Efficiency Voltage Regulator Module ([4-Pack] 5a Buck)
 
Last edited:

Thread Starter

haukeg

Joined Dec 9, 2018
66
Here is an Amazon listing for a 5 amp @4/$14.00 DC to DC converter. One should be able to power the 9 volt 2.5 amp dehumidifier from your 12 volt supply. Use a second for the 5 volt for the NodeMCU. You would have two more for two other voltage levels.

[4-Pack] 5A DC-DC Adjustable Buck Converter 4~38v to 1.25-36v Step Down Power Supply High Efficiency Voltage Regulator Module ([4-Pack] 5a Buck)
Thanks @Toughtool - I was proposing that in my original circuit diagram in post #33. I have a handful of Buck's, thats not the issue as I know I can power as I posted. Was looking for alternate approaches to simplify. Thanks.
 

Toughtool

Joined Aug 11, 2008
63
So something like this should work. Just put the fans in parallel unless you want to control each separately. The FQP30N06L threshold gate voltage is 1.8 volts. The LEDs let you know the state of the GPIO pin

On edit. You could also use a current limiting resistor in series with the dehumidifier. A 1.2 Ohm @ 10 watts (7.5 actual wattage) but that is a lot of waste and heat not to mention it may cost more than the DC to Dc converter it would replace. Disregard the 120 ma on the fan. My memory isn't what it use to be and I did not look up your specs. The IG MOSFET will handle more than enough current.
 
Last edited:

Thread Starter

haukeg

Joined Dec 9, 2018
66
So something like this should work. Just put the fans in parallel unless you want to control each separately. The FQP30N06L threshold gate voltage is 1.8 volts. The LEDs let you know the state of the GPIO pin

On edit. You could also use a current limiting resistor in series with the dehumidifier. A 1.2 Ohm @ 10 watts (7.5 actual wattage) but that is a lot of waste and heat not to mention it may cost more than the DC to Dc converter it would replace. Disregard the 120 ma on the fan. My memory isn't what it use to be and I did not look up your specs. The IGBT will handle more than enough current.
I do want to control them in parallel, that is how I have them in my schematic (no need for separate control). Thanks for your example schematic! Although, I think I got a little lost on the comments between the FQP30N06L and the IGBT as options, I am not sure if they are the same or different suggestions.
 

MisterBill2

Joined Jan 23, 2018
18,167
I see, I am wanting as much airflow as I can get from these two fans so that doesn't get me where I need, but thanks for the suggestion. But I hadn't considered a boost on the 9V power supply, that could be worth considering given the 12V amperage is so low?

I am hoping to use a single power supply for all based on the enclosure I am using and just for simplicity - if possible of course, which is why I am asking all these questions :)
OK, that is certainly a choice that will work.
 

Toughtool

Joined Aug 11, 2008
63
I think I got a little lost on the comments between the FQP30N06L and the IGBT as options, I am not sure if they are the same or different suggestions.
The FQP30N05L is an IG MOSFET transistor. It is a TO-220 device and a low threshold gate voltage. 1 volt, typical 1.8 volts will turn it ON. It does not need biasing like a transistor , just a voltage to open he gate. The ON resistance is around 0.045 ohms so there is little or no heat developed across the Source to Drain. Perfect for the 3.3 volt logic levels and should provide more than 5 amps at the threshold voltage. It is rated at 60 volts Source to Drain and max of 32 amps. They cost less than a dollar in quantity of 10 on Amazon.
 
Last edited:

SamR

Joined Mar 19, 2019
5,031
The FQP30N06L MOSFET has a much higher heat capacity than the TO-92 cased options was why I mentioned it. Seems most of the TO-92 cased options were good on V & I but not W. Since you are in pulse mode it may not matter. For future reference, it is an excellent logic level gate medium power MOSFET that is relatively inexpensive.
 
Last edited:

BobaMosfet

Joined Jul 1, 2009
2,110
I tested the fans and found ~88mA on free current and about ~120mA on stall current. So with 2 fans I am looking at a spike load of ~240mA to consider in the circuit. So should I assume it's ok that with the 200mA peak base current - the 240mA stall current is not an issue since the free current will be below 200mA?
Thanks on the username- I admit I was at the first StarWars release.

"peak base current" - if you mean 'base' of transistor that's wrong. The base on the 2N2222 will be a fraction of that- the BJT isn't just a switch, it's a current amplifier. So, to give your circuit everything it could need, let's just shoot for 300mA.

so to recap:

FAN CALCS:
Loaded current (fan spinning): 88mA (R = E/I so: R = 12/.088; R = 136 Ohms : Likewise P=IE so: P = 12*0.088; P = 1.05W)
Stall current (fan prevented from spinning); 120mA (you can do the calcs as above for resistance & power-consumption)

2 fans in parallel, so current peak: ~240mA
A fan is an inductive load- if they don't have a snubber internally, you can use a 1N4002 in parallel with each fan.

2N2222 CALCS:
Ic = beta * (Ib) Collector current = gain * base current; 2N2222 gain is typically 100)
0.300 = (100 * Ib)
0.300 /100 = Ib
0.003 = Ib 3mA on the base will give you 300mA on the collector

Rb = (Vb - Vbe)/Ib (Resistor on Base = voltage on GPIO - what's lost through knee/ what we need on base - R = E/I)
Rb = (3.3-0.7)/0.003
Rb = 866.66 (Closest is 860 Ohms)

That lets your 3.3V GPIO pin control your 12V fans easily.

1582908344198.png

Now, regarding dropping 12V to about 7V for your LM7805, you can use this method:

1582909360940.png

You can reference the original document here:

http://www.idc-online.com/technical_references/pdfs/electronic_engineering/Voltage_regulators.pdf
 
Top