luisllamasbinaburo / Arduino-BTS7960

Arduino library to control the BTS7960 Dual H-Bridge, that can drive DC-Motor up to 43A
https://github.com/luisllamasbinaburo/Arduino-BTS7960
Apache License 2.0
29 stars 19 forks source link

Feature Request: Ability to set Arduino Timer frequency to prevent motor whine #2

Closed JJFourie closed 4 years ago

JJFourie commented 4 years ago

The default Arduino PWM frequency is quite low, causing motor whine in DC motors at lower duty cycles. This can be avoided if the PWM frequency is increased (to e.g. around 20kHz), and can be done on some Arduino boards by changing the related timer frequency of the used PWM pins. There are already existing libraries (e.g. https://github.com/terryjmyers/PWM) that can do this, but it seems fit that this library can set the frequency as well.

luisllamasbinaburo commented 4 years ago

A library that controls a motor shouldn't change Timers but it's own, because it cause problem with another parts of the user program. User can modify timers (and I agree that probably he should do that) if he want, but it's out of scope of this library