Jrk frequency feedback help

i’m using a jrk12v12 with Configuration Utility 1.3, input mode set on Serial but doing test with the Manually set target panel from the utility.

my motor is http://www.ebay.com/itm/220885008498?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649
It is a 12V geared motor with a tachometer that outputs 2.45kHz@12V to about 1kHz@5V. Since it’s output is a sinewave from 3.6 to 1.8 Vpp I used a LM1815 (http://www.national.com/mpf/LM/LM1815.html#Overview) to get a nice pulse output for jrk’s FB pin.

With Scaling\Calibration\Maximum set to 4095, a PID period of 100ms, PID parameters of P=1, I=0, D=0, during runtime the Scaled Feedback ranges from 2047 in stand still to 2288 in one way and 2047 in the other. It’s what I would expect since sampling 2.45kHz for 100ms gives 245 ticks. I don’t understand why in the Manually set target panel I can’t enter values above 3896 since the limit should be 4095.

Now starts the problem. Since my scaled feedback is small compared to the target I assume I need to scale it setting Scaling\Calibration\Maximum to 2292 lets say. That would make my scaled feedback reach around 3722 which is comparable to the 3896 set target but still under it. I don’t understand why in this case the duty cycle drops to 15% even at highest target.

In the manual it’s stated that:
duty cycle target = (Proportional coefficient) × error + (Integral coefficient) × integral + (Derivative coefficient) × derivative

I see how this can work for position control when using analog feedback but in case of speed control using frequency feedback like I need, that would mean that at 0 error I have 0 duty cycle. What am I missing? How do I need to scale my feedback so that at 3896 target my duty cycle would be +600

I’ve seen this topic https://forum.pololu.com/t/jrk-21v3-feedback-settings/3363/1&hilit=jrk that addresses the same issue but I it’s not a full explanation

Any more details, maybe a step by step for this kind of setup?

I would greatly appreciate any kind of help, somebody I can bounce ideas with at least as I’m in a dead end here

Hello. Thanks for all the information. It sounds like you’re on the right track. For frequency feedback, the first thing you should do is to set the Proportional and Derivative coefficients to zero and then start increasing the Integral coefficient. Since the jrk’s Error variable (Scaled Feedback - Target) measures how much the actual speed differed from the target speed, in some sense the jrk’s Integral variable actually measures how much the target position differs from the actual position. By setting an integral coefficient it is possible to have an error close to zero and a non-zero duty cycle.


Thanks for the reply David but please answer me these questions so I can get a glimpse of what’s going on:

In Configuration Utility 1.3\Manually Set Target panel, why can’t I enter values above 3896 although the limit should be 4095 as stated in the sliders labels and the user manual as well

Going from the scenario of:

  • Scaling\Calibration\Maximum set to 4095
  • a PID period of 100ms
  • PID parameters of P=1, I=0, D=0
  • Scaled Feedback 2047 in stand still, ranging to from 2047 to 2288 for target 0 to 3896
    Do I need to change the Scaling\Calibration\Maximum or the PID period before playing with PID parameters as you said? My logic is that with my 2.45kHz max tachometer output, I need those 100ms in the PID period to sample those 245 “ticks” as feedback but I don’t know if any other calibration would be required before PID tunning.

Thank you

You can select any value between 0 and 4095 if you type it in the text box and click the “Set Target” button. Unfortunately, you can’t get all the way up to 4095 with the scroll bar; I intend to fix that in the next release.

If you want to change the Feedback scaling settings it should definitely be done before tuning the PID constants. You don’t have to change the Feedback scaling settings but it would probably be a good idea to do so because then the jrk’s PID algorithm can have more resolution to work with. You should adjust your Feedback scaling settings so that when the motor is going full speed forward, the Scaled Feedback is somewhere in the neighborhood of 4000.