I am currently working on a problem, where I want to control the speed of a 12v dc motor using high frequency PWM. I am able to control the motor speed using potentiometers to change duty cycle of PWM by esp32.
Now, I want to make a close loop control of the motor speed using PID to control duty cycle of PWM and therefore the speed of the motor. For the starters I now the relation between PWM duty cycle and motor speed which is linear by the way. So, I know the desired values of the PWM corresponding to the desired speed.
Any suggestion on how can I proceed from here to control PWM using PID?
PID requires measuring of the outcome of the PWM. Assuming that a certain level of PWM gives a certain speed doesn't work. What would PID add to the performance? Nothing.
Assume the motor is facing different loads measurements of the actual speed is needed.
Hi, thank you for responding. Actually, I am using dc blowers to blow air and I think there won't be any changes in loading. So, airflow rate can be thought of outcome of the PWM. I just want to control the motor speed, or you can say flow rate of air by controlling PWM duty cycle by providing the controller with a desired value of flow rate.
Okey. What's the effect of the air blow? Controlling temperature, partical dencity etc? That could be what You need to measure in order to control the air flow by PID.
Yes, you are right. It is the temperature that I want to control by blowing air and I am measuring real-time temperature.
I am a little confused here so please correct me if I am getting it wrong. Do you mean that the output of the PID controller (i.e., the sum of P, I, and D) will act as PWM (i.e., the control variable) here controlling the DC motor speed, airflow, and therefore maintain the process variable i.e., temperature at some desired value?
Be aware, motor load will vary with the cube of speed, increasing speed by 25% could double the motor load. increasing by 50% could more than triple. https://en.wikipedia.org/wiki/Affinity_laws