I'm having trouble turning on my LCD backlight with my Arduino Uno. The LCD I'm using is a standard 16x2 HD44780 compatible display and according to its datasheet needs between 80 and 120 mA of current for the backlight. As the I/O pins on the Arduino Uno can only supply 40 mA of current I am trying to use a standard 2N2222a transistor to turn on the backlight.
I've attached the positive pin of the backlight (pin 15 on the LCD) to 5V via a 100 Ohm current limiting resistor. I've attached the negative pin of the backlight (pin 16 on the LCD) to the collector of the transistor. I've attached the base of the transistor to a digital pin on the Arduino Uno (pin 1) via a 15 KOhm resistor. I calculated this base resistance assuming a collector current of 100 mA and a DC current gain of 300 (the maximum current gain specified in the transistor datasheet). The emitter of the transistor is connected to ground.
When I power up my Arduino Uno and run an LCD test program the LCD displays ASCII text fine, but the backlight doesn't come on despite the fact that I've set up this circuit.
I've verified that I'm getting 5V on pin 1 on my Arduino Uno so there should be a voltage across the base of the transistor. I've also verified that the LCD does indeed have a backlight. I think I've gone wrong in designing my circuit but I just don't understand where.
Change the base resistor to 1k.
A gain of 300 might be a gain of 50 at that current.
You should have ~0.65volt at the base, and even less at the collector.
Leo..
I've got the backlight working now! I foolishly didn't realise that the two power rails on my breadboard were separated in the middle, so I wasn't supplying 5V to the backlight.
Also, the backlight seems to come on when connected directly to 5V. There must be an onboard transistor to boost the current, so I guess I don't need the external transistor after all.