Understanding the Base resistance calculation

Thread Starter

cyberpks

Joined Nov 29, 2020
13
Hi all,

I wanted to understand what are the rules that I need to keep on the table when I am using a transistor as a switch.

So I have this schematic, where I want to switch a couple of transistor on the basis of the signal I am getting from my MCU. There are 2 different voltage rails on the system i.e. 5vdc and 24vdc. I have an optocoupler chip (LTV-847) to provide the required isolation. Below is the one channel of this setup with 1/4th of the optocoupler and 1 transistor (BC847) to work as switch.

Capture.JPG

The output end of my optocoupler is supposed to work on the 24vdc power-supply, so technically speaking, I will be passing in 24v to the base of my transistors. Pin 1 and 2 of the optocoupler will be connected to my Shift-Register that will inturn be connected to the MCU passing in control values.

Looking at various other posts on this forum, I found that Resistance for the base of the transistor is =(V-Vbe)/Ib.

For a BC847, the max current it can handle is 100mA, so as people suggested, I need to take 1/10th of this, that becomes 10mA. Following this formula, gave me a resistance of ~ 2.3K. Not sure if my calculation is even right, since looking at the datasheet, I think passing in 24v to base directly seems like an invitation to the "Magic-Smoke".

The reason I am trying to pass 24v directly to my transistor, is because I want to keep 5v rail isolated as it is powering up my MCU. And if I can keep out a few components that I would be added to step down this 24v again to 5v, it'll be great. Please let me know if this seems practical.
 

AlbertHall

Joined Jun 4, 2014
12,345
Yes, that will work. Note that you should have a resistor to limit the LED current for the optocoupler too,

The 1/10 current thing should be that the transistor base current should be 1/10 of the actual collector current of the transistor, not its maximum rating.
 

Analog Ground

Joined Apr 24, 2019
460
You won't release the magic smoke from the transistor because of 24 volts. The 24 volts is across the base resistor. The power dissipated in the base resistor is 1/4 watt. So, make sure the resistor is rated high enough for that amount of power dissipation or the smoke will come from there. Another thing to check is the Vce voltage rating of the opto-isolator. The specification is 35 volts so it is OK.
 

MisterBill2

Joined Jan 23, 2018
18,167
Yes, the circuit can work, but a better choice is to use an open-collector circuit with the emitter at the common potential. That way the base -emitter voltage is only dependent on the base drive, not the load current. The secondary benefit is that an accidental connection of the output lead to commonwill not damage the control circuit.
 

Thread Starter

cyberpks

Joined Nov 29, 2020
13
Yes, the circuit can work, but a better choice is to use an open-collector circuit with the emitter at the common potential.
Thanks! Do you mind sharing a schematic please? What I understand, is you want me to connect the components in this way? Capture2.JPG
 
Last edited:

MisterBill2

Joined Jan 23, 2018
18,167
NO, that is an open emitter circuit.
For an open collector circuit the load is connected between the positive supply and the collector, and the emitter is tied to the common, labeled "GND2" in the circuit shown. And the base drive circuit should be as shown in the first post, except the base current limiting resistor neds to have a higher value.
 

crutschow

Joined Mar 14, 2008
34,281
What is the transistor load current?
If it's below the output current rating of the opto coupler, you could use that directly without needing the transistor.
 

MisterBill2

Joined Jan 23, 2018
18,167
NO, the load needs to be connected between the positive supply and the COLLECTOR of the transistor. With the load between the emitter and common the base-to-emitter voltage is dependent on the load resistance. The transistor is turned on by current flowing through the base-emitter junction, and so any resistance in series with the emitter will affect the base current. You need to have a common emitter circuit, with the load in series with the COLLECTOR.
 

Kjeldgaard

Joined Apr 7, 2016
476
I am missing an overview of what the supplies are in the overall construction?

And especially what is connected to the inputs of the optocouplers?
 

MisterBill2

Joined Jan 23, 2018
18,167
The TS has described the input connections, sort of. The opto-coupler is driven by a logic level signal.
The discussion has been about discovering the correct means of determining the base drive to have the transistor function as a switch. Unfortunately it seems that the concept of a common emitter arrangement is not understood by any participants so far.
 

BobTPH

Joined Jun 5, 2013
8,808
In the original post you say you have the opto-coupler to provide the needed isolation. Why is isolation needed? If you think it is always required when you have two different power supplies, that is not correct. A microcontroller can provide the base current directly to transistor switching a 24V device.

Bob
 

Thread Starter

cyberpks

Joined Nov 29, 2020
13
In the original post you say you have the opto-coupler to provide the needed isolation. Why is isolation needed? If you think it is always required when you have two different power supplies, that is not correct. A microcontroller can provide the base current directly to transistor switching a 24V device.
I want to keep the 24v completely isolated from my MCU that is running on 5v. It is definitely possible to supply base current to the transistor directly from the MCU (or a shift-register, if I may add), but then I will have to have a common ground for these two different voltage potentials, that makes me a little worried for the health of my MCU.
 

WBahn

Joined Mar 31, 2012
29,976
One thing to consider is the dark current of the opto combined with a high gain in the NPN. What is the most current that you can tolerate in the output transistor when it is supposed to be cutoff? If a milliamp is fine, you should be okay. But if a milliamp of current could cause problems, then you should probably revise your circuit to eliminate that possibility.
 

MisterBill2

Joined Jan 23, 2018
18,167
In the original post you say you have the opto-coupler to provide the needed isolation. Why is isolation needed? If you think it is always required when you have two different power supplies, that is not correct. A microcontroller can provide the base current directly to transistor switching a 24V device.

Bob
An opto-isolator is a very good safety device to separate the low voltage computer logic from the noisy loads being controlled. We do not know what other loads are on that 24 volt supply, but even a single brush type motor can send a whole lot of noise to everything connected to it's power source. Noise can travel on that ground line very well if it is actually connected to the wrong "ground point.
And there is a secondary benefit, which is protection of the logic board if that transistor suffers an internal short circuit, base to collector. That fault would connect the 24 volt source directly to the logic input with nothing to limit the current. MOST CPU devices are not built to survive that event.
So what would be OK for consumer junk that is not worth repairing is not worth the risk in either an experimenter's setup or in an item of industrial use. So the isolation is well worth the cost..
 

Thread Starter

cyberpks

Joined Nov 29, 2020
13
So the isolation is well worth the cost..
Very well explained!! An optocoupler like PC-817 is worth a few cents or 2-3 USD if I talk about LTV-847 which has 4 channels, per package. Looking at that cost which can help me save my MCU worth 15-20 USD, definitely looks worthy!
 
Top