Skip to content
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

Fix stepper RPM issues with step(). #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

curtwelch
Copy link

@curtwelch curtwelch commented Apr 17, 2017

Arduino delayMicroseconds() doesn't work for values larger than about 16K and this
broke the step() delay calculation causing almost random speed results for many RPM
settings. Added longDelayMicrosecond() function to resolve this.

Also added timing of I2C overhead with delay time adjustments to allow RPM values
to be very close to what they are set for, even when I2C bus rates are changed.

Include of Adafruit_MS_PWMServoDriver.h changed in Adafruit_MotorShield.cpp to be
consistent with other uses. (not needed for RPM fix -- just seemed "broken" -- ok, it's risky changing something that isn't broken, I know).

I've tested this only an an Arduino Mega 2560 with a V2.3 Adafruit Motor control board.

Arduino delayMicroseconds() doesn't work for values larger than about 16K and this
broke the step() delay calculation causing almost random speed results for many RPM
settings.  Added longDelayMicrosecond() function to resolve this.

Also added timing of I2C overhead with delay time adjustments to allow RPM values
to be very close to what they are set for, even whem I2C bus rates are changed.

Include of Adafruit_MS_PWMServoDriver.h changed in Adafruit_MotorShield.cpp to be
consistent with other uses.
@mikefitzgib
Copy link

I ran into this same exact issue on an Arduino Uno with V2.3 Adafruit Motor Control board. Thanks for solving.

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