I am working on a Python code (below) that accelerates a stepper motor until it reaches a specific amount of steps.
for s in range (steps): if s < accelerationsteps: lateststep = self.onestep(direction, stepstyle) time.sleep(s_per_s) s_per_s = s_per_s - ((astart - aend) / accelerationsteps)
s_per_s = time in between each step
astart = starting speed in second/step (for example 0.5)
aend = speed at which the acceleration should stop (for example 0.05)
accelerationsteps = amount of steps over which the acceleration should happen
The problem is that the velocity increases in step per second per step instead of step per second per second, and is therefore increased exponentially instead of linear. I have found this article that explains in mathematical terms how one can achieve a linear increase with a stepper motor but I have not managed to translate that into my python code.
I would highly appreciate it if someone could help me with this and I think it would be very useful for people using steppers on the Raspberry Pi in general (I have only found a solution for the Arduino here
Thank you very much in advance.