If we recall from How to control a DC Motor using MCU 1, we got the Ibase as 16mA.
16mA is tolerable, and the microcontroller can freely source it with ease.
But what if Ibase swoops up to 20mA? or 30mA? or 100mA?
This picture above is a clip from the PIC16F877A datasheet. It shows 25mA of maximum sink and source.
Sink is when the current flows to the mcu. Source is when the mcu produces an output current.
Let’s assume our Ibase = 50mA.
Let’s assume the Icollector2 = Ibase = 50mA.
So, what resistor will we use if our Icolletor2 is 50mA? Again, Ohm’s Law. R = V/ I.
Rc = V/I = 9v / 50mA = 180 Ohms ;
Rc = 180 Ohms
And, Ibase2 is obtained by Ibase2 = Icolletor2 / Hfe. (Assuming a value of 40 for Hfe).
Ibase2 = Icollector2 / Hfe = 50mA / 40 = 1.25mA
Ibase2 is now 1.25mA, from 50mA it is now down to 1.25mA. The PIC would love you in that way.
Last part is determining Rb. Again, the famous Ohm’s Law.
Rb = V / I = 5v / 1.25mA = 4000 Ohms
Rb = 4 kOhms
There you have it. This circuit is called a Darlington Pair. If you want more knowledge about this, just google Darlington Pair!