How to select correct base resistor value?

Thread Starter

coolworm

Joined Jan 29, 2021
9
Hello all,

I am trying to design a RGB LED String controller circuit via NodeMCU ESP8266 Wifi Module. I am unfamiliar with the transistors and their datasheets.

This is what I came up with for the relay controlling the LEDs.

bjt ccirc.PNG

The relay I chose has 12VDC coil voltage, 400ohm coil resistance. Here is the datasheet: https://cdn.ozdisan.com/ETicaret_Dosya/415763_1216803.pdf
I chose BC817-40 as my BJT. Assuming it has 0.4V Vce voltage when is conducting, Ic current would be Ic = (Vcc-Vce)/Rcoil = (12-0.4)/400 = 0.029 A == 30mA.
From the first graph on in the datasheet of the BC817-40 (https://cdn.ozdisan.com/ETicaret_Dosya/417241_3994580.pdf), for 30mA of Ic, hFE would be 250.

curve.PNG
Lets call Vgpio15 as VBB. It is 3.3V when the pin is set to HIGH.

Rb = (VBB-VBE)/(Ib) = (VBB-VBE)/(Ic/hFE) = (3.3-0.7)/(0.03/250)=21.6k

When I simulated the circuit in LTSpice, Ic drops to 5mA.

spiceeece.PNG

When I reduce the Rb value to 1k, transistor fully conducts. Is this because of thermal assumptions are not included in the LTSpice or did I miss something?

spic2e2.PNG

Are my assumptions and calcutions are correct? I am using the BJT in saturation region as it is supposed to when I use it as a switch? What generic resistance value should I go to if 21.6k is correct?
 

BobTPH

Joined Jun 5, 2013
11,463
The chart you took you beta from is labelled with:

Vce = 9V

That is not saturation. In saturation the beta falls sharply. Most datasheets recommend either 10 or 20 as the beta for the saturation region.
 

Thread Starter

coolworm

Joined Jan 29, 2021
9
When I calculated the Rb value as I described above, I found it as 21.6k but in the simulation, I had to decrease this resistance value to 1k to properly use it as a switch. Therefore I am couldn't be sure that my calculations are correct.
 

Thread Starter

coolworm

Joined Jan 29, 2021
9
The chart you took you beta from is labelled with:

Vce = 9V

That is not saturation. In saturation the beta falls sharply. Most datasheets recommend either 10 or 20 as the beta for the saturation region.
Graph is for 5V actually. It looks like 9V due to pixelation.

Which graph or value from the datasheet should I take into account to find out correct gain value?
 

dl324

Joined Mar 30, 2015
18,216
I am unfamiliar with the transistors and their datasheets.
The rule of thumb for non-power transistors is to use a beta of 10 for saturation mode. Some BC transistors (e.g. BC547) specify 20, so you can safely use that value for those transistors.

The transistor you're using specifies 10:
1713710115087.png
1713710141707.png

This graph gives more information for different currents:
1713710216919.png
The manufacturer is guaranteeing that 10 will work for all conditions. Other values will work for conditions that aren't worst case.

Another consideration is that the relay you're using will pick-up at less than the rated voltage, so the transistor doesn't need to be in hard saturation to energize the coil.
 
Last edited:
Top