I want to manage an LCD HD44780 display connected trought my Raspberry Pi B+.

The backlight pin (on Hd44780 display) need a resistor and I have 2 different display version, so the resistor value are little different.

To avoid changing resistor value every time I change display, I heard that is possible to control GPIO pin output voltage. So I'll adjust the voltage output according to the display connected.

Is there a python script or something else to do that? Maybe like this:



Display datasheet

As mentioned in answers and comments, the problem is to control the LCD backlight using GPIO pin, without resistor, maybe doing it with PWM pin.


  • Tell us more about the specs of the 2 different resistors - and if possible, the input spec for the backlight pin. There might be a common resistor value that would work for both. I'm not aware of the ability to change the output voltage of a GPIO pin - you can vary the power of the pin through PWM but not the specific voltage - that would require a DAC output pin.
    – Phil B.
    Commented Sep 11, 2015 at 22:46
  • You can use PWM to vary the backlight intensity. I've used the technique on the backlight LEDs of a TFT display. That's probaly what @xPino saw. It is certainly worth trying
    – joan
    Commented Sep 12, 2015 at 7:34
  • @joan any experience with python code to use PWD? thx
    – xdola
    Commented Sep 13, 2015 at 13:32
  • @xPino All the Python modules will have a PWM function, the name and how it is used will depend on the module you want to use.
    – joan
    Commented Sep 13, 2015 at 13:38

2 Answers 2


In general, no - GPIOs don't have a variable voltage output. If they did, we'd call them a DAC.

As suggested by xPino, you might be able to use a PWM pin - but I suspect that the backlight pin on the LCD is going to have higher current requirements than can be provided by a GPIO (or PWM) pin on the Broadcom. You'll have to look at the LCD datasheet to find out.

  • I've edited my question with datasheet: I can't find the infrmation about backlight. BTW thanks
    – xdola
    Commented Sep 13, 2015 at 13:31

As the PWM pin probably doesn't supply enough current for the display, you can connect the pin to a transistor or MOSFET which in turn switches the backlight on and off very quickly to compensate for the different resistances.

If manual control is fine, you can also connect a potentiometer to the backlight and control the brightness by adjusting it manually.

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.