I'd probably pass the motor control task to a microcontroller. The high level program on the Pi can deal with the GUI and calculating the desired speed of the motors. The micro receives updates for motor speeds from the Pi, plus "keepalive" packets so that it can kill the motors if the Pi goes away. It should probably also have its own watchdog timer turned on.
Then, on the micro, have a fast-running main loop and a timer interrupt (maybe 1ms intervals). When the timer interrupt fires it sets a flag. In the main loop, when the flag is set you have to make 10 decisions- step or do not step for each motor. Use Bresenham's algorithm, or just some sort of accumulator to make the decision. This could easily allow you to send stepping pulses up to 1000 times per second to a motor.
Incidentally, what step frequency would correspond to 90rpm on your motors?
Then, on the micro, have a fast-running main loop and a timer interrupt (maybe 1ms intervals). When the timer interrupt fires it sets a flag. In the main loop, when the flag is set you have to make 10 decisions- step or do not step for each motor. Use Bresenham's algorithm, or just some sort of accumulator to make the decision. This could easily allow you to send stepping pulses up to 1000 times per second to a motor.
Incidentally, what step frequency would correspond to 90rpm on your motors?
Statistics: Posted by ame — Sat Sep 28, 2024 4:42 am