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

Pololu Forum

Trying to use 2 Jrk24v13 to closed loop speed match 2 motors


I am building a differential drive robot. I bought (2) Jrk24v13 controllers and (2) 37Dx68L gear motors figuring I could have feedback accurately controlling the speed of each motor.

All of the settings for the motors are exactly the same. So I was assuming that when given the same target number input that I would get matching rpm out of the motors. (For when the robot drives straight I need both wheels to rotate at relatively the same speed)

But they are not. One motor is drawing double the current and visibly rotating faster. (No load)
I would think since the encoders are mechanically the same, even if one motor was tighter
that the controller would overcome that with current and make it the correct speed. (But it is not!)

Values I am using on both Jrk:
Pulse Timing
3 MHz
100 ms
4 pulse samples
64 Frequency Divider
range from this is 71Hz to 2.86kHz and the motor calculates to be 2640 pulse freq
PID is 20/0/100 for both
PID Period is 30 for both

Using an oscilloscope on both motors FBT pins I matched up the square wave freq by adjusting the calibration fields on the faster motor and now have both motors close to the same speed. But not perfect and still not how I thought closed loop speed should work. What happens when motor wears in more? what happens when I have to replace the motor that breaks with a new one?

Any help would be greatly appreciated!!




To start, I think it would be good to assess the no-load performance of your motors to make sure they are within the expected ranges. Which specific motors do you have (i.e. what are the product numbers), and what is your power supply? Can you power them directly from your power supply with no load and tell me their free-run currents and speeds? You can use a multimeter to measure the current draw, and you can measure the speed by hooking your oscilloscope up to the encoder outputs.

Separately, I suspect that your PID constants are not tuned that well. For example, it looks like you do not have an integral term, and the integral term is the primary one you want to use for closed-loop speed control. Can you tell me how you determined those constants? If you look at the graphs in the Jrk configuration utility, is the scaled feedback actually getting to the target? Can you post some screenshots showing these lines?



Sorry I missed that detail! It’s the 30:1 4752 motor.

I am using a bench top power supply. 30v/3A
I am running everything at 12v.

Motor 1: .231 A; FBT freq 2.99kHz
Motor 2: .185 A; FBT freq 3.01kHz

The integral term did nothing but add oscillation to the motor.
Yes it is achieving the target. Error at max is less that 20 ticks. (not sure what to call the 0 to 4095 input)

I can follow with pics if still necessary.

It seems like I want to demand the FBT freq. If both motors were kept at same freq then the end result would be an identical speed. (which I want :slight_smile:)


Hello, David.

It sounds like your motors run at almost exactly the same speed when powered directly from your bench top supply.

The problem likely has to do with your PID tuning causing unpredictable behavior. It is very surprising that your system has such a low error with those PID settings. The integral coefficient is the most important term in a velocity control routine, and you should not need a derivative coefficient at all.

I would apply the same settings to the two Jrks and see how it works if you only use the integral term (set the other coefficients to zero). When it is working well, you should not see a difference between your two motors. If you continue to have trouble, can you post your Jrk settings file and screenshots showing the target and scaled feedback graphs for both motors?



The motor just oscillates with any number in I only.

See linked video

I term only oscillating

It looks like you might have set an acceleration limit for the motor. Can you try eliminating that? Looking at the duty cycle and duty cycle target graphs might be a good way to see that.

Also, please keep in mind that you might need an integral coefficient that is less then one.