D
D
Dare2015-03-04 12:21:06
Arduino
Dare, 2015-03-04 12:21:06

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

6 answer(s)
V
Vladimir Martyanov, 2015-03-04
@vilgeforce

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.

E
Eddy_Em, 2015-03-04
@Eddy_Em

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...

A
Armenian Radio, 2015-03-04
@gbg

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.
620x400-2_32.jpgfor example

A
Alexey Kilin, 2015-03-13
@AlexeyKAM

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.

U
UA3MQJ, 2015-03-26
@UA3MQJ

- use 74HC595
- take FPGA

A
Alexander, 2015-05-14
@AlanDrakes

Try to read about Binary Angle Modulation - in fact, the same PWM, but software-based and not too demanding on resources.
easyelectronics.ru/upravlenie-bolshim-kolichestvom...
chipmk.ru/index.php/10-raznoe/10-programmnaya-real...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question