# Controlling a 4.2V LED (LCD backlight) with a microcontroller

I have a PQC1602K-SYL alphanumeric LCD display with a backlight LED. I would like to drive the LED using a microcontroller pin. How can I achieve that?

## What I have tried

According to the data sheet, the LED requires 4.2 V and 100 mA.

My circuit works on 5 V, therefore I need to drop the voltage to 4.2 V. Using Ohm's law I have calculated that I need a 8 Ohm resistor, assuming 100 mA go through the LED. If I connect the LED directly to the supply, like in the following circuit, the LED turns on at full brightness. I measured the current that goes through the LED and I get about 85 mA. I am not sure why it is not closer to the specified 100 mA, though. simulate this circuit – Schematic created using CircuitLab

I can't substitute the power supply with the microcontroller's output pin because the 100 mA (or 85 mA ??) are more than the pin can supply, therefore I need some kind of buffer. I believe that a common solution is to use a transistor using a connection simmilar to the circuit below. However, my knowledge of transistors is very limited and rusty. I have tried to calculate the values of the resistors using Kirchoff's laws but I could not reach any meaningful solution. I then tried experimentally with some NPN transistor I had lying around and I managed to reach the desired voltage by completely removing the resistors, but I only get 30 mA through. simulate this circuit

• Swap the transistor and the LED in your schematic. – pjc50 Oct 24 '13 at 14:10
• Where did you find this information in the data sheet? – Botnic Oct 24 '13 at 14:16
• @Botnic : Err, the site where I downloaded the datasheet is down. I linked to another data sheet that I assumed was the same, but apparently it is different! When I get home I will upload the data sheet somewhere and update the links. – Antoine Aubry Oct 24 '13 at 14:33
• @pjc50 : Why would swapping the transistor and LED make a difference? From what I understand the current that goes through the LED will be slightly higher due to the current entering the base, but I expect that current to be negligible. Am I wrong? – Antoine Aubry Oct 24 '13 at 14:35

One reason you see less than 100mA when you connect the display up to a 5V supply through an 8 ohm resistor is because the forward voltage of the back light LED is higher than the 4.2V level. Another reason could be due to the meter that you put in series to measure the current. Meters generally measure current by looking at the voltage drop across a small value resistor and you would have effectively placed that resistance in series with the 8 ohms and thus reducing the current some amount.

For the buffer circuit try connecting it up like this: This will allow the MCU to switch the NPN transistor on and off successfully. As you had it drawn before the LED back light load was being operated as an emitter follower. In such configuration the load was seeing a voltage that was at least a Vbe drop lower than the voltage the MCU pin was placing on the base circuit of the transistor.

With it redrawn as I've shown it the MCU can saturate the transistor and allow the collector circuit to sink the full current from the supply and through the LED and 8 ohm resistor.

If the MCU is able to place a 5V signal on its output pin then the base current of the transistor with 1K resistor will be:

Ibase = (5 - Vbe) / 1K = (5 - 0.7) / 1K = 4.3mA

The transistor current gain is Hfe. With a desired up to 100 mA of current in the collector the transistor will need an Hfe of at least this much:

Hfe = 100mA / 4.3mA ~= 23.

The transistor part numbers I have shown should have Hfe values that are higher than 23 and so the 4.3mA base current should allow the transistor to fully saturate.

One note is that this circuit is going to turn on the backlight when the MCU pin is placed into the high state. Thus logical '1' = High = On. Nice.

• I hadn't realized that there would be a significant difference if I placed the led on the emitter or the collector. Your explanation was very enlightening. I will try this when I get home and will accept this answer as soon as I am able to confirm that it works. Thanks! – Antoine Aubry Oct 24 '13 at 15:22