ServoStep
Servo control of stepper motors
- Code:
github.com/osresearch/servostep
- The Teensy 3.x has a hardware quadrature decoder.
- Dual shaft steppers make it easy to connect quadrature encoder.
- The A4988 stepper driver can handle our NEMA23 motors. sparkfun Big Easy Driver uses it.
- Command protocol?
- gcode: G0 Xnnn Fnnn
- Speed ramps, jerk, etc in servo controller or outside loop?
- Simple serial? Just write the desired position, implement speed ramps outside
- Feedback? print position, current/torque, velocity.
- Update rate? Can do up to 100 KHz without problem, but
analogWriteFrequency()
seems to mess up if called too often.
Testing
The first version of the software using only P (error proportional only) shows some ringing. Need to adjust speed ramp and handle reversals more cleanly. It does track motor speed and will dial back the step rate if it detects missing steps.
Constant jerk planning
Constant Jerk mode smoothly ramps up the acceleration to a maximum value, which then quadratically ramps up the velocity to a maximum value. This reduces the shock on the system as motion begins and ends.
-
During phase 1, a = j t and v = v_0 + {1\over 2} j t^2.
-
During phase 2, a = max_a and v = v_1 + max_a * t.
- During phase 3, a = max_a - j t and v = v_2 - {1\over 2} j t^2.
- During phase 4, a = j = 0 and v = v_3 (constant velocity)
Todo
- Better motor driver (currently using Makerbot Stepbot 17E boards)
- Trapezoidal ramp planning
- PCB design
- Command protocol specification
- Want to support speed/feed options
- Need both "Go to" and "Go next"
- Configure holding torque?
- Configure PID terms
- Configure max A, max V
- Configure max ratio of steps to count (to avoid skipping)
Last update:
November 8, 2020