1
\$\begingroup\$

I need to generate 30 PWM outputs with a frequency of about 20 kHz. I need to control the duty cycle of each PWM output.

It is a bit too much to be reasonably done on a MCU (I usually work with STM32 microcontrollers) because the MCU has to communicate with other components as well. I was thinking there would exist multi-channel PWM drivers, but the ones I have found (LT8500, PCA9685) cannot go as high as 20 kHz and I cannot accept a frequency lower than 20 kHz.

One solution would be to add a second microcontroller so that I could handle all the outputs with 2 MCU. But that means I need to develop two firmwares and a communication protocol between the 2, which is a bit of work.

What other options could I consider in such a situation?

Thanks. :)

\$\endgroup\$
4
  • 1
    \$\begingroup\$ How fast do you need to update the duty cycles ? \$\endgroup\$
    – tobalt
    Commented Nov 25, 2021 at 16:20
  • \$\begingroup\$ Maybe a PWM multiplex driver like the tlc6948 that uses a high PWM clock. \$\endgroup\$ Commented Nov 25, 2021 at 17:24
  • \$\begingroup\$ I think you shouldnt rule out MCUs just yet. For example STM32F103 can have up to 32 PWM outputs (if I counted them correctly). \$\endgroup\$
    – Rokta
    Commented Nov 25, 2021 at 21:08
  • \$\begingroup\$ Microcontroller with lots of PWM outputs \$\endgroup\$
    – J...
    Commented Nov 25, 2021 at 22:59

2 Answers 2

3
\$\begingroup\$

Probably the simplest approach (in terms of hardware) would be to use an FPGA. Something simple like SPI to send the PWM duty cycles.

But if you're concerned about having a second (similar) MCU and some simple communication, you may not much like the learning curve. The code itself would be pretty simple once you're up to speed.

\$\endgroup\$
2
\$\begingroup\$

A small FPGA would be the simple solution, but if you want to avoid it here is an analog alternative, which would work if you need to update the duty cycles only rarely / slowly:

Use some DACs, which can be controlled by the MCU. Then you would have 30 DC output voltages. Afterwards you can convert those 30 voltages to 30 PWMs using 30 relaxation oscillators which are simple to build using one comparator each:

schematic

simulate this circuit – Schematic created using CircuitLab

With these components and a 3.3 V supply, the toggle frequency would be approximately 100 kHz.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.