What is causing this discrepancy? We believe the problem may be with the I2C bus communication between the Pi and the HAT, as this can be measured within the program even when the power source is disconnected from the motors, and changing the baudrate to 400000 (from 100000) improves the accuracy slightly.
However, when we test the rpm both manually with a timer and within the program itself using time.time() before and after the call to move the motor, the measured RPM is consistently much lower than what we are aiming for. The motors have a step angle of 1.8 degrees, so 200 steps per revolution.Ī teammate and I have written a python program using the Adafruit_MotorHAT library in which the speed in RPM is set using tSpeed(60) (for example). I'm trying to drive some stepper motors using a Raspberry Pi 3 B V1.2 and an Adafruit Stepper Motor HAT v0.1 and am having trouble setting them to the speed I want.