PWM control of LCD brightness

I'm planning to use this BJT (http://www.farnell.com/datasheets/165939.pdf) to control the brightness of a conventional HD44780 LCD, by means of PWM.

I understand the popular approach is to use a common emiter configuration, with a collector resistor attached to pin 16, Vdd (5V) at pin 15 , and a base resistor between the BJT and one PWM pin of an Arduino Uno.

My experience with BJTs is rather limited, which is probably why I'm having some rather trivial doubts. First off, am I right to assume that I want to operate in saturation (ON and OFF at PWM frequency)? Second, how exactly do I choose the resistors? I was assuming that I would need to have 4.4V across the base resistor, and somehow get a large resistor to ensure the collector is always at a lower potential than the base. But the datasheet I've read that base-emitter voltage in saturation is 2V!

Firstly you need to use that transistor (since it in an NPN transistor) as a low side switch. This is identical to using it with a relay, but you're using an LED and resistor instead. The base resistor is pretty much irrelevant and you can pick any value in the region shown. I would be inclined to add a 10K? pull-down resistor to the base as well to stop it floating when the Arduino is not powered or starting up.

The LED current limiting resistor depends on the LEDs you have in the display - is it one, or two? How bright do you want it to be able to get? If you can't answer those questions then just use a reasonable value such as the 150? shown there, or maybe a little higher - 220?. Of course, it could be that the display already has a resistor in there - some do.

joaocandre:
I’m planning to use this BJT to control the brightness of a conventional HD44780 LCD, by means of PWM.

First, I must point out that controlling the brightness of a LCD display by means of PWM is an interesting party trick, but basically useless! You only ever want three levels of brightness - daylight, night, and “off”. You only ever want “off” in order to save power whilst operating from batteries, in any other circumstances it is a nuisance when you have to press a button every time you want to read the display! If then you only need two of these levels of brightness, you just use the transistor to switch without PWM. If you want bright for day and dim for night, you use a resistor to set the “night” level. If you want day, night and off, you can do this with two port pins.

joaocandre:
I understand the popular approach is to use a common emitter configuration, with a collector resistor attached to pin 16, Vdd (5V) at pin 15 , and a base resistor between the BJT and one PWM pin of an Arduino Uno.

Your LCD almost certainly has the current-limiting transistor already present as R8 and/ or R9 on the back of the board, and generally “101” or 100 ohms (the other being zero). That being the case, you connect it to 5V (from your Arduino) and measure the voltage across the resistor to calculate the (maximum) current being drawn, generally no more than 30 mA. If the current is 20 mA or less, you do not need the transistor.

joaocandre:
My experience with BJTs is rather limited, which is probably why I’m having some rather trivial doubts. First off, am I right to assume that I want to operate in saturation (ON and OFF at PWM frequency)?

Yes.

joaocandre:
But the datasheet I’ve read that base-emitter voltage in saturation is 2V!

You read it wrong. VCE(sat) at 500 mA is 0.7V, but you are not going to require 500 mA - 0.3V at 100 mA would be pretty much tops.

majenkotech:
I would be inclined to add a 10K? pull-down resistor to the base as well to stop it floating when the Arduino is not powered or starting up.

I wouldn’t. It is irrelevant! (In this case. :D)

majenkotech:
Of course, it could be that the display already has a resistor in there - some do.

Very unusual in the case of the commonly available LCD displays, not to.

I used a circuit like majenkotech suggest and I have it working.

@Paul__B: I did a automatic turn off of the backlight with time out and PWM and it's very nice.