Hi everyone out there,
I have been having a little trouble seeing something with the PWM motor controller…I am using a PI control scheme but I need a way to convert the output of the controller…which is a motor speed…to convert into some PWM value to send to the motor so i can correct the error…
I don’t quite understand your question. Are you referring to the motor controller that converts the PWM signal to the 2-wire cable that goes to the motor? To do any part of a PID loop, you need to have sensor feedback to give you the error, then use that error to define what the motor value should be at the end of that cycle of the PID loop.
There are lots of other threads on PID control methods.
Here is some assistance, your words suggest misunderstanding of the system:
(ref: “convert the output of the controller…which is a motor speed” )
If the output of the controller were actually the speed,
the PID would usually not be necessary.
You’d tell the controller to deliver speed X and that is what you would get.
What actually happens is
you provide a value from -127 to +127 to SetMotor command
which cpu outputs as a servo style PWM signal to motor controller #29
the #29 turns into 50Hz PWM -100% to 0 to +100% duty cycle power pulses to the DC motor
the motor reacts against the torque load per the current vs torque curve diagram
– which all means that setting +127 “full speed” will get you ~100 rpm on a standard vex motor with no load, and lower rpm at higher loads.
If you want to control the rpm with PID feedback, you need some way to measure the rpm.
Perhaps robot_N was referring to getting EMF (Electromotive Force) feedback from the motor to the motor controller.
EMF Feedback or sensorless feedback is where a running motor stops quickly, and then is allowed to back-feed the controller as a generator, which then measures the voltage and calculates the speed of the motor. You could use that information in a PID Control Loop as your input source to make sure some motor is turning at a constant speed. I think it would be really neat if that could be done in VEX, as it may provide a more accurate system of measurement than would otherwise be possible using optical encoders.
Here’s some neat documents that define EMF Feedback (or Back EMF):