PWM ILI9341 backlight control?

Kenjutsu
Mon Aug 31, 2015 11:10 am
Hello everyone,

I want to use PWM to control the brightness of a ILI9341 display. Can I simply connect the backlight pin of the LCD to a PWM pin on the STM32?

Thank you


RogerClark
Mon Aug 31, 2015 11:17 am
I think this has been tried before and the current required to run the backlight is far too much for a single pin on the STM32.

You’ll need to use a transistor (bipolar or FET) in order to use PWM to control the brightness.


victor_pv
Mon Aug 31, 2015 11:41 am
I would use a mosfet.

zmemw16
Mon Aug 31, 2015 11:42 am
maybe add a current limiting resistor just in case?
stephen

mrburnette
Mon Aug 31, 2015 11:51 am
zmemw16 wrote:maybe add a current limiting resistor just in case?
stephen

zmemw16
Mon Aug 31, 2015 7:13 pm
load maybe ( load | (resistor + load) | (load +polyfuse)) & !(dead board)

stephen


ahull
Mon Aug 31, 2015 9:29 pm
zmemw16 wrote:load maybe ( load | (resistor + load) | (load +polyfuse)) & !(dead board)

stephen


madias
Mon Aug 31, 2015 10:36 pm
I’ve another question related to all those ILI9341 TFT modules (I own many different ones and didn’t found any datasheet of them (the module not the ILI!):
I’m right, that the backlight LED connector is for 3.3V and NOT for 5V? I found out that on the “bigger” TFT modules (2.6inches) the LED backlight is really weak only putting 3.3V on it.

mrburnette
Mon Aug 31, 2015 10:45 pm
madias wrote:I’ve another question related to all those ILI9341 TFT modules (I own many different ones and didn’t found any datasheet of them (the module not the ILI!):
I’m right, that the backlight LED connector is for 3.3V and NOT for 5V? I found out that on the “bigger” TFT modules (2.6inches) the LED backlight is really weak only putting 3.3V on it.

Kenjutsu
Tue Sep 01, 2015 7:41 am
Thanks Ray!

I tested the circuit with a normal LED at first, but for the life of me, I can’t figure out how to connect the LED pin of the ILI9341 module to the NPN transistor :o

Should I connect the collector of the transistor to Vcc, and the emitter to the LED pin on the module? My reasoning is that the LEDs on the module are already grounded, so the current must flow from the collector into the the LED pin of the module via the emitter to complete the circuit for the backlight LEDs. Am I correct?


RogerClark
Tue Sep 01, 2015 10:02 am
You’ll need a PNP transistor or a PChannel FET

The designs posted only work if you have the load between the Collector and Vcc (or the FET equivalent )

But in the ILI9341 you only have access to the line that goes to supply, and you can’t connect that to the emitter as it won’t work

So I think you will need to use a PNP transistor and also bear in mind when using a PNP that the on / off will be inverted. i.e when you pull the base down to LOW (towards 0V) it will turn On the PNP transistor (and vice versa)


ahull
Tue Sep 01, 2015 10:17 am
This problem (LED cathode tied to 0V) is discussed here and here. Roger’s answer is correct, but more details in the links. Something like the ubiquitous 2N2907 or perhaps for our European readers, a BC556 or similar would do the trick. For completeness this article shows how to use a p chennel mosfet high side switch.

If you want to know more about using mosfets this is a good in depth article. There are a lot of logic level mosfets around designed for this kind of task, but for the purposes of this exercise I would stick with a pnp transistor, cheap and simple.


Kenjutsu
Tue Sep 01, 2015 1:23 pm
Thank you everyone ;)

I ended up with the following:

ILI9341-Backlight-PWM-control.png
ILI9341-Backlight-PWM-control.png (11.86 KiB) Viewed 1931 times

mrburnette
Tue Sep 01, 2015 3:02 pm
Kenjutsu wrote:Thank you everyone ;)
<…>

So far, everything seems to be working fine :)


FurkanCetin
Sun Sep 20, 2015 8:57 am
Just saw the topic and wanted to post my solution if anyone is interested.

Most LCD modules with pcb, generally have a transistor handling the backlight stuff. However I bought ST7735 without its own pcb. I soldered the flex on a suitable DIP switch board. By using PWM on STM32F103, I successfully played with the backlight by using just one IRF540N without any resistor (First tested on a power led). It can work under very high voltage and current circumstances.

There is a photo on my post for anyone interested: My STM32 Smart Watch Project


ag123
Fri Apr 28, 2017 4:10 pm
omg, i happily connected my gpio pin to the led (backlight) pin on ili9341 :shock: :lol:
connected a 220 ohm series resistor but still using the gpio pin my guess is that brings it below 15ma within the max operating conditions 25ma
graphics are a good lot dimmer but still visible, may try the transistor way another time

a web search seem to speculate there is a tiny bit of series resistance
http://thebackshed.com/forum/forum_posts.asp?TID=8281
but it is a tiny little 4 ohm resistance, that would have driven a whopping 825ma with 3.3v :o

out of curiosity i measured the voltage across the 220 ohm resistor, it gives 0.64v
after the resistor across the led (backlight) to the ground pin 2.62 v
this gives a total voltage of 3.26v from the gpio pin
working that out seem to say that the led pin has a ~900 ohm series resistor
:?


david.prentice
Fri Apr 28, 2017 5:41 pm
White LEDs have a typical working forward voltage of 3.3V

Let’s just assume 3V to make the maths easy.
100mA would need a 3R series resistor. 25mA needs 12R.

If you are running the LEDs at low current, you approach the knee voltage e.g. 2.7V
So 47R would give 13mA. 220R might give 3mA or so. (as you have discovered)

I am not at a PC. PC13, PC14, PC15 can sink 3mA. Other pins are 20mA max although not advisable.

David.


Leave a Reply

Your email address will not be published. Required fields are marked *