I'm working on design of a 3D movement drive (for 3D printers/CNC mills etc) using DC motors and helical drive.
A DC motor drives the leadscrew actuator which supports the working elements (head, table or head bridge).
The current of the motor shaft -> position of the driven element is read with optical encoder. (I can derive speed, acceleration, momentum etc from that.) I can read the current (voltage across a fixed low resistance in series with the motor), and the voltage across the motor terminals, resulting in measurement of the power -> torque.
I can drive the power supplied to the motor through PWM.
For optimal drive, I should maintain movement speed as close as possible to given (right for the used machining parameters), and as I'm machining material, the resistance of the material against the tool will change in more or less unexpected pattern.
This is pretty simple with stepper motors where we just assume the output directly follows the input. In case of DC motor though, the control must be much more reactive, increasing power as torque rises.
What control algorithm would allow me to maintain movement speed closest to preset - meeting the additional condition: restricting or rapidly minimizing exceeding the preset speed; rapidly reduced load as the head exits material could result in speed increase and drive the head into a neighbour element, damaging the work piece.
(please note, this is one of the questions that take long rather than short answers; control algorithms in automatics is a subject of good several semesters of study, and choosing and explaining the control algorithm meeting specified criteria is bound to require some work.)