Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8082

HATs and other add-ons • BuildHAT motor control is unreliable

$
0
0
I have a BuildHAT with a connected Technic Large Motor 88013 and I am having a hard time making it work reliable. Just a few examples:

* When running start(50), stop, start(-50), the motor will sometimes still run in the positive direction for a bit when start(-50) is called. This does not always happen, but most of the time.
* This even happens across program executions. The motor or BuildHAT seems to have some kind of memory. If the motor was running in positive direction when running program 1, it will continue in that direction for a bit when a new program is started that wants to run in negative direction (note that stop was called and the motor fully stopped at the end of the first program)
* I am missing documentation on many methods. How does bias() work? What is combimode? What is the difference between callback and when_rotated? https://buildhat.readthedocs.io/en/late ... motor.html

Is this because of the motor I am using? I don't have any of the Spike Prime motors, so I can't check if these work better.

Just a bit of example code:

Code:

from buildhat import Motorimport timedef main():    """Main entry point for the sortbuildbot application."""    motor = Motor('A')        print(f"Starting 50")    motor.start(50)    time.sleep(5)    print(f"coast")    motor.coast()    time.sleep(5)    print(f"Stopping")    motor.stop()if __name__ == "__main__":    main()
When running this code:
* The motor will run for 5 seconds
* During the coast phase, the motor stops. It is not clear of the motor is actually coasting. Quite a bit of force is needed to turn the motor by hand.
* When stop is called, the motor starts to turns for a second before stopping.

Statistics: Posted by pbackx — Wed Sep 24, 2025 7:39 am



Viewing all articles
Browse latest Browse all 8082

Trending Articles