Maker Pro
Maker Pro

Basic transistor switch

SimonnomiS

Apr 5, 2023
1
Joined
Apr 5, 2023
Messages
1
Hello,
I am very new to electronics and I hope some one can verify this basic circuit. I will use an ESP32 O/P to switch the transistor.The load is 25mA Thanks in advance.bc850.png
 

kellys_eye

Jun 25, 2010
6,514
Joined
Jun 25, 2010
Messages
6,514
calculate the current flowing in the base resistor and multiply it by the current-gain (beta) of the device. Beta is a figure obtained from the datasheet or can be measured yourself.

When used as a switch, the transistor is driven into saturation - another parameter obtained from the datasheet and/or measurement.
 

danadak

Feb 19, 2021
751
Joined
Feb 19, 2021
Messages
751
The rule of thumb to force the transistor into saturation is Ib = Ic / 10.
Its a term called forced beta in the industry. Generally speaking when
we use a transistor as a switch we want the Vce to go as low as possible,
so that its power dissipation is kept low and the switch acts as close as
possible as a short, like relay contacts typically do.

So the base R, Rb =~ ( Voh - Vbe ) / Ib =~ ( Voh - Vbe ) / [ Ic / 10 |

Voh comes from micro sdatasheet, when an outpuit is turned on to high
logic level, and given at a specific current. Some datasheets show a typical
graph of Voh versus load current.

Typical curves that apply (2N3904 as example) :

1680696212981.png

As you can see in the graph, 10 mA case, we get a low Vce when we force 1 mA into
the base. Any more base current has very little egffect, eg. no more than Ic / 10 is
needed in most designs.

Note some transistors have even lower Vce when collector and emitter are reversed,
but takes more base current then Ic / 10 to get that increased performance.

Regards, Dana.
 
Last edited:

Alec_t

Jul 7, 2015
3,587
Joined
Jul 7, 2015
Messages
3,587
The circuit in post #1 should be fine, unless the load is inductive. If that's the case then there should be a reverse-biased diode connected across the load to suppress any back-emf voltage spike.
 

danadak

Feb 19, 2021
751
Joined
Feb 19, 2021
Messages
751
One mod to the post circuit in #1, connect a 10K - 20K R from
transistor base to ground. That keeps load off while processor
is powering up. Most processors power up with GPIO in tristate,
so a floating base of transistor can pick up noise and its leakage
could cause premature turn on.

1680706531733.png


Regards, Dana.
 

AnalogKid

Jun 10, 2015
2,884
Joined
Jun 10, 2015
Messages
2,884
I hope some one can verify this basic circuit. I will use an ESP32 O/P to switch the transistor.The load is 25mA View attachment 58638
You don't say how you determined the value of the base resistor, but it is correct. The circuit should work as intended.

As indicated in posts #4 and #5, if the load is a relay coil or some other form of inductor, you should add a suppression diode across it.

ak
 

crutschow

May 7, 2021
839
Joined
May 7, 2021
Messages
839
calculate the current flowing in the base resistor and multiply it by the current-gain (beta) of the device.
As noted frequently on these sites, that's not good design practice when using the transistor as a switch.
A forced beta of 10 is the usual value used.
 

kellys_eye

Jun 25, 2010
6,514
Joined
Jun 25, 2010
Messages
6,514
As noted frequently on these sites, that's not good design practice when using the transistor as a switch.
A forced beta of 10 is the usual value used.
You only took the first part of my post - when added to the rest of it, i.e. saturation, there's a distinct difference. My post was on the basis that this seems like a homework question and that 'helpful advice' is preferred over a simple 'answer'.
 

crutschow

May 7, 2021
839
Joined
May 7, 2021
Messages
839
You only took the first part of my post - when added to the rest of it, i.e. saturation, there's a distinct difference.
Okay.
But you just said there was a difference, you didn't say what the normal criteria is for a saturated transistor, so that's why I stated it.
 

CharlesBeckman

Jun 5, 2023
1
Joined
Jun 5, 2023
Messages
1
The rule of thumb to force the transistor into saturation is Ib = Ic / 10.
Its a term called forced beta in the industry. Generally speaking when
we use a transistor as a switch we want the Vce to go as low as possible,
so that its power dissipation is kept low and the switch acts as close as
possible as a short, like relay contacts typically do.

So the base R, Rb =~ ( Voh - Vbe ) / Ib =~ ( Voh - Vbe ) / [ Ic / 10 |

Voh comes from micro sdatasheet, when an outpuit is turned on to high
logic level, and given at a specific current. Some datasheets show a typical
graph of Voh versus load current.

Typical curves that apply (2N3904 as example) :

View attachment 58640

As you can see in the graph, 10 mA case, we get a low Vce when we force 1 mA into
the base. Any more base current has very little egffect, eg. no more than Ic / 10 is
needed in most designs.

Note some transistors have even lower Vce when collector and emitter are reversed,
but takes more base current then Ic / 10 to get that increased performance.

Regards, Dana.
Thank you sir. I will try it.
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Finally! A thread that tells it like it is. @danadak's schematic shown in his post #5 is the most general implementation of a transistor, either bipolar junction transistor (BJT) or metal-oxide silicon field-effect transistor (MOSFET) or insulated-gate field-effect transistor (IGFET) used as a saturated switch. The resistor placed between the control electrode (base if BJT, gate if MOSFET or IGFET) and circuit common (ground) should always be used to avoid unintentional operation caused by noise and start-up transients. Many microprocessors (Microchip PICs, for example) have programmable input/output pins that can be changed from input to output, or vice versa, during program execution. As @danadak mentioned, the programmable input/output pins will be in an open or high-impedance or tri-state condition until the controlling program sets those pins to be either input or output.

I have programmed PICs where I found it was necessary to change an input/output pin from its initially programmed output status back to being an input pin, and then change back again to output. This could have been avoided by choosing a different PIC with more I/O pins, but I had to work with a specific PIC with a small number of I/O pins for that project. It is a good idea to always include this resistor, labeled R in the post #5 schematic, just to avoid a nightmare troubleshooting exercise later.
 

Bluejets

Oct 5, 2014
6,901
Joined
Oct 5, 2014
Messages
6,901

Delta Prime

Jul 29, 2020
1,913
Joined
Jul 29, 2020
Messages
1,913
Oh my goodness look at that!
I just dropped a box filled with unknown BJ T transistors!
That's okay,we were just going to use them as a switch anyway,take any one of them let's turn them on, saturate them.
Do you mean Ic/Ib=10 sure why not.
But that is not what this plot says.
Silly! Don't use plots, that's just typical behavior.
Look at the limits!!
Maximum , Minimum.
Okay, but what's this hfe? Oh... That's for an unsaturated transistor used as an amplifier they call it gain.
Look the voltage from The collector to the emitter Vce is like 2.1volts.
Well that's a high Vce and you better make sure if you use hfe you stay at room temperature.
Why?
Because because nothing I've just said before is a good design.
Now pic up of your transistors &
"To Be Continued" .................
 

Delta Prime

Jul 29, 2020
1,913
Joined
Jul 29, 2020
Messages
1,913
The rule of thumb to force the transistor into saturation is Ib = Ic / 10.

Do you mean Ic/Ib=10

Typical curves that apply
Silly! Don't use plots, that's just typical behavior.
Look at the limits!!
Maximum , Minimum

normal criteria is for a saturated transistor, so that's why I stated it
but what's this hfe? Oh... That's for an unsaturated transistor used as an amplifier they call it gain
@Delta Prime : How do you think this is going to help the op?
I will stop repeating what everyone else's just said.
Let that be a lesson to all of you. It won't help.
What has just been said!
Scold them not me.
For some reason I have the munchies.
EatingPopcorn.gif

Only rule of thumb I know is Puff Puff pass on correct information.
...
People would rather be ruined by praise than saved by constructive criticism.
 
Last edited:

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Thanks for that link.

The Microchip forum link reminded me that to effectively use a Microchip PIC, one has to closely read the entire datasheet.

A designer using the PIC must know to what state power-on reset, as well as brown-out and other resets, each I/O pin defaults to and adjust their programming accordingly. In other words, if you don't like the default state of an I/O pin, and that state is programmable, it is up to you to make it to your liking.

The Harvard architecture and RISC, that are both used with PICs, versus the Princeton or von-Neumann architecture and CISC, that is used for personal computers, does require some getting used to if you program or roll code coming from a personal-computer background. Effectively using the addressing modes of PICs can be challenging, but of course programming in a high-level compiled language, such as C, avoids most of the complexity.
 

AnalogKid

Jun 10, 2015
2,884
Joined
Jun 10, 2015
Messages
2,884
Back in my PIC days . . . I won't say it was the hardest part, but the part I least looked forward to was figuring out all of the register configurations at the start of a project. Yuk then, yuk today.

ak
 

Delta Prime

Jul 29, 2020
1,913
Joined
Jul 29, 2020
Messages
1,913
View attachment 59531

That's the same, ain't it?
Yes sir it is. Ain't is not word so don't say ain't.

I will stop repeating what everyone else's just said.
I'll turn it down keep the shenanigans to a minimum thank you for your patience "all of you."I do realize I used to have an ego problem when I was arrogant, but no longer... cuz now I'm perfect.
That's it! no more! I got it all out. Thanks again.
 
Top