How to calclate Rb value for NPN transistor?

Here is a part of my schematic.

K pin from LCD is connected to NPN transistor. A pin is connected to Vcc, 5V.

Base is connected to uController. It is Atmega16. 5V supply.

I am using BC547 transistor as it is showed at the picture.

Electrical Characteristics form datasheet:

Vcbo= 50V

Vceo=45V

Vebo=6V

Ic=100mA

hfe=110 min

So the question is how can i calculate resistance of Rb?

I found some calculators online and there's always Vi, explained as the input switching voltage or the input trigger voltage. I am not sure what it refers to.

Also do i need resisor on collector too?

You generally should have a resistor on the collector (or from A to Vcc) to limit the current. Refer to your LCD datasheet for guidance on that matter, and assume transistor voltage drop is something like 100mV. Failure to include the resistor when one is required will likely lead to early failure of the backlight and/or transistor. Some LCDs have a suitable resistor for the expected supply voltage built-in, or have a place for a (fairly large physically) resistor on the PCB. There is a lot of variation between different products.

For the base resistor we typically try to drive it with about 1/20 of the collector current, so pick it so that base current ~= (5V-0.7)/Rb is about 1/20 of the backlight current. Say the backlight is 20mA you would want 1mA so Rb ~= 4.3K.

Generally you should use datasheet chart.

And than with Ohm´s Law calculate resistor value.

Or throught h21 parameter:

$$\h_{21} = { \frac{I_{c}}{I_{b}}} \$$

Or here is some useful calculator and some theory with explanation: https://www.petervis.com/GCSE_Design_and_Technology_Electronic_Products/transistor_base_resistor_calculator/transistor_base_resistor_calculator.html

• The graph shows the response of a "typical" transistor that you cannot buy. A transistor with a gain less than "typical" will not work like that. The written spec's say the guaranteed maximum saturation voltage when the base current is 1/20th the collector current (for this European transistor). Datasheet for American 2Nxxxx transistors show a lower saturation voltage because they use a base current that is 1/10th the collector current. – Audioguru Jun 16 '20 at 12:50