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

Categories

0 votes
1.1k 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...