How bad it is to power LCD backlight from MCU IO? - Page 1
Forum section: electronics / projects

author: 3dgeo
author_rank: Frequent Contributor
timestamp: March 12, 2020, 02:04:34 pm
content: Hi,I want to cut some components from BOM, so I thought could I just power80x160 px LCDsbacklight directly from STM32F411 IO pin, how bad of the ide it is?I want to have a way to turn LCD off.Ussualy this LCD is powered like this:But according to LCD datasheet backlight takes 15mA:And STM32F411 IO is capable sunking/sourcing up to 25mA:So here I'm...There will be no other high power demand from MCU IO, logic only.

author: madires
author_rank: Super Contributor
timestamp: March 12, 2020, 03:14:42 pm
content: Should work fine. One disadvantage could be the impact of the PWMed current on sensitive MCU functions like the ADC.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: March 12, 2020, 03:30:31 pm
content: Quote from: madires on March 12, 2020, 03:14:42 pmBy "PWMed current" you mean backlight PWM? Would be nice feature to use PWM on BL to dim the screen...Anyway, not using any analog stuff, only digital IO (regular digital IO, I2C, SPI).

author: madires
author_rank: Super Contributor
timestamp: March 12, 2020, 04:01:10 pm
content: Yes, I meant backlight PWM. And don't skimp on bypass caps.

author: SiliconWizard
author_rank: Super Contributor
timestamp: March 12, 2020, 04:06:09 pm
content: Just a thought - given the typical Vf of 3V (what about dispersion?), this is close to a 3.3V rail. There's bound to be some dispersion in backlight brightness from one unit to the next unless you can sort of adjust it. It may not matter if you're building just one unit or if you don't care about that as long as it's just lit up.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: March 12, 2020, 04:46:15 pm
content: Quote from: SiliconWizard on March 12, 2020, 04:06:09 pmWhat amount we are talking about? If it's less than 10% than I dont care, but it's not one off product, at least I hope it isn'tHow to avoit it?

author: Tomorokoshi
author_rank: Super Contributor
timestamp: March 12, 2020, 05:30:47 pm
content: Actually, I would leave the circuit, and put a transient suppressor on the base of Q2. One route to damage is that someone could get a static charge built up, touch the display, and have a discharge path directly to the processor.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: March 12, 2020, 05:40:16 pm
content: Quote from: Tomorokoshi on March 12, 2020, 05:30:47 pmLCD will be covered by 2mm tansparant acrylick glass, so I doubt there will be any static charge issues.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: March 12, 2020, 06:17:15 pm
content: Quote from: madires on March 12, 2020, 04:01:10 pmOh I'm not going to, I have 4 bypass caps (near every MCU VCC).

author: SiliconWizard
author_rank: Super Contributor
timestamp: March 12, 2020, 06:18:09 pm
content: Quote from: 3dgeo on March 12, 2020, 04:46:15 pmWell, I can't tell exactly how much without having any more info on the backlight LED(s)...Quick example though: let's say Vf = 3.0 +/- 0.1V, so 2.9V <= Vf <= 3.1V (which doesn't seem that unreasonable.) Neglecting the error on the resistor and the 3.3V rail here.Then ~ : 9.1mA <= If <= 18.1mA (@3.3V supply) Looks pretty bad.The only simple way of reducing the error would be to increase the voltage at which you power the backlight.For instance, @5V now (with a 150ohm res.) : 12.7mA <= If <= 14.0mA, which is not nearly as bad.Of course, generating an additional rail just for this may be inconvenient. But if you have a +5V already available somewhere...Another way would be to add a constant current source instead of just a series resistor, but that will just add more parts (which you were trying to avoid.)And maybe I'm just being overly cautious and dispersion on Vf (or at least the impact of If on actual brightness) is not that bad.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: March 12, 2020, 07:27:15 pm
content: Quote from: SiliconWizard onTodayat 06:18:09 pmNo, I'm really glad You bring this up! This was my goal – to find out things I don't know, I'm extreemly thankful for bringing things like this up, You people are awesome! Thank You!I have 5V rail, I just wanted to see if I can reduce BOM. Well, I have free 10K resistor in a resistor array, and I already have 1.5K and 22R resistor in the BOM, so extra cost would be for extra transistor and 3 PnP parts.Anyway, despite LCD brightness power from IO circuit should work and shouldn't give me any other issues?I guess I'll do what I planned to do – I'll make modular PCB prototype where I can jump jumpers and test all powering options...

author: tooki
author_rank: Super Contributor
timestamp: March 12, 2020, 08:43:16 pm
content: Quote from: madires on March 12, 2020, 04:01:10 pmJust FYI, PWMing the backlight can cause some weird flickering effects on some LCDs, if the backlight and the LCD refresh rate happen to interact in unfortunate ways. I saw it when experimenting with a 1602 character LCD.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: March 12, 2020, 09:00:06 pm
content: Quote from: tooki on March 12, 2020, 08:43:16 pmYes, I see how this can happen, but it's easily fixable by changing PMW frequency. I'll test it, but the sceen is small and not that bright anyway, so dimming BL is not that nescesary feature, I'm OK with it being ON or OFF only. I might drop this feature entirely and just connect it straight to 5V and be done with it. But I want to explore all options first...

author: Siwastaja
author_rank: Super Contributor
timestamp: March 12, 2020, 09:51:47 pm
content: Also note the IO pin equivalent DC resistance is uncontrolled and varies somewhere between maybe 10 and 30 ohms depending on unit, temperature, etc. This will be in series with any external resistance.OTOH, it can work out to be somewhat self-regulating: if the particular LED Vf is lower than you expect (a low Vf unit, or hot LED temperature), it draws more current, causing more heating in the MCU IO MOSFET, heating it up, causing the IO pin resistance to go up, lowering the current. Such a negative Rds(on) feedback loop can compensate for the positive feedback loop of the LED Vf per temperature.Of course, do the IO pin current draw analysis for the worst case Vf of the LED.Note that for better current regulation at Vled=5V and larger resistor value (as shown by SiliconWizard), you won'tnecessarilyneed external transistor: STM32 MCUs have IO pins which are 5V tolerant and have the open-drain output mode. I tend to use that when directly powering low-current LEDs with Vf too close to 3.3V.If you decide to not use the IO pin to power the display directly, the transistor route isn'tthatmuch better; it's extra parts, and it's still kinda sucking at current regulation. Consider using a constant-current linear LED driver with enable pin instead: these are cheap and come in tiny packages, and the part count will be lower because no resistors are needed at all. They tend to come with some fixed current settings like 10mA and 20mA.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: March 12, 2020, 11:51:30 pm
content: You mean something likeNSI45015WT1G?If so they cost 6cent in quantity and -+20%, that means 12 to 18mA – doesn't look very accurate as well...

author: Siwastaja
author_rank: Super Contributor
timestamp: March 13, 2020, 12:17:57 pm
content: Yes but it's guaranteed range of actual current regulation, regardless of LED Vf and supply voltage variation.Do the actual analysis for the resistor solution and you may be surprised how hard it is to guarantee an accurate LED current unless you havea lotof voltage to drop over the resistor. For example (made up numbers to show the point):Nominal design:Vsupply = 5.0VVf=3.0VR = 133 ohmsIled = 15mAWorst case max current:Vsupply = 5.0V + 4% (typical 7805-style linear reg) = 5.2VVfled = say 2.6VR = 133 ohms - 5% = 126 ohmsIled = 20.1mAWorst case min current:Vsupply = 5.0V - 4% (typical 7805-style linear reg) = 4.8VVfled = say 3.4VR = 133 ohms + 5% = 140 ohmsIled = 10.0mASo suddenly 12.0mA to 18.0mA starts looking appealing.Note that far too often, LED Vf range is not properly rated at all (only typical condition given). Also note even if the min,max range is tabulated, it's only the unit variation at a specific temperature, and you need to add the temperature coeff on the top.Though, all of this likely won't matter. The backlight brigthness is not that different at 10 or 20mA. Just make sure you won't exceed the maximum.But clearly, if you do this analysis with the 3V3 supply, it's a definite no-go. It may still practically work, especially for one-off, but that's design by luck. That's why I tend to drive blue, white, or high-brightness green LEDs that require Vf=3V-ish, using the 5V tolerant open-drain IO pins; red, yellow etc. at below 2V work fine with a series resistor from the 3V3 output.

author: Chalcogenide
author_rank: Regular Contributor
timestamp: March 13, 2020, 12:41:41 pm
content: I think you could just run the LED with the anode connected to the +5V supply, and its cathode via a resistor to your MCU IO pin. If you set your output high, at 3.3 V, the LED will stay OFF (it's only seeing a 1.7 V forward voltage, nowhere near enough for it to emit any sort of measureable light output) and your IO pin will be kept at 3.3V which is safe; to turn on the backlight, just set the pin low. You don't necessarily need open-drain, 5 V tolerant pins to get this to work, as long as the rest of your circuit on the 3.3V rail draws more current than what leaks through through the LED when OFF (otherwise the voltage on the 3.3V rail may rise, potentially causing issues. But that's quite unlikely with a single LED driven this way).

author: 3dgeo
author_rank: Frequent Contributor
timestamp: March 13, 2020, 10:25:31 pm
content: @Siwastaja:Very good point indeed!If I remember correctly absolute max is 25mA.My project will be powered by USB.Actually I have IS31FL3741 LED matrix driver on the PCB, but I can't use it cos it's a matrix driver...I can drive it from 5V, and yes, I understand how to make it work with MCU IO (open/drain config).This will not be a cheap product, I totally can use that constant current driver, it's just my OCD I guess to optymyze as much as I canAnd I rather spend few cents per PCB more than dealing with issues in the future...As I said I will make universal PCB prototype so I can test all posible options, tho I'm leaning to 5V, open/drain and NSI45015WT1G...

author: wizard69
author_rank: Super Contributor
timestamp: March 14, 2020, 04:21:06 am
content: You need to look at the spec directly below the one that you highlighted! The first thing you check obviously is the current handling capability of one pin! But that is only part of the chips power capability, since only you know what is connected to the other pins and the current draw there, we can't say if it is OK. For a backlight you should consider current draw to be continuous but we have no idea what the other pins are doing. 15ma is about 1/10 of your budget that can quickly escalate if you have other continuous loads.So yeah consider doing so but verify your overall load on the processor.Quote from: 3dgeo on March 12, 2020, 03:30:31 pm

author: TomS_
author_rank: Frequent Contributor
timestamp: March 21, 2020, 01:02:06 am
content: Quote from: 3dgeo on March 12, 2020, 02:04:34 pmBut dont disregard the total sink/source capability (the figures at the top of that table), and how the current requirements of the backlight might eat into the budget required for the rest of the chip and what ever else it is doing.