How to run motors

I am trying to run two motors. I could use two jrks but I am wondering what the best method would be and how. What commands can I run with the jrkcmd to make a motor move forward and reverse? Also what commands could I run to connect to the TTL serial interface to run a motor. I imagine I could ssh but we want most of it to be automated anyway. Any info will be greatly appreciated!

Thank you

Hello.

It is difficult to tell whether a jrk controller is right for your system or to recommend a reasonable way to control your motors with the jrk without knowing more about your system and how you want to operate the motors. For example, what kind of load are they under? How are you supplying power? Do you need feedback? If so, what kind? Also, what motors are you using? If you describe your system in more detail, I might be able offer some advice.

You can go to the GitHub page for the Pololu USB SDK, which we link to under the Resources tab of the jrk’s product page and see what commands are available for JrkCmd by reviewing Program.cs. You can learn more about the available TTL serial commands under the Using the Serial Interface section of the jrk’s user’s guide.

-Jon

Hi Jon,

Thank you for the reply! So a little more information, my senior design group is trying to build a radio telescope. We need to rotate horizontally 180 degrees and vertically 90. This means the motors need to be able to move forward then backward. If the feedback is what tells me the position of the motor then yes we need that because the movements need to be accurate. From what I’ve read it seems I mostly need to understand how to change the duty cycle through code. We are using ubuntu 16.04 so there is no configuration utility, also a gui wouldn’t be very helpful since everything should be automated with cron jobs. Could you explain what the set target does? Does it set the speed, position, or neither? I thought the duty cylce was the speed but either way could you simply set the target to a negative number to reverse direction? If my only hope of reversing the motors is the duty cycle do I have to load a configuration file using the JrkCmd? If so how would a configuration file for the Jrk look? if this is not possible I could try to use the TTL serial interface.

You could use two jrk motor controllers in a system that does that. Each jrk would control a single motor and be configured to do position control. The only way a jrk can do position control is with analog voltages for feedback, so you would have to use something like a potentiometer to measure how far each motor has rotated. You can learn more about the analog voltage feedback mode under the Feedback Options section of the jrk’s user’s guide.

The jrk, along with the other motor controllers we carry, allows for bidirectional control of a brushed DC motor. Its target is an output of a control system (usually motor position or speed), and the user gets to determine what the target it. You can learn more about how the target parameter works in the PID Calculation Overview section of the user’s guide.

By the way, a lot of your questions can be answered by reading the relevant sections of the user’s guide. We spend a lot of time creating those and other resources so that people can use our products effectively. If, after you read through our documentation, something is not clear, please specifically explain what it is that is confusing, and I might be able to help.

-Jon

I’m sorry for my ignorance but this really isn’t my area of expertise. I’m the software engineer so my only concern is the code that runs the motors. I’m not sure what to do about the input values or the current through the motor, that part is for the electrical engineers. I believe the input voltage should be constant since we have a few large batteries powering the whole system. Looking at the PID it seems I can change the duty cycle by simply changing the target value which would be perfect. So I really only need examples of how to run and reverse a motor. Here’s what I think I can do but have no way of verifying yet:
I want to be able to simply run ./JrkCmd -d (serial number) to reference the correct motor controller, ./JrkCmd --target (number) that would create a positive duty cycle, then ./JrkCmd --run, and ./JrkCmd --stop. After that I can do the same but with a target number that gives a negative duty cycle. Are these all valid or am I wrong, could I just run the ./JrkCmd once with multiple options or do I run it every time? Also come to think of it I may not even need to know the position because we may just change the position very slightly every few minutes. I imagine the easiest method would be to just run the motor for a second at a certain speed then stop it.

I’m sorry for all the stupid questions, I’d try these commands for myself if my group ever set up the motors and let me test them! Thank you for your time and patience.

To answer your question, I need to know whether you intend to use one of the jrk’s feedback options or to just use the jrk for open loop motor control. If you are using position feedback, you would not be able to specify the direction of rotation of the motor. Instead, the feedback loop would figure out which direction the motor should rotate in order to get its position feedback to match the specified target value. If you are using open loop control, the target value specifies the direction and duty cycle for the motor.

-Jon

Both are viable options, I will have to discuss with my group to decide. Anyway thank you I think you’ve answered most of my questions. Either way the motors are setup, with or without feedback, the target will be the command to move the motors the way we want. Correct me if I’m wrong but otherwise thank you for your help! I will continue to work on this and I will come back if I have any more questions.

Thanks again!