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.

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.

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.

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?

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?
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.

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.

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.

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?

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?




