# BJT as switch doesn't work why

#### WBahn

Joined Mar 31, 2012
30,303
I am using BJT as switch to control 15ohm light load on and off give Varying voltage ranges V1.

My only concern is that V1 varies from 1.5VDC to 0VDC. I want the transistor on from 0.5VDC to 0VDC and off from above 0.5VDC. My V2 is constant at 3VDC.

I am still confused on how to do this?
I don't know where people are getting their 500 mA figure from. The last time I checked, 3 V across a 15 Ω load was 200 mA.

That's right at the max rating limit for a 2N3904, so I'd recommend finding a more suitable transistor, One possibility would be the ZTX853 (though even the old 2N2222 would likely fit your needs just fine).

https://www.diodes.com/assets/Datasheets/ZTX853.pdf

Notice that (typically) at 200 mA collector current, Vce(sat) is well below 50 mV, even with IC/IB being 50.

That means that you can pretty safely design your circuit for a base current of about 4 mA, though you might bump that up to 5 mA.

The Vbe(sat) under this conditions (presumably at room temperature) is about 0.8 V.

So if your control voltage is 3 V (I haven't seen any indication of what your control voltage is, so I'm assuming it's the same 3 V supply as for your light), then you would need a base resistor that is about

Rb = (3 V - 0.8 V) / 4 mA = 550 Ω.

I'd recommend going with a 470 Ω resistor -- that drives you a bit further into saturation and is also a very common resistor value. It would yield an expected base current of around 5 mA.

You total power dissipation would be somewhere around

Ib*Vbe + Ic*Vce = 5 mA * 0.8 V + 200 mA * 50 mV = 14 mW, which is should only produce a few degrees temperature rise in the junction.

What kind of light is this? It might be a good idea to use an anti-kickback diode in the circuit.

#### hhsting

Joined Apr 25, 2024
170
I don't know where people are getting their 500 mA figure from. The last time I checked, 3 V across a 15 Ω load was 200 mA.

That's right at the max rating limit for a 2N3904, so I'd recommend finding a more suitable transistor, One possibility would be the ZTX853 (though even the old 2N2222 would likely fit your needs just fine).

https://www.diodes.com/assets/Datasheets/ZTX853.pdf

View attachment 322728

Notice that (typically) at 200 mA collector current, Vce(sat) is well below 50 mV, even with IC/IB being 50.

That means that you can pretty safely design your circuit for a base current of about 4 mA, though you might bump that up to 5 mA.

View attachment 322730

The Vbe(sat) under this conditions (presumably at room temperature) is about 0.8 V.

So if your control voltage is 3 V (I haven't seen any indication of what your control voltage is, so I'm assuming it's the same 3 V supply as for your light), then you would need a base resistor that is about

Rb = (3 V - 0.8 V) / 4 mA = 550 Ω.

I'd recommend going with a 470 Ω resistor -- that drives you a bit further into saturation and is also a very common resistor value. It would yield an expected base current of around 5 mA.

You total power dissipation would be somewhere around

Ib*Vbe + Ic*Vce = 5 mA * 0.8 V + 200 mA * 50 mV = 14 mW, which is should only produce a few degrees temperature rise in the junction.

What kind of light is this? It might be a good idea to use an anti-kickback diode in the circuit.
My control voltage is V1 which varies from 0V to 1.5V. It is landscape lighting. I want light off when control voltage reaches above 0.5vdc and on at 0.5vdc or below. I am confused how I can do this?

#### WBahn

Joined Mar 31, 2012
30,303
My control voltage is V1 which varies from 0V to 1.5V. It is landscape lighting. I want light off when control voltage reaches above 0.5vdc and on at 0.5vdc or below. I am confused how I can do this?
The voltage at which is switches is best dealt with separately from the switching action itself.

Where is this control voltage coming from?

I'm assuming it's something that is coming from some light-sensitive circuit in order to activate the lights at night?

How much current can it supply without the voltage changing appreciably?

How critical is the 0.5 V threshold? Is it really going to make a difference if it's 0.4 V today and 0.6 V a week from now?

Do you want/need hysteresis? In other words if the voltage rises above 0.5 V and the lights turn on, and then the threshold drops back slightly below the threshold a few seconds later, do you want the lights to be sitting there going on and off several times until the control voltage is finally far enough above the threshold to stay there, or would you prefer that once the lights come on, that they stay on until the control voltage drops significantly back below the threshold?

#### hhsting

Joined Apr 25, 2024
170
The voltage at which is switches is best dealt with separately from the switching action itself.

Where is this control voltage coming from?

I'm assuming it's something that is coming from some light-sensitive circuit in order to activate the lights at night?

How much current can it supply without the voltage changing appreciably?

How critical is the 0.5 V threshold? Is it really going to make a difference if it's 0.4 V today and 0.6 V a week from now?

Do you want/need hysteresis? In other words if the voltage rises above 0.5 V and the lights turn on, and then the threshold drops back slightly below the threshold a few seconds later, do you want the lights to be sitting there going on and off several times until the control voltage is finally far enough above the threshold to stay there, or would you prefer that once the lights come on, that they stay on until the control voltage drops significantly back below the threshold?
Control voltage is coming from solar panels. I want the light instantly on at or below 05vdc and instantly off at above 0.5 vdc. That is the teated voltage producdd by solar panel when tested which is dark outside. It is ok to vary by +_ 0.1vdc for light on or off. I may add more lights in future so the load current drawn may change by the load

#### BobTPH

Joined Jun 5, 2013
9,292
You need a comparator to do this.

And a MOSFET is much preferred for switching. When on, the loss can be well below what a BJT in saturation loses.

Also, you really do want hysteresis. Without it, when it first switches it will flicker erratically.

Last edited:

#### WBahn

Joined Mar 31, 2012
30,303
Control voltage is coming from solar panels. I want the light instantly on at or below 05vdc and instantly off at above 0.5 vdc.
So that means that you want the lights to flicker on and off as the threshold is reached in the evening and again in the morning?

#### hhsting

Joined Apr 25, 2024
170
So that means that you want the lights to flicker on and off as the threshold is reached in the evening and again in the morning?
Yes

#### Audioguru again

Joined Oct 21, 2019
6,785
A common-emitter transistor inverts so it is turned on when its base voltage is above the switching voltage and it is turned off when it is below the switching voltage. But its base is fed a current, not a voltage. The varying voltage to the series current-limiting resistor varies the current.
My solar garden lights do what you want and also charge the battery during the day but their load current is only about 25mA.
The solar panel produces about 2V in sunlight charging the 1.45V Ni-MH battery cell and the circuit boosts the battery voltage to about 3V to light the LED with a regulated 25mA.

#### BobTPH

Joined Jun 5, 2013
9,292
I don't know where people are getting their 500 mA figure from. The last time I checked, 3 V across a 15 Ω load was 200 mA.
Sorry, I was having a bad math day!

#### sparky 1

Joined Nov 3, 2018
785
An approach to learning NPN as a switch sometimes hands on helps to motivate and discover.
Taking that further you could draw the circuit out. Teachers put a lot of effort into demos.
It is up to the student to reproduce the demo and explain how and why. Simulation can also be good.
One response is yes it is good but where is the circuit.

#### hhsting

Joined Apr 25, 2024
170
You need a comparator to do this.

And a MOSFET is much preferred for switching. When on, the loss can be well below what a BJT in saturation loses.

Also, you really do want hysteresis. Without it, when it first switches it will flicker erratically.
Cannot build comparator from bjt and then feed output to another bjt??

#### Papabravo

Joined Feb 24, 2006
21,321
Cannot build comparator from bjt and then feed output to another bjt??
No. You need to have a way to compare two things. This is difficult to do with a device that has only one input.

#### Michal Podmanický

Joined May 11, 2019
117
For Bjt as “high power switch” you need a special type of transistor, not 2n3904, not 2n2222.
A very good for your purpose is a 2sd882. It has very low Vce_sat at high Ic current.

Regarding schematic, you need an inverter like this:
(You can change 100k resistor to 47k or even less if you want to implement some hysteresis).

#### Attachments

• 3.3 MB Views: 12
Last edited:

#### hhsting

Joined Apr 25, 2024
170
For Bjt as “high power switch” you need a special type of transistor, not 2n3904, not 2n2222.
A very good for your purpose is a 2sd882. It has very low Vce_sat at high Ic current.

Regarding schematic, you need an inverter like this:
(You can change 100k resistor to 47k or even less if you want to implement some hysteresis).
Can you please explain as how the circuit works and how you got the resistor values and why is there 100k from base of one transistor to emitter to another transistor?

#### Michal Podmanický

Joined May 11, 2019
117
When Vin=0V the 3904 is not conducting , so the base of 882 is supplied thru 470 and Led glows.

Once the Vin goes higher the 3904 becomes conducting, it cuts the suppling the base of 882 and Led becomes Off.

The 100k makes a very little hysteresis and also avoids the 882 to be in linear mode. Otherwise 882 could heat up when Vin from solar panel is at the edge of transition from On to Off and vice versa.

The most important value is 470 ohm resistor so it forces enough current to base of 882 to fully switch On a 0.5A load.

Ib required = 0.5A/150 (150 is Hfe)=3.3mA

3V-0.7V=2.3V (voltage across Rb)

Rb= 2.3V/3.3mA = 697ohm ,

so considering some reserve I choosed 470 ohm.

Last edited:

#### hhsting

Joined Apr 25, 2024
170
Can you please explain as how the circuit works and how you got the resistor values and why is there 100k from base of one transistor to emitter to another transistor?
When Vin=0V the 3904 is not conducting , so the base of 882 is supplied thru 470 and Led glows.

Once the Vin goes higher the 3904 becomes conducting, it cuts the suppling the base of 882 and Led becomes Off.

The 100k makes a very little hysteresis and also avoids the 882 to be in linear mode. Otherwise 882 could heat up when Vin from solar panel is at the edge of transition from On to Off and vice versa.

The most important value is 470 ohm resistor so it forces enough current to base of 882 to fully switch On a 0.5A load.

Ib required = 0.5A/150 (150 is Hfe)=3.3mA

3V-0.7V=2.3V (voltage across Rb)

Rb= 2.3V/3.3mA = 697ohm ,

so considering some reserve I choosed 470 ohm.
How did you slect 1k? What value should 2k2 resistor be? In the above how did you know 3V-0.7V=2.3V (voltage across Rb)? How did you calculate 100k resistor value? How does 3904 turn on at 0.5V from solar panel??

Also lets assume 1V is voltage from solar panel. Then the 3904 is on and 894 is off. So collector of 894 sees 3v at where 100k resistor is attached but then at 3904 it sees 0.75V? Same question when its 0.5V and 0V solar panel. I dont follow how 100k makes a very little hysteresis and also avoids the 882 to be in linear mode. Otherwise 882 could heat up when Vin from solar panel is at the edge of transition from On to Off and vice versa???

#### Audioguru again

Joined Oct 21, 2019
6,785
Hhsting,
Please attach the datasheet or part number of the very bright 0.5A/low forward voltage LED.

#### hhsting

Joined Apr 25, 2024
170
Hhsting,
Please attach the datasheet or part number of the very bright 0.5A/low forward voltage LED.
See below. I have two of them in parallel 3VDC:

#### Audioguru again

Joined Oct 21, 2019
6,785
I have never seen LEDs like that. What are the part numbers and manufacturer's name?
Aliexpress sells SUMBULBS and SYMBUTH but they are all 12V and have no detailed electrical specs.
An enlarged SYMBUTH LED shows many COB LEDs in series/parallel. We do not know if each LED limits its own current.
White, green and blue LEDs might not work at only 3V.

#### hhsting

Joined Apr 25, 2024
170
I have never seen LEDs like that. What are the part numbers and manufacturer's name?
Aliexpress sells SUMBULBS and SYMBUTH but they are all 12V and have no detailed electrical specs.
An enlarged SYMBUTH LED shows many COB LEDs in series/parallel. We do not know if each LED limits its own current.
White, green and blue LEDs might not work at only 3V.
I have yellow 3VDC and it works i have them in parallel its 100ma each so total
current drawn is 200ma at 3VDC parallel

Last edited: