Skip to content

Add Recirculation Current Decay Mode Setter/Getter #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Mar 18, 2021
Merged

Add Recirculation Current Decay Mode Setter/Getter #54

merged 10 commits into from
Mar 18, 2021

Conversation

CedarGroveStudios
Copy link
Contributor

@CedarGroveStudios CedarGroveStudios commented Mar 14, 2021

Added the ability to selectively change DCMotor's default FAST_DECAY recirculation current decay mode (coasting mode) to SLOW_DECAY mode (braking mode) to significantly improve motor performance and throttle/speed linearity. For integrated motor controllers such as the TB6612 and DRV8833, switching to SLOW decay mode also reduces sensitivity to higher (>500Hz) PWM frequency. When coupled with a lower PWM frequency such as 25Hz, SLOW_DECAY mode increases torque at low motor speeds and contributes to a very low spin threshold speed.

FAST_DECAY will remain as the default decay mode for compatibility.

Usage example:

motor3.decay_mode = motor.FAST_DECAY  # set fast decay (coasting) mode
motor4.decay_mode = motor.SLOW_DECAY  # set slow decay (braking) mode

The braking mode change was successfully tested with TB6612 and DRV8833-based motor controllers (Crickit, MotorWing, MotorSheld, and various breakouts) as well as discrete h-bridge circuitry (such as L9110) using CircuitPython 6.1.0.

After this PR is finalized, I will completely rewrite the Improve the Low Speed of Brushed DC Motors learning guide to elaborate on the new recirculation current decay mode improvements.

A big thank you goes to @ZodiusInfuser for the initial idea thread and subsequent discussions.

(reference: https://github.com/adafruit/Adafruit_CircuitPython_Motor/issues/53

Add recirculation current decay mode to throttle control; add decay mode setter/getter; default to fast decay (coasting mode) to preserve performance of legacy applications
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor thing. Looks good otherwise. Thank you!

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, one more thing to improve the docs. Thanks!

Co-authored-by: Scott Shawcroft <scott@tannewt.org>
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt tannewt merged commit a9ef35b into adafruit:master Mar 18, 2021
@CedarGroveStudios
Copy link
Contributor Author

Thanks for your help, @tannewt!

adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Mar 20, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI to 3.5.7 from 3.5.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#128 from adafruit/anecdata-patch-2
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#126 from adafruit/anecdata-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_LTR390 to 1.1.0 from 1.0.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_LTR390#3 from CedarGroveStudios/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font to 1.3.7 from 1.3.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_Bitmap_Font#41 from jepler/use-bitmaptools-readinto

Updating https://github.com/adafruit/Adafruit_CircuitPython_datetime to 1.1.2 from 1.1.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_datetime#7 from brentru/fix-failing-tests
  > Merge pull request adafruit/Adafruit_CircuitPython_datetime#6 from cognitivegears/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_ImageLoad to 0.14.0 from 0.13.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_ImageLoad#45 from kmatch98/master
  > "Increase duplicate code check threshold "
  > Merge pull request adafruit/Adafruit_CircuitPython_ImageLoad#46 from adafruit/tests-linting

Updating https://github.com/adafruit/Adafruit_CircuitPython_Logging to 1.2.8 from 1.2.7:
  > Merge pull request adafruit/Adafruit_CircuitPython_Logging#18 from dastels/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_Motor to 3.3.0 from 3.2.8:
  > Merge pull request adafruit/Adafruit_CircuitPython_Motor#54 from CedarGroveStudios/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants