crimsonmoon
Newbie level 1
pid control pic16
Hello, I'm doing a PID speed control for a DC motor, using a PIC 16 as the controller. To have a closed loop I'm using an optic sensor, and an dented wheel. Not quite a quadrature encoder, since I only have one signal.
I still haven't mounted up the system, but I want to have the software as tuned up as possible before running ir.
My concern is about scaling and units. If I measure speed by counting pulses with a timer, how does this number relates to R (input or desired speed) to generate the error signal? And after doing the PID calculations (I'm using a difference equation), how does that number thrown out relates to PWM duty cycle? Do I have to multiply/divide by something?
Just in case, I'm using 20 KHz PWM, 0.02 S sampling time, and 16-bit integer math for calculations.
Hello, I'm doing a PID speed control for a DC motor, using a PIC 16 as the controller. To have a closed loop I'm using an optic sensor, and an dented wheel. Not quite a quadrature encoder, since I only have one signal.
I still haven't mounted up the system, but I want to have the software as tuned up as possible before running ir.
My concern is about scaling and units. If I measure speed by counting pulses with a timer, how does this number relates to R (input or desired speed) to generate the error signal? And after doing the PID calculations (I'm using a difference equation), how does that number thrown out relates to PWM duty cycle? Do I have to multiply/divide by something?
Just in case, I'm using 20 KHz PWM, 0.02 S sampling time, and 16-bit integer math for calculations.