Answer the question
In order to leave comments, you need to log in
How to implement up to 40 PWM outputs from a microcontroller?
The challenge is to independently dim multiple LED strips.
The number of channels (tapes) for dimming is up to 40.
On the arduino mega, the number of PWM is 14. As the worst option, I consider software emulation of the missing PWM.
I ask for advice to solve the problem. Maybe you will advise a microcontroller that has as many PWM outputs or a multi-channel LED driver that can communicate with the MK or another option that I missed.
Answer the question
In order to leave comments, you need to log in
Option - PCA9685, a specialized controller specifically for LED. 16 channels per chassis, I2C control. 3 cases and 48 channels on 2 wires are ready. I think if you search for "pwm i2c controller" or "i2c led controller" you can find something more leggy.
For LEDs, it is not necessary to use hardware PWM, there is enough software for the eyes → you just need to take a microcontroller with a sufficient number of legs.
I would do this: the main timer quietly clicks, and in the interrupt it decrements all 40 counters (array), looks for zero values, inverts the corresponding legs and updates the value in the counter. Those. you will need: an array of 40 counters for the timer, an array of 40 values for the output == 1, an array for 40 values for the output == 0, an array of 40 flags (this will be faster than using bit masks, although, of course, at 100- 200Hz PWM anyway) to determine where to enter the value from when resetting the counter.
If we need to provide a frequency of at least 100Hz with an eight-bit resolution, then we will need to set the timer to 25600Hz. For one interrupt, at least 40 values will need to be processed, i.e. spend, say, 1-2 thousand cycles. Therefore, a simple STM32 at 72 MHz (with 16 MHz quartz) is enough for the eyes. Or something weaker...
You can assemble a matrix of optocouplers (for Atmega8 there will be 96 optocouplers (and 96 PWM channels)) and they already include keys on tapes.
And so, this is a task for a network of DMX controllers. This is if you're being serious.
for example
I used 5 pieces of STP24DP05 (24-bit constant current LED sink driver with output error detection) connected in series to one SPI for independent color control in a line of 40 RGB LEDs.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question