Hi, I want to control the speed of a conveyor belt. I can measure the linear velocity of the belt using a encoder mounted at the roller of the belt. My confusion is not with the PID but only the mapping of PID output to PWM for the motor.
The PID error is in terms of meter/seconds(m/s) of the conveyor belt. The P, I and, D parts are summed to give a control signal. The motor interprets 0 as 0 PWM and 16393 as 100% PWM. The range from 0 to 16393 is serially communicated to the motor. I want this to be from the PID.
My question is: How do I map the PID output based on error(m/s) to PWM for the motor.
Example: I am using just PI and ignoring D for now to avoid noise amplification issues.
The maximum speed of the belt is when 16393 is sent to it and the speed is 0.5 m/s. I set desired speed as 0.2 m/s,
At the start, error = 0.2 m/s Lets say Kp = 4, Ki = 2.
output = Kp * error + Ki * sum_of_errors * sampling_time
I would get a PID output but it would be very small compared to 16393 needed for the 100 % PWM for the motor. I need 100 % PWM to power motor in the start and gradually decrease the PWM as the belts speed goes from 0 m/s to 0.2 m/s. How can I map this small PID output to 16393 need for the Motors 100 % PWM?