Adding resistor to protect the MCU

Thread Starter

Kelvin Lee

Joined Oct 22, 2018
111
800mA is transient (lasting only for a short time). You don't need a transistor capable of handling 1A.
Ic continuous @ 200mA will do. NPN transistors 2N3904 and 2N2222 are popular ones.

As for the base pulldown resistor, the value is not critical. This resistor will steal some of the MCU output drive current. You want the pulldown resistor to be 10 times higher or more that the base drive resistor. 10kΩ is fine.
Dear MrChips,

Yes, I heard about the term of pulldown resistor, so far I still not fully understand how it works but I will research it. If I am not wrong, it is used to deal with the pin in floating.
 

MrChips

Joined Oct 2, 2009
34,823
The concept of the pulldown resistor is simple. You do not want the input of the transistor to "float" high when it is not supposed to do so.

With NPN BJT, this is not an issue because the BJT is a low impedance current device.
This is not the same of the transistor is a FET or MOSFET. These are high impedance voltage devices. You never want to leave the inputs of FET, MOSFET or CMOS circuits "floating". Hence a good rule of thumb - don't leave inputs "floating" (i.e. not connect to a sure relatively lower impedance source - the input impedance of FET circuits can reach 1MΩ or even higher).
 

MaxHeadRoom

Joined Jul 18, 2013
30,671
I designed a circuit to control the motor fan on/off according to the signal from P0 of the Microbit MCU.
If you are in the process of controlling power devices from a Microcontroller I suggest you look into Fet's and Mosfets, particularly the logic gate versions.
Starting with the popular 2n7000.
Max.
 

Attachments

Thread Starter

Kelvin Lee

Joined Oct 22, 2018
111
The concept of the pulldown resistor is simple. You do not want the input of the transistor to "float" high when it is not supposed to do so.

With NPN BJT, this is not an issue because the BJT is a low impedance current device.
This is not the same of the transistor is a FET or MOSFET. These are high impedance voltage devices. You never want to leave the inputs of FET, MOSFET or CMOS circuits "floating". Hence a good rule of thumb - don't leave inputs "floating" (i.e. not connect to a sure relatively lower impedance source - the input impedance of FET circuits can reach 1MΩ or even higher).
Thanks for your sharing. I find a good page about the pulldown resistor http://www.resistorguide.com/pull-up-resistor_pull-down-resistor/ hope other people can see it here.
 

Thread Starter

Kelvin Lee

Joined Oct 22, 2018
111
If you are in the process of controlling power devices from a Microcontroller I suggest you look into Fet's and Mosfets, particularly the logic gate versions.
Starting with the popular 2n7000.
Max.
Dear MaxHeadRoom,

Nice to see you here again. Thanks for your information. As I am still not familiar with MOSFET, when I read the datasheet of 2n7000, the Id is 200mA, may I know whether the function is similar to the NPN Ic? Every time when I apply a transistor, most experts must ask me how much current of my load, just like this case, the motor requires 800mA for startup, so some suggest Ic with at least 800mA to allow it startup, but some disagree this because the continue current load of the motor is just 80mA, so Ic with 200mA is far good enough, how about MOSFET? The same concept?
 

MaxHeadRoom

Joined Jul 18, 2013
30,671
motor is just 80mA, so Ic with 200mA is far good enough, how about MOSFET? The same concept?
Similar Source to drain, the advantage is the gate is basically voltage, trans conductance, operated device rather than requiring a base current as do Bi-Polar.
There are also Logic gate versions that are higher in current rating that the 2n7000
To obtain the maximum motor current with full voltage at start, is to lock the rotor and feed with a known low voltage and measure the resistance, use a few positions in order to obtain the very lowest, and then extrapolate the current.
Max.
 

ebp

Joined Feb 8, 2018
2,332
In bipolar transistors, there is always some amount of "leakage current" that can flow through the reverse-biased collector-base junction. In normal operation, the CB junction is reverse biased. This leakage current means that carriers get into the base region and act just as if the carriers were put in via the base terminal - they allow current to flow in the collector-emitter circuit. For modern silicon small signal bipolar transistors the leakage current is very low at room temperature - much lower typically than the reverse leakage current of a fast signal diode such as the 1N4148. But leakage current approximately doubles for each 10 °C temperature rise, so if the transistor is hot, the leakage could be enough to cause "too much" current flow. The base-emitter resistor provides a path for at least some of the leakage current to flow out of the base and not contribute to turning the transistor partially on.

When a transistor is driven by an I/O on a microcontroller, the base would be open-circuit before the I/O is set to being an output and then set LOW. In some circumstances this could mean the transistor's load is partially turned on and that may be unacceptable. Once the I/O pin is set LOW, then it provides a much lower resistance path to "ground" than the base-emitter resistor does.

There are transistors with built-in resistors available, such as the MMUN22xx series from ON. They are sometimes called "digital transistors" or "bias resistor transistors" (BRT) or "pre-biased" transistors. The latter term is actually nonsense. These transistors have a resistor in series with the base and usually a base to emitter resistor. They can be convenient when board space is limited or you just want to reduce parts count. With small-volume production of circuit boards it often costs more to put a part on the board than the part costs, so you an pay twice as much for the transistor with the built in resistors and still save money.
datasheet for one randomly chosen part from ON:
http://www.onsemi.com/pub/Collateral/DTC143Z-D.PDF
 

Thread Starter

Kelvin Lee

Joined Oct 22, 2018
111
Here
View attachment 163512

1K protects the MCU port.
10K grounds the base during PORT "off" to make sure the transistor stays off during off period and if the port is floating.
Diode protects the transistor from motor back EMF
Dear R!f@@,

After long reading to the post and I learnt a lot from you all. I read the datasheet of my MCU Microbit (https://tech.microbit.org/hardware/edgeconnector_ds/), it states there are external 10Mohm pullup, internal 12K pull down for P0, P1 and P2, I don't know what external pullup and internal pull down, in such case, do I still need to both 1K and 10K resistors in my circuit?

Best regards,

Kelvin.
 

dl324

Joined Mar 30, 2015
18,333
there are external 10Mohm pullup, internal 12K pull down for P0, P1 and P2, I don't know what external pullup and internal pull down, in such case, do I still need to both 1K and 10K resistors in my circuit?
I didn't follow the link...

You still need the series resistor because it sets the base current to the transistor because most microcontrollers can operate from multiple supply voltages.

Read documentation to see if the ports are configurable and, if so, what the defaults are. If you're driving a load that's sensitive to having inputs floating, you need to use resistors to control circuit state while the microcontroller is starting up or is turned off.
 

R!f@@

Joined Apr 2, 2009
10,004
@Kelvin Lee External pull-up means simply that a pull-up resistor is connected outside the MCU by you or any one who designed the circuit.
Internal Pull-down means that the MCU has an internal Pull-down for the ports which can be programmed by the programmer to be used when the software or circuit is running. It can be left out or used.
Sometimes internal resistors are referred as weak pull-up or pull-down resistors......RPU or RPD
 

R!f@@

Joined Apr 2, 2009
10,004
You need to use the base resistor to protect the MCU, what ever the case may be
RPU or RPD does not help in protecting the MCU by reducing the drive current to a safe value but rather minimizes the component count where complex circuits are used. The RPU or RPD can be used to keep the unused MCU ports at a definite potential. You do not want them unused ports floating. Unused ones can be configured as Input or Outputs. If configured as inputs you can use the RPU or RPD to tie them to Vcc or GND.
 

Thread Starter

Kelvin Lee

Joined Oct 22, 2018
111
You need to use the base resistor to protect the MCU, what ever the case may be
RPU or RPD does not help in protecting the MCU by reducing the drive current to a safe value but rather minimizes the component count where complex circuits are used. The RPU or RPD can be used to keep the unused MCU ports at a definite potential. You do not want them unused ports floating. Unused ones can be configured as Input or Outputs. If configured as inputs you can use the RPU or RPD to tie them to Vcc or GND.
Dear R!f@@,

Many thanks for your explanation, recently I want to use the resistor SS8050, as it is always advised to use a base resistor to protect the MCU, according to the specification of SS8050, how much of resistance I should use? Could you suggest the value and explain why you select the value, any information you base on the data sheet of SS8050? I attached the data sheet of SS8050 for your reference.

Screen Shot 2018-12-10 at 12.06.44 AM.png
 
Top