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
You’ll need to use a transistor (bipolar or FET) in order to use PWM to control the brightness.
stephen
stephen
stephen
stephen
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.
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.
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
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?
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)
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.
I ended up with the following:

- ILI9341-Backlight-PWM-control.png (11.86 KiB) Viewed 1931 times
<…>
So far, everything seems to be working fine ![]()
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
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 ![]()
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
![]()
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.


