Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: TFT PWM Backlight

  1. #1

    TFT PWM Backlight

    Up to yet, I have never had a requirement to use PWM so know virtually zilch about it. I now have a requirement but have a few questions.

    I need to control the brightness of an Adafruit 1.8 TFT display backlight. The display has a ‘lite’ pin on it which it says tie to 3.3v for maximum brightness, or tie to GND or leave unconnected to turn backlight off.

    I want to be able to make the brightness user controllable and the data on the TFT display says that the ‘lite’ pin can be controlled with PWM.

    Now, what is the best way to do this with the Teensy. I am guessing that I cannot just connect a Teensy PWM pin directly to the ‘lite’ pin and purely issue the commands needed. The display data sheet says that the TFT display consumes around 25ma with the backlight at full brightness and the backlight uses the majority of the power requirement, it doesn’t say what the backlight consumes on it’s own but I am guessing it is far too much for the maximum output of a Teensy PWM pin.

    So what is the recommended way of doing this to make it work?

  2. #2
    Senior Member
    Join Date
    Apr 2013
    The teensy will not like directly driving 25mA worth of LEDS, but all of the TFTs I have around have a transistor on the backlight pin to make it easy to drive in this situation. Suggest connecting a 1k resistor to the backlight pin and connecting that to 3.3V and seeing how bright the backlight comes on (or just meter the current on the pin). If it is at or near full brightness you have some form of switching going on and can directly use a Teensy pin with PWM capability to drive it. If it is barely visible you will need to come up with switching of your own via transistors.

  3. #3
    Senior Member
    Join Date
    Apr 2017
    I've controlled display brightness with my 2.8" TFT displays, and it is that easy. Just connect a PWM capable pin from your teensy to the lite pin on the display (my displays usually say LED for the brightness control pin), then add a line of code to set the pwm value. Note the display may consume 25 ma but the light pin i believe is signal only. At least that is the case for my displays. To set the pwm level use this code:

    Many of my projects I also have touch screen working where the user drags a finger up or down the display to control the brightness.

    // val = 0 to 255
    analogWrite(LED_PIN, val);

    Hope this helps.

  4. #4
    Thank you very much for your replies. I should have read the data sheet a bit more thoroughly, it does state that the backlight is transistor driven. I plugged a PWM pin straight in to it and it worked straight away.

    The only thing I do notice is that there is not really any big decrease is brightness until I get down to a value of about 60 and then it dims quite quickly down to invisible almost at about 5. From 60 upwards, there is no real difference in brightness. It does dim a bit but very slightly above 60.

  5. #5
    Senior Member
    Join Date
    Apr 2013
    The brightness changes being minor at the top end is a result of how human vision works on a log scale, possibly complicated by real world vs theoretical response by the transistors and LEDS in the LCD.

    With a PWM value of 254 to 255 there is less than a 0.5% difference in light level. Between PWM value 1 and 2 there is a doubling in value which is much more noticeable. There are various solutions involving lookup tables with some form of log rate stored, or you can step using doubling or squaring though this requires special handling at the bottom of the scale (0*2 and sqr(0) both==0).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts