Jrk UART Scaled Feedback != jrk Configuration Utility Scaled Feedback

I have a 21V3 jrk controller connected to a linear actuator with an analog feedback (potentiometer).
The jrk is also connected to a Teensy microcontroller (UART to UART).

I can control the jrk with either the configuration utility or the Teensy (using the serial UART mode) - both work great.
However, the scaled feedback readings on the two are different - even when not moving.

I would have thought the UART reading would be “identical” to the configuration utility reading. Is the scaled feedback value shown on the configuration tool generated differently than the value you get from reading the register?

For example, if I set the target position to 3000 the motor moves to 3000 and the configuration scaled feedback is within 1 or 2 counts. However, the reading that is passed to the microcontroller could be off as much as 18 counts (it varies depending on motor direction and position).

Below is the Teensy code for getting the position.

// Motor Controller (getPosition) - Read Current Position //
  int getPosition(){
  int cPosition=0;
  byte lByte=0, hByte=0;
  
  //  Clear Serial Buffer  //
  while(Serial.available() > 0) {
	lByte = Serial.read(); }

  // Send Read Command  //
  Serial1.write(0xAA);  
  Serial1.write(0xB); 
  Serial1.write(0x27);   //0x27 = Scaled Feedback : 0x25 = Raw Feedback
  while (Serial1.available()==0){}
  lByte=Serial1.read(); //Read lower byte
  while (Serial1.available()==0){}
  hByte=Serial1.read(); //Read upper byte
  cPosition=(hByte*0xFF)+lByte;
  return cPosition;
}

Thanks in advance.

Could you post your jrk settings file? You can save your settings file by selecting the “Save settings file…” selection within the “File” drop-down menu of the Jrk Configuraiton Utility.

How do you have everything connected? A wiring diagram might be helpful. Also, what value potenimeter are you using (e.g. 10k), and is it being powered from the 5V or AUX pin on the jrk?

By the way, does this variation have a noticeable impact on the way your system is running, or is it just something you noticed and were concerned about?

Brandon

Brandon,
Thanks for the reply. This project has been on the shelf for a while and finally revived.
However it is still not working correctly. I am using one of your concentric linear actuators.

The impact of this problem is: I send the actuator to a new location (say 3000 cnts), the motor moves and stops - at this location both the scaled and nonscaled feedback read by the microcontroller read 2987±. However, the configuration utility says it is at 3000.
The micro is waiting until the motor reaches its target, but it indicates it never does.

How can the feedback be different when read from the USB than when read from the UART? I would assume it is the same A/D.

I did have the pot on the actuator connected to 5V - I moved it to the AUX - still have the same problem. The only connections would be to power, motor, Laptop USB, microcontroller/Teensy(Rx, TX, GND). It works like it should except for the offset between the two readings.

Any help would be appreciated.
Thanks,
Jim

jrk Setting TiltTable 022018.txt (1.4 KB)

Thank you for the updated information. I looked back at the code in your first post and noticed that the calculation you made for cPosition that combines the bytes returned looks incorrect. The equation should be:

cPosition = (hByte<< 8) + lByte;

I am not sure why I didn’t notice it before, but I suspect that is the root of the problem. Can you try using this equation and seeing if it gives you the right result?

Brandon

Brandon,
Thanks, that was it - makes perfect sense.
At some point, I thought I was using your example code and so I did not question its validity.
I must have wrote it. Thanks again.
Jim

2 Likes