HAL for open-loop encoder homing
- Alexf2a
- Away
- New Member
-
Less
More
- Posts: 16
- Thank you received: 0
11 Oct 2026 19:38 #350197
by Alexf2a
HAL for open-loop encoder homing was created by Alexf2a
Hello.
I am using a Mesa 5i25/7i76/7i85s setup with LinuxCNC 2.9.4 on a milling machine.
I am using an open-loop control configuration. The axes are equipped with Chinese Sino optical linear scales, which I want to use for precise homing. AI helped me write the HAL and INI files for this setup. Before I added the BACKLASH parameter to the INI file, the system performed homing correctly and accurately using the scales' index mark; however, after adding BACKLASH, accuracy and repeatability were lost—sometimes it was accurate, other times not. I have attached the HAL and INI files. Could you please advise on how to fix this issue?
I read that this can be resolved using firmware that supports step/direction indexing, but I don't know where to download it.
Thank you.
I am using a Mesa 5i25/7i76/7i85s setup with LinuxCNC 2.9.4 on a milling machine.
I am using an open-loop control configuration. The axes are equipped with Chinese Sino optical linear scales, which I want to use for precise homing. AI helped me write the HAL and INI files for this setup. Before I added the BACKLASH parameter to the INI file, the system performed homing correctly and accurately using the scales' index mark; however, after adding BACKLASH, accuracy and repeatability were lost—sometimes it was accurate, other times not. I have attached the HAL and INI files. Could you please advise on how to fix this issue?
I read that this can be resolved using firmware that supports step/direction indexing, but I don't know where to download it.
Thank you.
Please Log in or Create an account to join the conversation.
- PCW
-
- Away
- Moderator
-
Less
More
- Posts: 18108
- Thank you received: 5328
12 Oct 2026 02:51 #350203
by PCW
Replied by PCW on topic HAL for open-loop encoder homing
Is this open loop in the sense that you do not actually use the encoder
or its index for position feedback?
or its index for position feedback?
Please Log in or Create an account to join the conversation.
- Alexf2a
- Away
- New Member
-
Less
More
- Posts: 16
- Thank you received: 0
12 Oct 2026 03:30 - 12 Oct 2026 03:37 #350204
by Alexf2a
Replied by Alexf2a on topic HAL for open-loop encoder homing
Yes, I use the encoder solely for the homing procedure using the Z-mark on the Sino linear scale.
First, the axis moves to the inductive sensor, and then a precise homing sequence is performed at a lower speed using the encoder's Z-mark.
First, the axis moves to the inductive sensor, and then a precise homing sequence is performed at a lower speed using the encoder's Z-mark.
Last edit: 12 Oct 2026 03:37 by Alexf2a.
Please Log in or Create an account to join the conversation.
- Alexf2a
- Away
- New Member
-
Less
More
- Posts: 16
- Thank you received: 0
12 Oct 2026 03:35 - 12 Oct 2026 03:37 #350205
by Alexf2a
Replied by Alexf2a on topic HAL for open-loop encoder homing
Alexf2a post=350204 userid=28355
Last edit: 12 Oct 2026 03:37 by Alexf2a.
Please Log in or Create an account to join the conversation.
- PCW
-
- Away
- Moderator
-
Less
More
- Posts: 18108
- Thank you received: 5328
12 Oct 2026 04:19 #350207
by PCW
Replied by PCW on topic HAL for open-loop encoder homing
I don't see any 5i25+7I76+7I85S firmware images with step/dir index
but I can compile one in the next day or so if you want to try it.
but I can compile one in the next day or so if you want to try it.
Please Log in or Create an account to join the conversation.
- PCW
-
- Away
- Moderator
-
Less
More
- Posts: 18108
- Thank you received: 5328
12 Oct 2026 20:00 #350218
by PCW
5I25 configuration for 7I76 +7I85S with Step/Dir index for
Step/Dir channels 0..3 (7I76) on 7I85S encoder index pins 0..3
That is 7I85S encoder inputs 0..3 has shared encoder and stepgen
index function with the stepgen index function applying to stepgens
0..3 (on the 7I76)
Replied by PCW on topic HAL for open-loop encoder homing
5I25 configuration for 7I76 +7I85S with Step/Dir index for
Step/Dir channels 0..3 (7I76) on 7I85S encoder index pins 0..3
That is 7I85S encoder inputs 0..3 has shared encoder and stepgen
index function with the stepgen index function applying to stepgens
0..3 (on the 7I76)
Attachments:
Please Log in or Create an account to join the conversation.
- Alexf2a
- Away
- New Member
-
Less
More
- Posts: 16
- Thank you received: 0
12 Oct 2026 21:09 - 12 Oct 2026 21:12 #350221
by Alexf2a
Replied by Alexf2a on topic HAL for open-loop encoder homing
Thanks for a firmware. I will try. And this firmware will work with option of use of the encoder for use of feedback by situation? This assembly now so works for me but it is not possible to configure well PID - when there is a processing on three coordinates not the really good surface of processing at once. If there is a processing at the same time on two coordinates purity of processing acceptable. On the milling machine a heavy table. Earlier I managed this Mach 3 machine and at small speeds the processing on three coordinates gave at once a good surface. I want to try to make also and in Linuxcnc with exact search of the house by encoders.
Last edit: 12 Oct 2026 21:12 by Alexf2a.
Please Log in or Create an account to join the conversation.
- PCW
-
- Away
- Moderator
-
Less
More
- Posts: 18108
- Thank you received: 5328
12 Oct 2026 23:18 #350224
by PCW
Replied by PCW on topic HAL for open-loop encoder homing
I should note that a closed loop linear encoder feedback system will be difficult
to make stable unless you can remove the backlash mechanically...
to make stable unless you can remove the backlash mechanically...
Please Log in or Create an account to join the conversation.
- Alexf2a
- Away
- New Member
-
Less
More
- Posts: 16
- Thank you received: 0
19 Oct 2026 08:49 #350332
by Alexf2a
Replied by Alexf2a on topic HAL for open-loop encoder homing
Thanks for the help!
Actually, ChatGPT helped me find an error in the INI file for my closed-loop system (which I attached earlier).
There is a line for initial settings: `RS274NGC_STARTUP_CODE = G21 G40 G90 G94 G97 G64 P0.025`. By adjusting the `P` value within the `G64` command, you can fine-tune the surface quality. I achieved the best surface quality with `P0.005`. I haven’t tried your firmware, as I’m currently satisfied with the surface quality I’m getting. Thanks again for your help!
Actually, ChatGPT helped me find an error in the INI file for my closed-loop system (which I attached earlier).
There is a line for initial settings: `RS274NGC_STARTUP_CODE = G21 G40 G90 G94 G97 G64 P0.025`. By adjusting the `P` value within the `G64` command, you can fine-tune the surface quality. I achieved the best surface quality with `P0.005`. I haven’t tried your firmware, as I’m currently satisfied with the surface quality I’m getting. Thanks again for your help!
Please Log in or Create an account to join the conversation.
- Muzzer
- Away
- Elite Member
-
Less
More
- Posts: 275
- Thank you received: 48
19 Oct 2026 10:35 #350334
by Muzzer
Replied by Muzzer on topic HAL for open-loop encoder homing
I've got a very similar setup on my lathe, and while that's not a milling machine, the setup has a lot in common.
I have a Chinese glass encoder on the Z axis and a magnetic encoder buried in the X axis (under the cross slide). The Z axis has an inductive (technically eddy current) proximity switch for homing and the X axis has a microswitch.
Those both work in closed loop. I don't use backlash compensation but the axes used NOS, Japanese ground ballscrews.
I spent several hours recently implementing "index mark" homing on both axes, using the synthesised encoder outputs from the servo drives and perhaps surprisingly there was no obvious benefit, so in the end I simply reverted to using the limit switches.
This is partly due to the way the index pulses are read by the 7i85, but then subsequently processed by Linuxcnc. I also suspect that some of the remaining variation is in the mechanism between the servo motors and the actual axis ie toothed belt, ballscrew, bearings, mechanical slop etc.
When you look at it that way, it doesn't seem obvious that moving the servo motor to a particular angular position after homing to the switch would necessarily deliver any obvious benefit. Either way, repeated testing with a decent DTI showed clearly that while the system was working, it didn't improve the homing repeatability or accuracy in my case.
This outcome may differ with your machine. Mine can only resolve / achieve 5um repeatability due to the encoder resolution and although I have good ballscrews and the machine is well adjusted, it wasn't built as a CNC machine, so is perhaps not the optimal choice.
I have a Chinese glass encoder on the Z axis and a magnetic encoder buried in the X axis (under the cross slide). The Z axis has an inductive (technically eddy current) proximity switch for homing and the X axis has a microswitch.
Those both work in closed loop. I don't use backlash compensation but the axes used NOS, Japanese ground ballscrews.
I spent several hours recently implementing "index mark" homing on both axes, using the synthesised encoder outputs from the servo drives and perhaps surprisingly there was no obvious benefit, so in the end I simply reverted to using the limit switches.
This is partly due to the way the index pulses are read by the 7i85, but then subsequently processed by Linuxcnc. I also suspect that some of the remaining variation is in the mechanism between the servo motors and the actual axis ie toothed belt, ballscrew, bearings, mechanical slop etc.
When you look at it that way, it doesn't seem obvious that moving the servo motor to a particular angular position after homing to the switch would necessarily deliver any obvious benefit. Either way, repeated testing with a decent DTI showed clearly that while the system was working, it didn't improve the homing repeatability or accuracy in my case.
This outcome may differ with your machine. Mine can only resolve / achieve 5um repeatability due to the encoder resolution and although I have good ballscrews and the machine is well adjusted, it wasn't built as a CNC machine, so is perhaps not the optimal choice.
Please Log in or Create an account to join the conversation.
Time to create page: 0.137 seconds