I am testing a lcd 16x2 whith msp430g2553. I am controlling the backlight by PWM signal. I am using the P2.4 as output generating a PWM signal. I have connected the anode directly to pin P2.4 of the microcontroller and the cathode directly to GND. In the datasheet, (msp430g2553 on page 24) specifies that the maximum output is 6 mA and, on the other hand, on the LCD datasheet, LCD Datasheet, on page 32, the typical consumption is 32 mA. So ... Why it works if you can only drain 6 mA? Would it be more correct to put a transistor as shown in this circuit?


simulate this circuit – Schematic created using CircuitLab

What should be the value of R1?(The battery voltage varies from 4.2 to 3.3V) I can not find that information in the LCD datasheet, surely because I do not know what parameters I have to analyze.

  • \$\begingroup\$ The 6 mA is a test condition for the specified voltage drop; the graphs on the next page show that you can suck out more current, at the cost of losing voltage. \$\endgroup\$
    – CL.
    Commented Jul 30, 2017 at 19:52
  • \$\begingroup\$ @CL - Thank you, you're right, I had not seen it. Anyway, I'm surprised it works because the voltage should fall well below 3V and therefore should not turn on the LCD backlight. \$\endgroup\$
    – FranMartin
    Commented Aug 3, 2017 at 15:30

1 Answer 1


The correct way to connect up the back light is the way that you show with the MOSFET. The IRLML2502 N-FET may be overfill in the max current ratings category but is still in a nice small SMT style case and should work very well for this application with a logic driving signal from an MCU with a 3.3V to GND swing.

Select the R1 value to limit the total current to the LCD back light to around 30mA to 35mA when the backlight is continuously on. Then the variable duty cycle of the PWM signal can reduce average current to a lower value. If you do not have data on the forward voltage drop of the backlight from A to K you can try connecting the backlight up to a variable bench supply and a series resistor. You can slowly increase the voltage whilst measuring the A to K voltage to see where it levels out as the supply voltage continues to increase.

To calculate R1's value you subtract the A-k voltage from your 3.6V battery voltage and then divide that by the 0.035A LED current. This will give the value in ohms for the series resistor.

The reason that the backlight seemed to work when you connected it directly to P2.4 was that the port pin was able to source some current to the backlight and the LEDs were able to light. But keep in mind that this was probably over stressing that port pin beyond its maximum ratings. That is why the MOSFET driver circuit is highly recommended. Once you get the PWM connected up in a manner so that the back light current can be at its max at near 100% duty cycle you will notice that the overall brightness of the backlight will not be at all linear with the PWM duty cycle.

  • \$\begingroup\$ One addition: You could consider to drive the MOSFET with a transitor circuit. This way you can be sure that you 'fully' turn on the MOSFET by using the power supply instead of the voltage of the microcontroller pin in order to raise the gate voltage. This enables you to use a lower voltage and still be capable of driving the MOSFET. \$\endgroup\$
    – Weaverworm
    Commented Jul 31, 2017 at 7:26
  • 1
    \$\begingroup\$ @Weaverworm - In the case of the OP using the IRLML2502 N-FET there is no need to use a second transistor to drive the GATE. This particular part is speced to give an Rds(ON) of max 0.080 ohms with a Vgs of 2.5V and a Id of 3.6A. Like I said in my answer already the FET is actually a little overkill for this application but will work nicely. At the mild level of backlight current that the OP has mentioned they could even just directly use a lower cost NPN like a 2N2904 instead of the FET. But this is a pretty nice small package logic level MOSFET!! \$\endgroup\$ Commented Jul 31, 2017 at 9:21
  • \$\begingroup\$ @MichaelKaras - Thank you for your complete answer. At last I have been able to see the forward voltage. From 2.5V you can start to appreciate that the LEDs illuminate. The source voltage and the A-K grow similarly up to 2.7-2.8V. Thereafter the brightness of the LEDs is already very strong and the value of the voltage of the source separates (growing much faster) than the voltage A-K. With these measured voltage values. With a 3.6V battery and taking 2.75V as the A-K voltage, a 27 ohm resistor should work. It is right? I think it's a very low value. Thanks again. \$\endgroup\$
    – FranMartin
    Commented Aug 3, 2017 at 16:26
  • \$\begingroup\$ @FranMartin - You have to select the series resistor to limit the current into the backlight LEDs. You should probably be thinking in terms of maximum current allowed and considering the maximum source voltage and the minimum Vf for the LEDs. The formula becomes Rseries = (VsourceMax - VfLEDmin)/ImaxLED. \$\endgroup\$ Commented Aug 3, 2017 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.