Modbus input for absolute encoder position?
- Ehsan_R
- Offline
- Premium Member
-
Less
More
- Posts: 88
- Thank you received: 1
19 Jan 2025 09:09 #319352
by Ehsan_R
Replied by Ehsan_R on topic Modbus input for absolute encoder position?
Has anyone been able to get the position of the servo motor via modbus and then do the homing operation?
Please Log in or Create an account to join the conversation.
- Ehsan_R
- Offline
- Premium Member
-
Less
More
- Posts: 88
- Thank you received: 1
03 Feb 2025 17:19 #320515
by Ehsan_R
Replied by Ehsan_R on topic Modbus input for absolute encoder position?
I have a servo motor with an absolute encoder that can send and receive data via RS485 RTU. I was also able to receive the encoder data using mb2hal. The encoder data includes the pulse count and the number of turns. The pulse count changes between 0 and 65535 per turn. The number of turns counts up from zero for positive numbers and decreases by one from 65536 for negative numbers. Now, my question is, first, how can I convert this value in HAL to an angle and then to a length, and second, how can I use this value for homing?
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Offline
- Platinum Member
-
Less
More
- Posts: 4987
- Thank you received: 1455
04 Feb 2025 15:50 #320613
by Todd Zuercher
Replied by Todd Zuercher on topic Modbus input for absolute encoder position?
First thing you'd need to do is convert your signed integer encoder counts and turn counts to floats using the CONV_S32_FLOAT hal component. Then you would need to multiply the turns by 65536 and that and the counts together to get the total counts, finally you would need to multiply the total counts by your encoder scale to get the distance (or if a rotary axis degrees.) You could do most of the summing and scaling in a single step using the SUM2 hal component since each of the SUM2 inputs have their own scale factor inpout.
But I'm not exactly sure how you might use that position information to set the home position for homing the axis in Linuxcnc. (But I think it could/can be done.) Also remember that data feedback from modbus isn't in real-time, and is subject to significant transmitting delays and resulting inaccuracy, So you will need to only use that feedback for position when stopped or only for "rough" positioning when moving.
But I'm not exactly sure how you might use that position information to set the home position for homing the axis in Linuxcnc. (But I think it could/can be done.) Also remember that data feedback from modbus isn't in real-time, and is subject to significant transmitting delays and resulting inaccuracy, So you will need to only use that feedback for position when stopped or only for "rough" positioning when moving.
The following user(s) said Thank You: Ehsan_R
Please Log in or Create an account to join the conversation.
- Martin.L
- Offline
- Junior Member
-
Less
More
- Posts: 33
- Thank you received: 2
04 Feb 2025 16:36 #320619
by Martin.L
Replied by Martin.L on topic Modbus input for absolute encoder position?
My servos just need a boolean input, guess yours need the same
Please Log in or Create an account to join the conversation.
- Ehsan_R
- Offline
- Premium Member
-
Less
More
- Posts: 88
- Thank you received: 1
05 Feb 2025 11:57 #320733
by Ehsan_R
Replied by Ehsan_R on topic Modbus input for absolute encoder position?
Yes, it is as you say, but I only want to use it for homing. That is, instead of using the limit switch at the start of the movement, when the homing command is sent, it opens the RS485 port, reads the encoder value, and if it receives the result, it considers it as the home position, and then closes the RS485 port.
Please Log in or Create an account to join the conversation.
- Ehsan_R
- Offline
- Premium Member
-
Less
More
- Posts: 88
- Thank you received: 1
05 Feb 2025 12:01 #320734
by Ehsan_R
Replied by Ehsan_R on topic Modbus input for absolute encoder position?
I use this servo motor.
Attachments:
Please Log in or Create an account to join the conversation.
Time to create page: 0.156 seconds