Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Current Limiting Resistor

Status
Not open for further replies.

TucsonDon

Member
I am using a GPIO on a mcu to drive the base on a transistor. The datasheet for each component lists the max @ 500mA do I need to add a resistor to the circuit?
 
What is the transistor doing?
Post a schematic of you circuit.
 
1676387418975.png


It is a bi-polar. In addition to the above circuit I am also going to use a transistor to switch a coil on a relay.
 
I am also going to use a transistor to switch a coil on a relay.
Don't forget the reverse-biased back-emf protection diode to suppress the voltage spike which the relay coil generates at switch-off.
 
If you have 500 mA of current to switch, then rule of thumb for a bipolar
is to drive 1/10 Ic into base, which would be 50 mA which you cannot get out
of a typical MCU. You can use a Darlington, although that has higher Pdiss when
on because of higher Vcesat, or as suggested a MOSFET.

In either case wire up as follows :

1676391705611.png


R34 and R4 to absorb leakage when MCU powering up and GPIO go into Tristate.
To prevent load inadvertently turning on. R1 you calc to force Ic / 10 into base, if you
have enough current available. R2 prevent MCU internal power buss from collapsing
due to high C looking into gate of MOSFET, eg. to minimize C charging current surge.


Regards, Dana.
 
danadak just to clarify I'm not switching 500mA, that was the max allowed for both the transistor base and mcu GPIO according to the datasheets.

So if the base is max'ed @ 500mA how much should I allow for the base?
 
The display must be a common anode display from the way it is being driven. The top four (Digit drive ) transistors are being used as emitter followers so would not require current limiting resistors in series with their bases. The current limiting for the display is done by the resistors in series with the segment drives.
The bottom transistor will NOT drive the DP LEDs as they need to be pulled towards ground to turn the LEDs on. It's collector would need to be connected to the DP via a current limiting resistor and it's emitter connected to the negative rail. This transistor would need a current limiting resistor in the base for this configuration.

Les.
 
danadak just to clarify I'm not switching 500mA, that was the max allowed for both the transistor base and mcu GPIO according to the datasheets.

So if the base is max'ed @ 500mA how much should I allow for the base?

If you are driving a relay than whatever that current is / 10 to drive into base for a bipolar.

Maybe I do not understand your question.


Regards, Dana.
 
If you are driving a relay than whatever that current is / 10 to drive into base for a bipolar.

Maybe I do not understand your question.


Regards, Dana.
danadak if I understand correctly, I have a relay that according to the datasheet operates @ 200mW which is 40mA I only need 4 mA for the transistor base
 
The bottom transistor will NOT drive the DP LEDs as they need to be pulled towards ground to turn the LEDs on. It's collector would need to be connected to the DP via a current limiting resistor and it's emitter connected to the negative rail. This transistor would need a current limiting resistor in the base for this configuration.

Les.
Les Jones I went back and looked at the datasheet and you are correct, thanks for catching that
 
danadak if I understand correctly, I have a relay that according to the datasheet operates @ 200mW which is 40mA I only need 4 mA for the transistor base

You don't even need that much, as you're operating the transistors as emitter followers (common collector), danadak's suggestion of 1/10th the current only applies to a common emitter design, where you're using the transistor as a switch, and you want to force it as hard ON as possible.

You're using the transistors as linear devices, not switches - which is why most designs would use PNP transistors for the top switches. No disrespect, but it's a poor design choice - often found in on-line designs, by people who don't really know what they are doing, and greatly increases heat in the transistors.

As Les Jones said, in your configuration you don't need resistors in the bases - but as you didn't initially post a circuit, everyone presumed you were doing it the usual way.
 
You're using the transistors as linear devices, not switches - which is why most designs would use PNP transistors for the top switches. No disrespect, but it's a poor design choice - often found in on-line designs, by people who don't really know what they are doing, and greatly increases heat in the transistors.
Nigel Goodwin you have given me some information to ponder and been doing some research on the use of transistors

I am using some transistors to "switch" the relays and switching those to PNP type.
 
Nigel is missing Base to ground R's sink switches. They are needed because
typical micro starts up with a GPIO in an unknown state, then once micro
starts up the output pins "typical" placed in tristate. So a R to ground absorbs
leakage to prevent switch from turning on except under code control.

transistor-tran12.gif


The base to ground R typically 10X the Rb, to minimize V divider effects
of transistor base drive, and its max value is to limit turnon due to its
self leakage. 10K a "typical" value.

Note this is also used for MOSFET gates, essentially same problems to deal with.

Also missing excessive C hang off cmos input needing series R to allow
discharge thru protection diodes when device powered down.



Sometimes its necessary to put additional clamp diode on transistor collector to ground, to prevent transients
below ground at collector. Simed by changing R3 from 1 Meg to 0 :

1677164262897.png




Regards, Dana
 

Attachments

  • 1677163952924.png
    1677163952924.png
    134.8 KB · Views: 132
Last edited:
You might consider the TM1638 that I've mentioned in your other thread.

If you use one of these 25 cent chips (available at LCSC), you can eliminate MOST of the components in your schematic for driving the LED display, and simplify your code requirements.

The TM1638 would use a 3 port pin interface to the MAIN micro (eliminate the second micro entirely). It will drive up to 8 7-segment common cathode digits directly (eliminate the shift register, transistors, transistor base resistors, LED current limiting resistors). "Segment pins" 1 – 8 are connected to each digit's A – H segment pins in parallel. "Grid pins" connect to each digit's common pin (i.e., Grid1 to left-most digit, Grid2 to second digit and so on). If you have other individual LEDs to drive, Segment pins 9 & 10 may be used to drive up to 16 LEDs (LEDs connected between a segment pin and a grid pin).

The software need only send 16 bytes, where each bit turns on or off a particular segment, when you want to change what's displayed. Otherwise, no action is required.

The LED brightness is also controllable over 8 steps.

Screenshot_20230223_081725_Dropbox.jpg
 
Here is the display section schematic I'm using for a multipurpose clock I'm working on. It might be a bit more clear than the bus nomenclature of the datasheet.

The only weirdness I have here is that the 3rd digit is rotated 180° so I can use the decimal points as a colon for the time. I remap it in hardware so I don't have to mess with it in software.

If you use a multiplexed 4 digit display, the connections are simpler. Eight wires for the segments and 4 for the digit commons.

I'm trying to find the top of my bench so I can get some boards assembled. I'm sure it's down there somewhere

Screenshot_20230223_090417_Dropbox.jpg
 
Here is the display section schematic I'm using for a multipurpose clock I'm working on. It might be a bit more clear than the bus nomenclature of the datasheet.

The only weirdness I have here is that the 3rd digit is rotated 180° so I can use the decimal points as a colon for the time. I remap it in hardware so I don't have to mess with it in software.

If you use a multiplexed 4 digit display, the connections are simpler. Eight wires for the segments and 4 for the digit commons.

I'm trying to find the top of my bench so I can get some boards assembled. I'm sure it's down there somewhere

View attachment 140596

How about two TM1637 modules (cheap from China), giving you eight digits - and I've got example PIC XC8 code for a four digit clock using a TM1637 module.
 
Status
Not open for further replies.

Latest threads

Back
Top