Calculating transistor base resistor

I want to calculate the transistor base resistor. My transistor is 2N5088. The collector is connected to a motor's ground. The emitter is connected to the ground. The motor is connected to a 5V power supply and the base to a 3.3V power supply (but same ground).

Here is a scheme:

I tried to calculate in this way:
ICsat = 0.2A
IBsat = ICsat / 300 = 0.666mA (300 Hfe per 2N5088 datasheets)

BaseResistor = 3.3 / 6.66e-4 = 4950 Ohm.

So, I tried to use 5K ohm resistor, but nothing happens... Weaker resistors do work, but I don't know if what is the minimal resistor...

Why 5K ohm resistor isn't working at all? How to calculate the right resistor value?

What is providing the 3.3 V?

The 2N5088 with an absolute maximum collector current of 50 mA is clearly the totally wrong transistor for this. :-1:

The board GPIO provides the 3.3V.

I'm actually pretty new in all the electronic stuff. This is a transistor I've got in a kit (only this type)... Thank you for the warning! Which transistors are better for this?

Everyone starts.
Try this explanation:
https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/transistors

1 Like

I strongly suggest getting familiar with:

https://www.falstad.com/circuit/circuitjs.html

Tools like this help you to interactively learn electronics.

2 Likes

Thanks for the suggestion (and the last tool is very cool)! I actually know the basic theoretical part of electronics. But when it comes to real life, it is harder :).

The hardest part for me is to find the components that fit my needs. For example, in your link they use PN2222 in another tutorial, I saw they use 2N2222. Not sure why...

The 2n2222 is a common transistor originally in a metal TO-18 case. The PN2222 is a (now more common) variant in a plastic TO-92 case. they can be used interchangeably.

1 Like

Say I have the PN2222 or 2N2222 instead of my transistor. What will be the base resistor in this case?

Per my previous calculation, expect now we have 100 Hfe:
ICsat = 0.2A
IBsat = ICsta / 100 = 2mA

BaseResistor = 3.3V / 2mA = 1650 Ohm

It also sounds too much. What am I missing?

Hfe is not relevant when the transistor is used as a switch.

A base current of 5-10% of the collector current is commonly calculated.
That would be 10-20mA into the base (for 200mA collector current).

Have a look at the saturation graph in the datasheet.
A 3.3volt pin usually can't provide 10mA, so you might have to reduce base current to an acceptable CE saturation voltage.
470 ohm could be ok, which is (3.3 - 0.7) / 470 = ~5.5mA.
330 ohm (almost 8mA) might already be over the MCU specification.
The danger of not fully saturating is the transistor heating up and popping it's top.

Are you sure your motor is 200mA (stall). That would be fingernail-size.
Motor drivers usually use mosfets for switching, or (the older ones) darlington transistors.
Leo..

Thank you for the detailed reply!

So, which is better? How you decide? Should we need to provide as much current as possible to the base?

I checked in the datasheet, my 3.3V pin can provide 10mA...

BTW, what is the "0.7" in your calculation?

The motor in the scheme is actually a tiny fan that I want to control with a "smart switch". It has a 5V==0.2A label on it.

If the (unspecified) pin can safely provide 10mA, then use 330 ohm.

0.7volt is the drop across the transistor's BE junction, leaving about 2.6volt across the resistor.
Assuming the pin stays at 3.3volt under load (which it doesn't).
You might just have about 2volt across the resistor (2/330= 6mA), which is ok.
Leo..

BTW

Always confirm your transistor goes into saturation.

Use a DMM, make the Arduino pin HIGH, measure the voltage Vce; if it is < ~ 0.7v the transistor is in saturation.

The lower the better.

A MOSFET is a better option.

https://www.hobbytronics.co.uk/arduino-tutorial9-power
https://itp.nyu.edu/physcomp/labs/motors-and-transistors/using-a-transistor-to-control-high-current-loads-with-an-arduino/

Thanks @Wawa , @LarryD ! Once I will get the 2N2222 (hopefully soon :)) I will test that and update you with my findings :slight_smile: