aamott / petinator

Firmware for bottle-to-filament machines
GNU General Public License v3.0
24 stars 2 forks source link

PID speed control for PWM pullers #6

Open aamott opened 2 years ago

aamott commented 2 years ago

Is your feature request related to a problem? Please describe.

PWM-driven puller motors can change speed while pulling due to voltage changes or load changes, like if the filament sticks. PID control of the speed could solve that issue.

Describe the solution you'd like

By configuring the motor to use steps per second (like with the stepper motor, but detecting "steps" with the encoder) and changing PWM the same as the temperature is controlled with PWM, a speed controlled motor should be easy to get working. The code should be easy to adapt from the temperature control - 1 input (target speed instead of target temp) and 1 output (pwm output on the motor pin)

This feature may be better implemented after PWM autotune, but the autotunes may also be different. A motor is going to react considerably faster.

amjed-ali-k commented 1 year ago

Don't we need to measure the motor speed for implementing PID control?

aamott commented 1 year ago

Yes, PID motor control will need that implemented. Once we have that, we can copy the heater code since it uses the same system - measure speed and change the pwm.