Extending available outputs with 20+ kHz PWM

Hello,

First of all, sorry if the wording is not correct, my background and all work experience is basically mechanical engineering and I just started venturing on electronics.
I'm trying to control several solenoids at once, around 40, I adjusted the PWM frequency to be higher than 20 kHz so there would be no whining, and they are actuated with different voltages, so they output different forces, I'm overvoltaging then for no more 10-20 mS at a time. It works perfectly fine when I'm using it directly from the pins. But as you know, there is a limited number of pins on any Arduino.
I've been trying to use the shiftPWM library by Elco Jacobs, but I don't know if it is the right approach for it, since I've been having a hard time to make it work for higher PWM frequencies and then this whining is always there.
My question is, does anyone have more experience using that said library and can point if that library and shift registers are suited for that application. If not, what would be the best approach to do it and to be able to control all outputs at once?

Hi, @sivinc
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".

This will help with advice on how to present your code and problems.

Google;

arduino pwm expander

The expander provides extra PWM pins on another board that you control with the Arduino.

What model Arduino are you using?

There are a number of tutorials showing you how to use them.

Tom.... :smiley: :+1: :coffee: :australia:

2 Likes

Thanks for the welcome!

I'm using an Arduino Leonardo for that (I've been playing around with a Teensy 3.5 as well, as it has more PWM-able pins).
I thought of that and I came across this Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface [PCA9685] : ID 815 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits which has can only go up to 1kHz and therefore, wouldn't suffice.
And I found also this one TLC5940 data sheet, product information and support | TI.com but it also has a limited operating frequency.
What I have in mind, which I want to avoid, is to use some sort of CAN bus communication between multiple MCUs, but it will grow in complexity and I think that is avoidable.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.