Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
939 views
in Technique[技术] by (71.8m points)

arduino - 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 previously: https://protosupplies.com/product/xy-lpwm-pwm-signal-generator-module/

It works great, but is bulky due to the screen and buttons which I don't really need. 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-10kHz
  • 5V preferably
  • Communication via tx/rx or other arduino compatible
  • 1-2 channels
  • 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)

question from:https://stackoverflow.com/questions/65840782/small-pwm-module

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...