Talking to Arduino over a serial interface is pretty trivial in Python. On Unix-like systems you can read and write to the serial device as if it were a file, but there is also a wrapper library called pySerial that works well across all operating systems. Continue reading Arduino and Python
Daily Archives: November 2, 2015
Move 4 Stepper Motors Synchronously
.
Part of the machine inside FreeCAD |
This is the algorithm that plans the trajectory and syncs the movements of the stepper motors, in the new CNC machine that I’m designing (and building!)
The input is an int array { MA, MB, MC, MD } where each int means the number of steps (positive or negative).
The stepper movement logic is stored into a boolean[8] array { SA, DA, SB, DB…. } where SA means step for motor A and DA is the direction bit of the motor A (for a 2 wire stepper driver, like the a4988). This array is erased and re-computed every loop cycle with the next movement, so real motor stepping has to take place inside this loop.
The image below (created with FreeCAD) shows a representation of the algorithm output for a requested movement of ( 5, 15, 25, 40 ) steps. Continue reading Move 4 Stepper Motors Synchronously