Jrk21v3 Feedback and PID Settings


My Jrk21v3 arrived today and I’m trying to set up the feedback on it. I want to drive a motor at a full range of speed while retaining control at the lower end so I can run it at very slow speeds without sacrificing top speed. I’m building a camera pan-tilt head so it has to be able to start smoothly and run very slowly. Hence the need for feedback control.

I’m running a Pittman Lo-cog gear-motor at 12V using a 500 CPR encoder for frequency feedback, and controlling it with an analog joystick. It’s set to 256 analog samples input and a PID period of 10 ms. Knowing nothing about PID, I did some research on it and found that setting the PID values at P=1, I=0.125, and D=0 works well and I can make it turn very slowly. So far so good.

Ok, so the problem is: While the Scaled Feedback values seem to go between roughly 2012 and 2084 with a slight deflection of the joystick, past that point they stick to 2048. The Target value will go all the way from 0 up to 4095 - at 2048 the motor is stopped as it should be, with a roughly proportionate increase in speed up to 4095 in one direction - and going the other way from 2048 to 0 it’s the same but in reverse, as it should be. But all this time the value for Scaled Feedback remains stuck at 2048 except for that little bit near the middle when the motor is turning slowly. It’s as if the controller is ignoring the feedback value past that point. Oh yeah, one more thing - past that point the orange LED on the controller also changes from a steady glow to a fast flicker. Any idea on what settings I’ve got wrong?

Hello, johnr.

It sounds like the input/target side of your system is working fine, but the frequency feedback is only partially working.

What is the value of (non-scaled) feedback while you are doing this? Can you please use the configuration utility to save your settings to a file and upload them here or email them to david@pololu.com? Also, can you provide a link or datasheet with information about this encoder?

The orange-yellow LED flickers when target is far away from feedback. So if it’s on solid at low speeds, that just mean the jrk managed to achieve the speed you were asking it to achieve. It’s flickering at the high speeds because your target is far away from the scaled feedback which is stuck at 2048 (0 encoder counts).

Do you have an oscilloscope you can use to check the signal on the FB pin?


Thanks for the quick helpful reply. Unfortunately I don’t have an oscilloscope. The plot on the configuration utility seems to indicate the actual feedback is roughly equal to the scaled feedback, and neither deviates more than 1 or 2 % from +50%. All I know about the encoder is it’s rated at 500 CPR and it’s a slotted disk type and there are four wires coming out. The encoder came on the motor already - the motor is a 218.4:1 ratio gear motor rated at 13 RPM at 12V - so that means a maximum of 23,660 pulses per second from the encoder which should be well within the capability of the controller. The configuration settings are attached (it wouldn’t let me upload with the .txt extension so I changed it to .doc).
jrk21v3_settings.doc (1.39 KB)

I loaded your jrk settings and there doesn’t seem to be anything wrong with them.

When you said that the feedback value will “stick to 2048” was that a typo for 2084? Or did you mean that they rise up to 2084 (or fall to 2012) and then abruptly jump back to 2048?

Also, if you double the PID period, are you able to get double the number of counts? (1976 - 2120)


The scaled feedback value will rise to about 2084 or fall to 2012 and then going past that point it abruptly jumps back to 2047. Also the feedback does not re-engage until the joystick is brought back to the midpoint (target 2048). And you’re right, doubling the PID period does double the counts.

Still can’t figure out what’s causing this odd operation. Maybe the encoder is defective or is designed to only operate at low RPMs … but if it was defective I wouldn’t expect it to work at all, and why would anyone make an encoder for low RPMs only. Also that doesn’t explain why doubling the PID period expands the encoder range of operation. At the risk of appearing impatient - any ideas what could be happening here?

What voltages are the encoders signals supposed to be? To guarantee that the jrk can read your encoder, the signal must fall below 1 V and rise above 4 V.

The fastest frequency you’ve been able to measure on the FB pin is 3600 Hz. I think that as the speed of your motor increases (and feedback goes from 2048 to 2084), your encoder voltage levels are gradually getting worse. When the frequency gets to 3600 Hz the voltage no longer changes enough to be registered by the jrk, so the feedback drops back to 2048.

When you increased the PID period from 10ms to 20ms, you got twice as many counts, which is expected. The measured frequency did not increase.

Did you add any capacitor to the FB line? A capacitor would cause this problem. There is a 10 nF capacitor and a 100k pull-up resistor on the jrk PCB; but I don’t think that those components should cause a problem.