PNP Transistor Biasing resistor calculation

Status
Not open for further replies.

mailus

Full Member level 4
Joined
Mar 6, 2012
Messages
234
Helped
7
Reputation
16
Reaction score
7
Trophy points
1,308
Location
-
Activity points
2,706
I want to drive a Opto-coupler through a Transistor.
when my input is zero(below 2.5V) the transistor should turn on to drive opto-coupler.
if my input is greater than 2.5V means the transistor turn off.

how to calculate the biasing resistor and which bias is preferred?.

this circuit is used with microcontroller operated with 5V power supply
 

What is your tolerance (± xxx mV) around the switching point of 2.5V?

The circuit below will have better defined switching levels that using a transistor switch.
 

Attachments

  • opto.gif
    75.6 KB · Views: 185
Last edited:

As you know, the LED current of the opto-coupler (at its input) should be specified first. It will be the collector current of the PNP transistor.
 

What is your tolerance (± xxx mV) around the switching point of 2.5V?

The circuit below will have better defined switching levels that using a transistor switch.

tolerance must be with in (+ or -)500mV.

- - - Updated - - -

As you know, the LED current of the opto-coupler (at its input) should be specified first. It will be the collector current of the PNP transistor.

i planned to use PC123. input forward current max 50mA. the collector current is to drive a microcontroller pin and other one is used to drive an transistor.
 

The following note may be not important here.

I noticed you use an MCU pin to control the opto-coupler output.
For 'some' MCUs, at boot, the I/O pins are shorted to ground till Vcc reaches the minimum MCU working voltage after which the pins are likely open (or weakly pulled up to Vcc).
In this case, the minimum Vcc could be about 3V (for nominal Vcc of 5V). So I try keeping the added PNP transistor (as a buffer) off for a control voltage less than 3.5 V, for example. This avoids having an output glitch at start up.
 


Thank you.

i use 0~2.5V to drive an opto-coupler. The opto-coupler output is drive the mcu input (so i isolate input and MCU).

one more optocoupler is used to drive an RELAY and it is controlled by MCU. (Relay is controlled by an LOW SIDE SWITCH)

How to design this circuit.
how to calculate Resistor values for Biasing
 

Let us start from the opto-coupler (say U1) at the MCU input.
Its LED forward voltage is typically 1.2 V
If the input MCU pin (connected to the output collectror of U1) is pulled up with 4K7 resistor (R2), the U1 output current is about 1 mA.
@1mA the current transfer ratio is about 110% (from datasheet). Let us assume it as being 50% only for Vce less than 1V (and @1mA).
The U1 input current is therefore about 2mA.
If the control input voltage is 2.5 V (the maximum as you said), the current limiting resistor (say R1) could be calculated as:
R1 = ( V_ctrl - V_led ) / I_led = ( 2.5 - 1.2 ) / 0.002 = 650 Ohm
So R1 = 560 Ohm is good value to start with.

Note:
If R2 is made of higher value or removed completely so that U1 should sink only the pin current of the internal weak pull-up resistance, higher values than 560 could be used for R1.

- - - Updated - - -

one more optocoupler is used to drive a RELAY and it is controlled by MCU

Do you have an idea about the rated DC voltage of the relay and its coil resistance?
 
Last edited:
Reactions: mailus

    mailus

    Points: 2
    Helpful Answer Positive Rating
Do you have an idea about the rated DC voltage of the relay and its coil resistance?

yes, 24V and current about 50mA

can you give some theory about transistor circuit designing?
 

I want to drive a Opto-coupler through a Transistor.
when my input is zero(below 2.5V) the transistor should turn on to drive opto-coupler.
if my input is greater than 2.5V means the transistor turn off.

hi..for this purpose i will suggest you to use an NPN transistor. Now, i guess u are giving a pulse to the base of the transistor!! before connecting the input,use a not gate to invert the pulse! that is when the input voltage is low, the transistor gets high and viceversa! That means if your input is below 2.5v (zero),the transistor receives one(high). This high pulse will turn on the opto-coupler!!! i dont know if i m right... but i instantly thought the things and jotted it down.... u can though try it!!
 

In this case, a 50mA load is at the Ic limit of the second opto-coupler (say U2).
A transistor could be added (after U2) to drive the relay.

I would like knowing first, if the relation between the state of the MCU pin and of the relay is fixed or not.
If it is fixed (that is you cannot change it in software), by which pin state (low or high), the relay should turn on?
 


relay turn on at logic high only.

I designed some circuit(for 0V the circuit ON) please help to which one is correct.....

this one


OR this one? and WHY?

 

also connect a reverse=biased diode across the relay coil
 

In your circuit the opto will only switch off when the input gets above about 4.5V. Anything below 4.5 and the opto will start to switch on. This can't be used with the (2.5V ±0.5V) requirement in your first post.
 
Last edited:

In my circuit biasing method and capacitor connection is correct or wrong?.How to calculate the capacitance value and resister value?

also connect a reverse=biased diode across the relay coil
the above circuit is not used to drive a Relay. I connect Diode in my Relay driver circuit..
 

From your circuit on post #11, I see a switch that could be closed (0V and 0 Ohm) or opened (0V and infinite resistance).

Is this your actual circuit?
Or is this switch (J1) drawn as an equivalent element for an output (as an open collector or drain)?
 


no J1 act as input (when input is 0 turn on the transistor)

Now my Doubt is Is my biasing resistors are correct or wrong?
how to calculate biasing resistor value?

NOTE:forgot about my conditions (2.5V + or - .5V)
 

It is not hard calculating the values of the biasing resistors. But before I do it, I like to point out that if there is a mechanical switch, the transistor is not needed. The anode of the external LED will be connected to VCC1 and R3 is connected to the switch J1 instead of ground.

Now let us be back to transistor Q1.

We start here from knowing its Ic (collector current) when it is on:

Ic = (VCC1 - Vce_sat - V_led1 - V_ir) / R3 , [equation_1]

VCC1 = 5V, [given_1]
Vce_sat = 0.2 V , estimated value of the saturated Vce, [estimated_1]
V_led1 = 2 V , typical value of red LED, [estimated_2]
V_ir = 1.2 V , typical value of IR LED (the opto-coupler input), [estimated_3]
R3 - 100 Ohm, [given_2]

Ic = 16 mA , [calculated_1]

This current is relatively high for the 1mA load at the output of the opto-coupler.
If you like to reduce it, say to 2 mA, you can also use [equation_1] to calculate R3 and choose the closest standard value (lower of the result).

In this case (saturated Q1), the ratio Ic/Ib could be estimated about 20.
G_i = Ic / Ib = 20 , [estimated_4]
Therefore:
Ib = Ic / G_i = 16 / 20 = 0.8 mA , [calculated_2]

We also assume the current in R1 from Ib*0.1 to 1*Ib. A higher current (I_r1) lets R1 be smaller and this gives faster turn off and better immunity to noise. Here even I_r1 = Ib/10 is fine but let us assume:
I_r1 / Ib = 0.5 , [estimated_5]
From [calculated_1]:
I_r1 = 0.5 * 0.8 = 0.4 mA , [calculated_3]

But:
R1 = Vbe_q1 / I_r1 , [equation_2]
where:
Vbe_q1 = 0.7 , the diode forward volatge , [estimated_5]

R1 = 0.7 / 0.4 = 1.75 Kohm , [calculated_4]
R1 = 1.8 Kohm , [result_1]

The actual I_r1 can be found with [equation_2]:
I_r1 = 0.7 / 1.8 = 0.389 mA , [calculated_5]

Now:
I_r2 = Ib + I_r1 , [equation_3]
I_r2 = 0.8 + 0.389 = 1.189 mA , [calculated_6]

And:
R2 = ( VCC1 - Vbe_q1 ) / I_r2 , [equation_4]
R2 = ( 5 - 0/7 ) / 1.189 = 3.62 Kohm , [calculated_7]
R2 = 3.3 Kohm , [result_2]

Hope this helps
 
Last edited:
Reactions: mailus

    mailus

    Points: 2
    Helpful Answer Positive Rating
In this case (saturated Q1), the ratio Ic/Ib could be estimated about 20.
G_i = Ic / Ib = 20 , [estimated_4]

Ic/Ib is known as Beta right?
for my transistor Beta value from 160-400.
then why we choose 20.

For R2 resistor?
 

You are right "mailus", Ic/Ib is Beta and it is usually given on the datasheet when the transistor is in its linear region (for Vce not close to zero volt as in our case here, Q1 is saturated).

About R2, please re-read my previous post, there was a mistyping
R2 = 3.3 K
 

I_r1 = 0.7 / 1.8 = 0.389 mA , [calculated_5]
typing error I_r1 is 0.389uA (0.7/1.8K)

I_r2 = 0.8 + 0.389 = 1.189 mA , [calculated_6]
I_r2 is 0.8ma

R2 = ( 5 - 0.7 ) / 1.189 = 3.62 Kohm , [calculated_7]

R2 is 5.3K= ~5.6K


is it correct?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…