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

Connecting Jrk 21v3 USB Motor Controller and 4.4:1 Metal Gearmotor 25Dx48L mm HP 6V with 48 CPR Encoder



I am completely new to electronics but my boss decided that i have to deal with the following project, where someone else already decided on the modules which should be involved:

  • Jrk 21v3 USB Motor Controller
  • 4.4:1 Metal Gearmotor 25Dx48L mm HP 6V with 48 CPR Encoder

In the end one should be able to type in your desired angle, speed of rotation and direction of rotation and then the motor does its work.

While trying to configure the controller i encountered the problem that i don’t know how to connect the motor to the controller.

Furthermore it would be helpful to me if someone could explain me the connection between target-value and angle of rotation.

Thank you!



Our jrk 21v3 USB Motor Controller does not do closed-loop position control using encoder feedback. If you need position and speed control, you might consider the RoboClaw 2x7A Motor Controller. I suggest thoroughly reading the user’s guide for the RoboClaw to be sure you are comfortable using a controller like this.



First of all thank you.

Would it work if we knew our starting position and then use the encoders signal for speed control?


Using that method would not give you closed-loop position control, and it would likely be much more difficult and less accurate. Further, any repetitive motion would have increasingly larger errors as the errors would be cumulative.



Since i already have the equippment i want to give it a try using this controller.
To which ports of the controller do i have to connect the Motor and Encoder?


For frequency feedback you would use one of the two available encoder channels to provide the tachometer signal. You can see more about connecting the encoders for feedback under the “Frequency (digital)” heading in the “Feedback Options” section of the “Pololu Jrk USB Motor Controller User’s Guide”, which is located under the “Resources” tab of the jrk 21v3 product page.

The “Module Pinout and Components” section of the same guide shows the FB pin and motor output connections on the jrk controller.

You might find this forum thread helpful in setting your jrk up to handle frequency feedback.



Hello Derrill,

thanks to your outstanding supoort i was able to set my system up and it works pretty well. However when i am turning a low frequencies(less than 2 revolutions per second) the system seems to block itself. It looks like the Encoder is stuck at specific positions due to the magnetic field. Do you have any suggestions on how to get rid of this problem? Otherwise i wil just use another gearbox.

Furthermore it seems that my calculation of my target values is a bit off:
I have a 48 CPR-Encoder which gives me 12 CPR for the Jrk.
My PID-interval is set to 10ms.
If i understood it right target value depends on Counts per PID-interval, e.g. when i set target to 2150, the motor wants to spin so that he gets 2150-2048 Counts per 10 ms.
Now when i want to calculate my target value and i am given an angular velocity at the motor shaft in degrees per second i calculate target = 2048+n. My idea to get from [°/s] to [Counts/10ms] were the following steps:

  1. Divide by 1000 to get [°/ms]
  2. Multiply by 10 to get [°/10ms]
  3. Multiply by 12 over 360 to get [Counts/10ms]
    However this gives me very small values for my n, so that there is actually no movement.
    For example when i want to spin my motor with 5 revolutions per second:
    Obviously there must be a mistake, but unfortunately i wasn’t able to find it. Is my calculation wrong or am i missing something for my overall principle?

Thank you very much in advance for your efforts.


I do not expect the encoders to cause a problem like that. It sounds like your load might be causing the system to bog down at low duty cycles. You might consider a higher gear ratio motor, which would probably be easier to control at lower speeds.

Additionally, it is hard for the jrk to do feedback when the numbers it is working with are so small, and so it would probably be better to increase the PID period to something like 100 ms.

Also, it looks like you are not taking into account the gear ratio of the motor in your calculations. The encoder measures the motor shaft, not the output shaft of the gearbox, so you would need to multiply by the 4.4:1 ratio of the gearbox.