Search code examples
arduinopwm

Small PWM module?


I'm trying to find a fitting module/component for a project, but have a hard time finding the right thing.

I need a PWM module/component that can provide a PWM signal and can be controlled via Arduino, preferably TX/RX.

I've used this one previously, and it works great, but it is bulky due to the screen and buttons which I don't really need.

It would be perfect to find the same module but without the screen and buttons.

What it needs to do:

  • Duty cycle 0-100%
  • Frequency 1-10 kHz
  • 5 V preferably
  • Communication via tx/rx or other Arduino compatible protocol
  • 1-2 channels
  • As small as possible

I've seen some Adafruit modules, but they have at least 16 channels which is not necessary. Would also work, but if I can find an even smaller alternative that would be great.

Any suggestions?

(And no, the Arduino's PWM signals do not work in my case.)


Solution

  • The standard Arduino analogWrite() can't do what you want without trickery, but most Arduino hardware can, so there's no real need for a separate PWM IC or module; you just need to code the Arduino's MCU's timer peripheral to do what you want.

    You can do that "by hand", but I would try first to see if an alternative library like TimerOne can get you the PWM you specify. For SAMD21-based Arduinos there is this library (that I wrote), among others.

    If you insist on having a separate module for your PWM, just google around (modules exist, but recommendations are not done here), or simply use a second Arduino of your choice as a dedicated PWM generator.