Getting feedback from Jrk21v3 with arduino

Hello, everyone.
I’m trying to controll an actuator LACT6P with feedback via the Jrk21v3 connected to an arduino. I have a sensor with the arduino wich gives instructions to the Jrk with the TTL connection. My problem is: I’d like to receive also the feedback from the jrk into the arduino to compare the command signal and the actuator response. I linked RX and TX from arduino to Jrk properly (RX to TX and TX to RX) but I don’t know how to get the Jrk to send information back and to get the arduino read them. Since I send commands to the actuator in a range of 0 to 4095 (12 bits) I’d like to receive the feedback in the same form. Is it possible? Here’s my command code: (I didn’t do the void Move myself so I don’t really understand the instructions)

const int zpin = A2;

#include <SoftwareSerial.h>
SoftwareSerial mySerial(7,8); // RX, TX, 

void Move(int x) 
  word target = x;        
  mySerial.write(0xAA);   //tells the controller we're starting to send it commands
  mySerial.write(0xB);   //This is the pololu device # you're connected too that is found in the config utility(converted to hex). I'm using #11 in this example
  mySerial.write(0x40 + (target & 0x1F)); //first half of the target, see the pololu jrk manual for more specifics
  mySerial.write((target >> 5) & 0x7F);   //second half of the target, " " " 

void setup()

{ mySerial.begin(9600);

void loop()

  if (fabs(a)<5)
 {Move(2048); }
 {  if (a>0)
  { Move (0); };
    if (a<0)
 {Move(4095); };
delay (10);

Thank you in advance for helping me.

PS: It would be cool also if you could give me the instruction to commmand the actuator to stop moving (while it’s moving up or down). Thanks

I’m also interested in this because I’m going to migrate from PWM to serial communication with my JRK-controller in the near future.



You can read several variables from the jrk using the read variable serial commands explained in the “Variable Reading Commands” section of the jrk user’s guide. In your case, it sounds like you are wanting the scaled feedback. Please note that the 0-4095 value returned is split into two bytes (the high byte and the low byte), so you will need to read both bytes back and combine them.

It sounds like you might not be familiar with the jrk’s serial protocols. If that is the case, I suggest reading through the “Command Protocols” section of the guide as well.

If you try writing a sketch that reads the scaled feedback and run into problems, you can post your code here and I would be glad to take a look.


Hi, I thank you for your answer. I’ll try to look for commands to get those bytes and treat them. I’m also looking for a command to just stop the actuator during motion, I tried this code:

 if ((st==500) )  (it's the condition in my program that would result in stopping the actuator from moving)
  { mySerial.write(0xAA);
    mySerial.write(0x7F); }

But it seems it’s not working. Are these the correct instructions in the correct order? (if so, maybe the problem is with my condition)

If you did not change the default device number, I do not see any problems with the bytes you are sending for the “Stop Motor” command. Please note that this command stops the motor by setting the “Awaiting command” error bit, and the jrk will continue normal operation again once it receives a new “Set Target” command. Are you sure your code is not sending a new “Set Target” command soon after stopping the motor? One quick test would be to watch the “Errors” tab of the Jrk Configuration Utility when you send the “Stop Motor” command; if it is working properly, you should see the “Occurrence count” for the “Awaiting command” error increase when the command is received.


This code worked for me:

int GetMyJrkPosition(byte command)
  char response[2];
  myJrk.write(0x0B);//the Device Number is set in the Serial Interface box in the Input tab of your jrk config utility
  while (myJrk.available() < 2);//wait for it to become available
  return word(response[1],response[0]);

void GetCurrentPosition()
  word feedbackPosition = GetMyJrkPosition(0xA5);
  Serial.print("feedbackPosition: ");
  word scaledFeedbackPosition = GetMyJrkPosition(0xA7);
  Serial.print("scaledFeedbackPosition: ");