Skip to main content
KAnahar
Associate III
August 10, 2022
Solved

STM32 DIMMER LEDS BRIGHTNESS

  • August 10, 2022
  • 2 replies
  • 2621 views

I have 36 leds on my board. I will connect dimmer my board. How can i adjust leds brightness with dimmer? Because i need to manage 36 output pins. How can i do it?

This topic has been closed for replies.
Best answer by Peter BENSCH

It depends on how your LEDs are controlled and how you feed the dim signal.

If, for example, one transistor is connected in series with each LED, this will lead to flickering at low duty cycles. To avoid this, take one constant current source per LED and short-circuit the LED with the transistor, which allows you to control the brightness between 0% to 100% without flicker. Disadvantage: the set current always flows per LED, only the LED voltage and thus the brightness is reduced to zero.

For brightness control, you can use one PWM channel per LED and transistor if you want to control all 36 LEDs independently.

Now you just have to find an STM32 with as many timers with PWM channels as you need for your 36 channels. And that is exactly what only the STM32H7 family can do at the moment, e.g. with the STM32H723ZG, with which 40 PWM channels can be realised (TIM1...5, TIM8, TIM12...17, TIM23...24).

I recommend using n-channel MOSFETs with a very low gate threshold as transistor switches, because they are directly 3.3V-compatible and their gate can be directly controlled by the PWM output.

Does it answer your question?

Regards

/Peter

2 replies

Peter BENSCH
Peter BENSCHBest answer
ST Technical Moderator
August 11, 2022

It depends on how your LEDs are controlled and how you feed the dim signal.

If, for example, one transistor is connected in series with each LED, this will lead to flickering at low duty cycles. To avoid this, take one constant current source per LED and short-circuit the LED with the transistor, which allows you to control the brightness between 0% to 100% without flicker. Disadvantage: the set current always flows per LED, only the LED voltage and thus the brightness is reduced to zero.

For brightness control, you can use one PWM channel per LED and transistor if you want to control all 36 LEDs independently.

Now you just have to find an STM32 with as many timers with PWM channels as you need for your 36 channels. And that is exactly what only the STM32H7 family can do at the moment, e.g. with the STM32H723ZG, with which 40 PWM channels can be realised (TIM1...5, TIM8, TIM12...17, TIM23...24).

I recommend using n-channel MOSFETs with a very low gate threshold as transistor switches, because they are directly 3.3V-compatible and their gate can be directly controlled by the PWM output.

Does it answer your question?

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
gregstm
Senior II
August 13, 2022

You can DMA to the io pins (using a circular buffer, sending to GPIO output register). I controlled 48 Leds (16 RGB Leds) this way using a STM32L4 (100 LQFP package). But this was to provide independent brightness levels to each individual Led.

But if all Leds are dimmed together (synchronised), then you probably only need a single FET to sink all the Leds current, and use that FET to control the brightness (PWM)