Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Motor control feedback for setting and maintianing RPM


Hi Pololu and friends. I am looking to use a Pololu Jrk simple motor controller with fed back to run a motor at precise speed under somewhat varying load. I wan to use the feedback to maintain speed precisely using an optical speed sensor.
Please send advice on setting this up. Currently I have this optical sensor. HC-020K Double Speed Measuring Module with Photoelectric Encoders, also to be getting a motor with HDEM 55xx soon. I am not sure if I am doing it right, because the effect of the encoder is rather minimal.



Hello, Mara.

I did a brief Internet search for the encoder you mentioned, and it looks like it has a single-channel output that the jrk motor controller with feedback should be able to use for closed-loop speed control. Did you configure the jrk to be used with Frequency (digital) feedback using the Jrk Configuration Utility? You can find a description of how this feedback mode works in the “Feedback Options” section of the jrk user’s guide. With frequency feedback, you typically need to adjust the feedback scaling options in the “Feedback” tab of the Jrk Configuration Utility to the appropriate values for your setup as well. The appropriate values will depend on your motor, encoder, and PID period setting. If you have already configured the jrk, can you post your jrk settings file? You can save your settings file by selecting the “Save settings file…” option within the “File” drop-down menu of the Jrk Configuration Utility. Also, can you describe how you are adjusting your set target (e.g. using the slider in the Jrk Configuration Utility, sending TTL serial commands from a microcontroller, native USB commands) and what you are setting it to?



Thanks, I got it working, using the other optical encoder. My question is now, how should I manipulate the settings to increase or adjust the level of compensation when resistance is placed on the motor, and error increases. I want to see how much I can get it to “fight” to get back to the target rpm.



The PID coefficients can be used to manipulate how the controller reacts when there is a difference between the feedback and the target. You can adjust these coefficients in the “PID” tab of the Jrk Configuration Utility.

However, please note that if the feedback is not configured correctly (e.g. the feedback mode set to Frequency (digital) and appropriately scaled), you probably won’t be able to get the desired results from simply tuning the PID coefficients. If you post your jrk settings file and tell me the maximum speed of your motor and CPR of your encoder/tachometer signal, I would be glad to take a look and see if your feedback scaling settings are reasonable.



Hi Brandon, I think my problem, is that the feedback does not register on the GUI unless there is significant slowdown of the motor, say 20% or more. Is there perhaps a way to raise the sensitivity of it. I would like it to hold rpm to around 0.1% ?


Encoder is HEDS-5500 A02
it is rated at 500 CPR
since it is a two channel encoder, and I have the JRK on one channel, so it is possible that I am using it at
250 CPR
I am spinning the motor at roughly 1000 RPM.
The project is to turn a belt drive record player with a precise speed and pitch control
I can change the belt drive pulley, so I could lower rpm if for some reason 1000rpm is too fast for the controller.


The jrk can register a change of a single pulse within the PID period, and how the jrk will react to a change in the feedback signal will depend on how you have the feedback scaled, the speed of your motor, the CPR of your encoder, the PID period, and the PID coefficients. If you have not done so, I recommend reading through the Frequency (digital) heading of the “Feedback Options” section of the jrk user’s guide that i linked to in my first post. My posts in this forum thread (and the one I link to from there) might also be helpful for understanding how the feedback works.

The 500 CPR spec you gave for your encoder looks like it is for both channels and includes the rising and falling edges; since the jrk only uses 1 channel and only the rising edges, you will be getting around 125CPR. At 1000 RPM, you would get 125000 counts per minute, which is roughly 2083 counts per second. This means that if your PID period is set to 10ms (the default), you can expect about 21 pulses from the encoder in each PID period. With that information, you can find the appropriate feedback scaling values using the 2048±n formula I mentioned in the forum thread linked to above. Since the minimum difference that the jrk can recognize is a single pulse per PID period, it should have a sensitivity of about 48RPM (since that corresponds to 1 count per PID period) using the default PID period of 10ms. If you need more than that, you might try experimenting with increasing the PID period (e.g. doubling the PID period would drop this down to 24 RPM and so on). However, please note that if you increase the PID period too high, it will likely result in jittery or stop-and-go behavior. Also, you will likely need to re-tune your PID coefficients after changing the PID period.



Thanks Brandon, you have given me a lot of information here to digest and experiment with. It is great to know that there is help available. I am will update after I do more experimenting.