- Configuring LinuxCNC
- Advanced Configuration
- Tuning stepper motors with encoder or glass scale feedback
Tuning stepper motors with encoder or glass scale feedback
- PCW
-
- Offline
- Moderator
-
Less
More
- Posts: 18778
- Thank you received: 5187
08 Apr 2025 19:04 #325952
by PCW
Replied by PCW on topic Tuning stepper motors with encoder or glass scale feedback
At the minimum you should:
Expand the ferror limits as explained above.
Learn to use halscope.
It will not really be possible to tune without using halscope
regardless of the hal setup.
Expand the ferror limits as explained above.
Learn to use halscope.
It will not really be possible to tune without using halscope
regardless of the hal setup.
Please Log in or Create an account to join the conversation.
- JackRay
- Offline
- Elite Member
-
Less
More
- Posts: 203
- Thank you received: 14
12 Apr 2025 19:50 #326191
by JackRay
Replied by JackRay on topic Tuning stepper motors with encoder or glass scale feedback
but I know how to use the halscope. I know how to read the curves, but I don't know which parameter to adjust when, for example, I have oscillations in the error.
Please Log in or Create an account to join the conversation.
- PCW
-
- Offline
- Moderator
-
Less
More
- Posts: 18778
- Thank you received: 5187
12 Apr 2025 20:17 #326192
by PCW
Replied by PCW on topic Tuning stepper motors with encoder or glass scale feedback
Can you post a plot that shows this oscillation, including the velocity and the ferror?
Please Log in or Create an account to join the conversation.
- JackRay
- Offline
- Elite Member
-
Less
More
- Posts: 203
- Thank you received: 14
15 Jun 2025 19:45 #330320
by JackRay
Replied by JackRay on topic Tuning stepper motors with encoder or glass scale feedback
hello,I've managed to set my PID.I've mounted an encoder directly on my machine B axis. My encoder is of the phase type A+,A-;B+,B-;Z+,Z-.the feedback is correct on my axis position. However, it's impossible to detect my Z0. I have a 7i96s and I've connected my two Z+,Z- wires to pins 13 & 14 of TB2 on my card. My .hal file is correctly configured for homing with this Z phase. I've tested 5 encoders of the same type. but I can't find the Z pulse.Is there a trick? Can anyone help me? Thanks
Please Log in or Create an account to join the conversation.
- PCW
-
- Offline
- Moderator
-
Less
More
- Posts: 18778
- Thank you received: 5187
15 Jun 2025 21:18 #330321
by PCW
Replied by PCW on topic Tuning stepper motors with encoder or glass scale feedback
To check, in halcmd:
sets b-index-enable true
and watch b-index-enable in halshow
Then move the axis past an index mark
b-index-enable should go false when the index is detected
sets b-index-enable true
and watch b-index-enable in halshow
Then move the axis past an index mark
b-index-enable should go false when the index is detected
Please Log in or Create an account to join the conversation.
- JackRay
- Offline
- Elite Member
-
Less
More
- Posts: 203
- Thank you received: 14
17 Jun 2025 19:42 #330412
by JackRay
Replied by JackRay on topic Tuning stepper motors with encoder or glass scale feedback
yes, I checked all that with 4 encoders but I never saw any change in the Z signal. I think my .hal is compliant. Could there be a connection subtlety on the 7i96s card?
Please Log in or Create an account to join the conversation.
- PCW
-
- Offline
- Moderator
-
Less
More
- Posts: 18778
- Thank you received: 5187
17 Jun 2025 20:48 - 17 Jun 2025 20:52 #330416
by PCW
Replied by PCW on topic Tuning stepper motors with encoder or glass scale feedback
You are not guaranteed to see any change in the Z signal
as its a short pulse and quite hard to catch at the 1 KHz servo thread.
(especially with higher resolution scales)
This is why the actual index event is captured in hardware.
The index (Z) signal is only provided as a hal signal for debugging
or using it as a GP input. It's normally not of any other use.
If index enable goes false on an index event, the index was detected.
as its a short pulse and quite hard to catch at the 1 KHz servo thread.
(especially with higher resolution scales)
This is why the actual index event is captured in hardware.
The index (Z) signal is only provided as a hal signal for debugging
or using it as a GP input. It's normally not of any other use.
If index enable goes false on an index event, the index was detected.
Last edit: 17 Jun 2025 20:52 by PCW. Reason: clarify
Please Log in or Create an account to join the conversation.
- JackRay
- Offline
- Elite Member
-
Less
More
- Posts: 203
- Thank you received: 14
18 Jun 2025 19:19 #330466
by JackRay
Replied by JackRay on topic Tuning stepper motors with encoder or glass scale feedback
I don't quite understand, but that means I could never use it as a homing device? my encoders are 2500 pulses/ 10000 pulses quadrature hole.
Please Log in or Create an account to join the conversation.
- PCW
-
- Offline
- Moderator
-
Less
More
- Posts: 18778
- Thank you received: 5187
18 Jun 2025 19:45 - 18 Jun 2025 19:49 #330469
by PCW
Replied by PCW on topic Tuning stepper motors with encoder or glass scale feedback
No, homing to index is common and fully supported.
I'm just saying that the actual index hal pin is not useful
for homing. The index-enable pin is what's used to communicate
index information from the hardware/driver to LinuxCNC
That is, this hal statement:
net phaseZ [HMOT](CARD0).encoder.00.input-index
Doesn't do anything useful.
But this hal statement:
net b-index-enable joint.3.index-enable <=> [HMOT](CARD0).encoder.00.index-enable
Allows LinuxCNC to enable index detection AND allows the driver to inform LinuxCNC
when the index has been detected.
To test whether the index hardware is working (assuming you can move the axis past
an index mark), you would:
With LinuxCNC running, use halshow to watch the signal b-index-enable
and then with either halshow or halcmd, set b-index-enable true"
halcmd sets b-index-enable true
halshow should now show b-index-enable true
now, if you move the axis past an index mark, b-index-enable should go false.
This is how you test for correct index operation.
I'm just saying that the actual index hal pin is not useful
for homing. The index-enable pin is what's used to communicate
index information from the hardware/driver to LinuxCNC
That is, this hal statement:
net phaseZ [HMOT](CARD0).encoder.00.input-index
Doesn't do anything useful.
But this hal statement:
net b-index-enable joint.3.index-enable <=> [HMOT](CARD0).encoder.00.index-enable
Allows LinuxCNC to enable index detection AND allows the driver to inform LinuxCNC
when the index has been detected.
To test whether the index hardware is working (assuming you can move the axis past
an index mark), you would:
With LinuxCNC running, use halshow to watch the signal b-index-enable
and then with either halshow or halcmd, set b-index-enable true"
halcmd sets b-index-enable true
halshow should now show b-index-enable true
now, if you move the axis past an index mark, b-index-enable should go false.
This is how you test for correct index operation.
Last edit: 18 Jun 2025 19:49 by PCW.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
- JackRay
- Offline
- Elite Member
-
Less
More
- Posts: 203
- Thank you received: 14
19 Jun 2025 17:02 #330520
by JackRay
Replied by JackRay on topic Tuning stepper motors with encoder or glass scale feedback
what do you think of my configuration:
# --- Encodeur configuration ---
setp [HMOT](CARD0).encoder.00.counter-mode 0
setp [HMOT](CARD0).encoder.00.filter 0
setp [HMOT](CARD0).encoder.00.scale [JOINT_3]ENCODER_B_SCALE
#setp [HMOT](CARD0).encoder.00.index-enable true
setp [HMOT](CARD0).encoder.00.index-mask 1
setp [HMOT](CARD0).encoder.00.index-invert 0
setp [HMOT](CARD0).encoder.00.index-mask-invert 0
# --- Feedback position/velocity via encodeur ---
net b-pos-fb <= [HMOT](CARD0).encoder.00.position
net b-pos-fb => pid.b.feedback
net b-pos-fb => joint.3.motor-pos-fb
net b-vel-fb <= [HMOT](CARD0).encoder.00.velocity
# --- Index pour homing ---
net b-index-enable joint.3.index-enable <=> [HMOT](CARD0).encoder.00.index-enable
net phaseZ [HMOT](CARD0).encoder.00.input-index
# --- Raw counts (optionnel debug) ---
net b-pos-rawcounts <= [HMOT](CARD0).encoder.00.rawcounts
# --- Switches (home et fins de course) ---
net b-home-sw => joint.3.home-sw-in
net b-neg-limit => joint.3.neg-lim-sw-in
net b-pos-limit => joint.3.pos-lim-sw-in
# --- Encodeur configuration ---
setp [HMOT](CARD0).encoder.00.counter-mode 0
setp [HMOT](CARD0).encoder.00.filter 0
setp [HMOT](CARD0).encoder.00.scale [JOINT_3]ENCODER_B_SCALE
#setp [HMOT](CARD0).encoder.00.index-enable true
setp [HMOT](CARD0).encoder.00.index-mask 1
setp [HMOT](CARD0).encoder.00.index-invert 0
setp [HMOT](CARD0).encoder.00.index-mask-invert 0
# --- Feedback position/velocity via encodeur ---
net b-pos-fb <= [HMOT](CARD0).encoder.00.position
net b-pos-fb => pid.b.feedback
net b-pos-fb => joint.3.motor-pos-fb
net b-vel-fb <= [HMOT](CARD0).encoder.00.velocity
# --- Index pour homing ---
net b-index-enable joint.3.index-enable <=> [HMOT](CARD0).encoder.00.index-enable
net phaseZ [HMOT](CARD0).encoder.00.input-index
# --- Raw counts (optionnel debug) ---
net b-pos-rawcounts <= [HMOT](CARD0).encoder.00.rawcounts
# --- Switches (home et fins de course) ---
net b-home-sw => joint.3.home-sw-in
net b-neg-limit => joint.3.neg-lim-sw-in
net b-pos-limit => joint.3.pos-lim-sw-in
Please Log in or Create an account to join the conversation.
- Configuring LinuxCNC
- Advanced Configuration
- Tuning stepper motors with encoder or glass scale feedback
Time to create page: 0.219 seconds