- Posts: 31
- Thank you received: 0
Lathe threading random start
- DEVILHUNTER
- Topic Author
- Offline
- Junior Member
-
Less
More
4 years 2 months ago #250789
by DEVILHUNTER
Lathe threading random start was created by DEVILHUNTER
I'm retrofitting my manual lathe with LinuxCNC and I'm stuck with the threading. It's wierd because I have used the same computer and encoder to rigid tap in my mill without problems.
When I perform a G76 cycle, the machine does all it should do, but the threads looks weird, like each pass started in a random position. At first, after configuring the encoder in stepconfig I found the Index was inverted and that made sense, but after inverting the signal it still looked weird.
Got a couple of parts that looked like buttress thread and thought that I may have the compound angle parameter wrong (Q), since I was doing OD thread with an ID tool going backwards. But still did not work either with Q30, Q0 or Q-30. Found somebody with a similar looking issue:
www.forum.linuxcnc.org/38-general-linuxc...ions/38627-g76-issue
Then added the "near" component to the spindle speed to activate the index-enable. Althought it shoulnd't be needed as the threading was starting, I got even more random thread starts.
I'm using LinuxCNC 2.7.14 on parallel port, not ideal but it's fast enough (400rpm at 360ppr) as I have not been able to update this old PC to a newer version. Have adjusted the encoder pots to get the cleanest A/B/Z signals and they look really great on the halscope, plus the pitch is perfect.
Don't think is backlash either, as it's always going in the same direction and would be compensated at thread start. Have also checked for noise in the Index signal, but looked perfect in halscope.
My last bullet will be to do try a "threading without index" component.
This is my HAL file:
Thanks to everyone!
When I perform a G76 cycle, the machine does all it should do, but the threads looks weird, like each pass started in a random position. At first, after configuring the encoder in stepconfig I found the Index was inverted and that made sense, but after inverting the signal it still looked weird.
Got a couple of parts that looked like buttress thread and thought that I may have the compound angle parameter wrong (Q), since I was doing OD thread with an ID tool going backwards. But still did not work either with Q30, Q0 or Q-30. Found somebody with a similar looking issue:
www.forum.linuxcnc.org/38-general-linuxc...ions/38627-g76-issue
Then added the "near" component to the spindle speed to activate the index-enable. Althought it shoulnd't be needed as the threading was starting, I got even more random thread starts.
I'm using LinuxCNC 2.7.14 on parallel port, not ideal but it's fast enough (400rpm at 360ppr) as I have not been able to update this old PC to a newer version. Have adjusted the encoder pots to get the cleanest A/B/Z signals and they look really great on the halscope, plus the pitch is perfect.
Don't think is backlash either, as it's always going in the same direction and would be compensated at thread start. Have also checked for noise in the Index signal, but looked perfect in halscope.
My last bullet will be to do try a "threading without index" component.
This is my HAL file:
Warning: Spoiler!
Code:
loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt hal_parport cfg="0 out"
setp parport.0.reset-time 1000
loadrt stepgen step_type=0,0
loadrt encoder num_chan=1
loadrt abs names=abs.spindle
loadrt lowpass names=lowpass.spindle
loadrt scale names=scale.spindle
loadrt near
loadrt debounce cfg="6"
setp debounce.0.delay 100
addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf encoder.update-counters base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread
addf scale.spindle servo-thread
addf abs.spindle servo-thread
addf lowpass.spindle servo-thread
addf near.0 servo-thread
addf stepgen.capture-position servo-thread
addf encoder.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
net spindle-cmd-rpm <= motion.spindle-speed-out
net spindle-cmd-rpm-abs <= motion.spindle-speed-out-abs
net spindle-cmd-rps <= motion.spindle-speed-out-rps
net spindle-cmd-rps-abs <= motion.spindle-speed-out-rps-abs
net spindle-at-speed => motion.spindle-at-speed
setp encoder.0.position-scale 1440.000000
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-vel-fb-rps encoder.0.velocity => motion.spindle-speed-in
net spindle-index-enable encoder.0.index-enable <=> motion.spindle-index-enable
net spindle-phase-a encoder.0.phase-A
net spindle-phase-b encoder.0.phase-B
net spindle-index encoder.0.phase-Z
# ---Setup spindle at speed signals---
net spindle-cmd-rps => near.0.in1
net spindle-vel-fb-rps => near.0.in2
net spindle-at-speed <= near.0.out
#sets spindle-at-speed true
setp near.0.scale 1.250000
setp near.0.difference 0.000000
# Use ACTUAL spindle velocity from spindle encoder
# spindle-velocity bounces around so we filter it with lowpass
# spindle-velocity is signed so we use absolute component to remove sign
# ACTUAL velocity is in RPS not RPM so we scale it.
setp scale.spindle.gain 60
setp lowpass.spindle.gain 1.000000
net spindle-vel-fb-rps => scale.spindle.in
net spindle-fb-rpm scale.spindle.out => abs.spindle.in
net spindle-fb-rpm-abs abs.spindle.out => lowpass.spindle.in
net spindle-fb-rpm-abs-filtered lowpass.spindle.out
net xstep => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
net xdir => parport.0.pin-03-out
net zstep => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
net zdir => parport.0.pin-05-out
net spindle-phase-a <= parport.0.pin-10-in-not
net spindle-phase-b <= parport.0.pin-11-in
net spindle-index <= parport.0.pin-12-in-not
setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 35000
setp stepgen.0.dirsetup 35000
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable axis.0.amp-enable-out => stepgen.0.enable
setp stepgen.1.position-scale [AXIS_2]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 35000
setp stepgen.1.dirsetup 35000
setp stepgen.1.maxaccel [AXIS_2]STEPGEN_MAXACCEL
net zpos-cmd axis.2.motor-pos-cmd => stepgen.1.position-cmd
net zpos-fb stepgen.1.position-fb => axis.2.motor-pos-fb
net zstep <= stepgen.1.step
net zdir <= stepgen.1.dir
net zenable axis.2.amp-enable-out => stepgen.1.enable
net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in
loadusr -W hal_manualtoolchange
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
Thanks to everyone!
Please Log in to join the conversation.
4 years 2 months ago #250803
by robh
Replied by robh on topic Lathe threading random start
hi, i had this same problem before and it was the encoder shaft screw had come loose on flex coupling on the spindle .. so i would check the encoder couplers
thread at one spindle speed, then speed it up and see what happens if it starts to cut in a different place then you know its a encoder issue, just you have to figure out if its mechanical or electrical, and id guess more mechanical
thread at one spindle speed, then speed it up and see what happens if it starts to cut in a different place then you know its a encoder issue, just you have to figure out if its mechanical or electrical, and id guess more mechanical
Please Log in to join the conversation.
- DEVILHUNTER
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 31
- Thank you received: 0
4 years 2 months ago #250872
by DEVILHUNTER
Replied by DEVILHUNTER on topic Lathe threading random start
Thanks Robh. I don't think is something mechanical as the encoder and spindle pulleys are press fitted. Anyways checked them and there is no slipage.
Decided to do some more checking. Put an indicator on the chuck jaw and rotated the spindle by hand one turn, then other turn backwards, until encoder.rawcounts in halmeter went back to 0. The indicator shows that did not went back to original position maybe by a couple of degrees. Encoder is 360ppr in quadrature so the error is bigger than the resolution, seems that I'm loosing a few counts.
I have tried duplicatin the base-period just in case I had some unexpected high jitter, also deleted the parport reset time, but again same result.
Funny thing is that it seems to loose steps always in the same direction, no matter what direction I rotate the spindle first. Anyways this error is small and does not fit the random start I'm getting, at least on the start of the thread.
I will check again the A/B sinals in halscope. Also will connect the encoder to the MESA 7i76e of my mill to discard problems either on the encoder or the lathe BOB.
Decided to do some more checking. Put an indicator on the chuck jaw and rotated the spindle by hand one turn, then other turn backwards, until encoder.rawcounts in halmeter went back to 0. The indicator shows that did not went back to original position maybe by a couple of degrees. Encoder is 360ppr in quadrature so the error is bigger than the resolution, seems that I'm loosing a few counts.
I have tried duplicatin the base-period just in case I had some unexpected high jitter, also deleted the parport reset time, but again same result.
Funny thing is that it seems to loose steps always in the same direction, no matter what direction I rotate the spindle first. Anyways this error is small and does not fit the random start I'm getting, at least on the start of the thread.
I will check again the A/B sinals in halscope. Also will connect the encoder to the MESA 7i76e of my mill to discard problems either on the encoder or the lathe BOB.
Please Log in to join the conversation.
- DEVILHUNTER
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 31
- Thank you received: 0
4 years 1 month ago #251160
by DEVILHUNTER
Replied by DEVILHUNTER on topic Lathe threading random start
Another test in halscope. All signal seems to be reliable, I don't see any missed ones. A/B channels are not exactly 50% but maybe 40/60. I don't see any missed pulse:
Also checked the halscope log. I can se how there is at least two readings per quadrature phase change so should be enough for LinuxCNC to read all encoder pulses.
Attachment not found
Also checked the halscope log. I can se how there is at least two readings per quadrature phase change so should be enough for LinuxCNC to read all encoder pulses.
Please Log in to join the conversation.
4 years 1 month ago #251161
by scotth
Replied by scotth on topic Lathe threading random start
What about the marker pulse? Also, are you giving the thread enough lead in for a good sync?
Please Log in to join the conversation.
4 years 1 month ago #251366
by andypugh
Replied by andypugh on topic Lathe threading random start
Is the index exactly 1:1 with the spindle?
Please Log in to join the conversation.
- DEVILHUNTER
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 31
- Thank you received: 0
4 years 1 month ago #251535
by DEVILHUNTER
Replied by DEVILHUNTER on topic Lathe threading random start
I think I'm giving enough room for other tasks. Have tested increasing the base thread to double without any change. The machine moves just right so the steps are generated right, and they have higher rate than encoder counts. Don't see any missed steps on them but haven't carefully checked. Did some threads again and the pitch was perfect, bot at 100 and 700rpm.
Both encoder and spindle pulleys are made from the same CAD file. Belt is HTD and the pulleys are press fitted, so the relation is 1:1 for sure. Also checked again in halscope the shape of the index signal and I see a clean signal, evenly spaced and without noise.
Connected the encoder to my 7i76e and checked the movement with the comparator against the chuck jaw. Turned the spindle a few turns in one direction, reading the encoder rawcounts each turn. Then turned it back to 0. Still see some error in the numbers but not too much, a few counts.
This weekend I will connect everything to the 7i76e and do a fresh config on my mill computer with LCNC 2.8.0
Both encoder and spindle pulleys are made from the same CAD file. Belt is HTD and the pulleys are press fitted, so the relation is 1:1 for sure. Also checked again in halscope the shape of the index signal and I see a clean signal, evenly spaced and without noise.
Connected the encoder to my 7i76e and checked the movement with the comparator against the chuck jaw. Turned the spindle a few turns in one direction, reading the encoder rawcounts each turn. Then turned it back to 0. Still see some error in the numbers but not too much, a few counts.
This weekend I will connect everything to the 7i76e and do a fresh config on my mill computer with LCNC 2.8.0
Please Log in to join the conversation.
- tommylight
-
- Away
- Administrator
-
Less
More
- Posts: 22012
- Thank you received: 4
4 years 1 month ago #251539
by tommylight
-
Had a new encoder, cheap china one, on one side it would count perfectly, on the other side the pulses would get shorter with speed on one chanel. Changed to another of the same make and model and it worked.
Caused plenty of head scratching.
Replied by tommylight on topic Lathe threading random start
That points to encoder interference or fault, do you have another encoder to test with?Turned the spindle a few turns in one direction, reading the encoder rawcounts each turn. Then turned it back to 0. Still see some error in the numbers but not too much, a few counts.
-
Had a new encoder, cheap china one, on one side it would count perfectly, on the other side the pulses would get shorter with speed on one chanel. Changed to another of the same make and model and it worked.
Caused plenty of head scratching.
Please Log in to join the conversation.
4 years 1 month ago #251547
by andypugh
The error isn't by any chance 1000 v 1024 is it? Both are common.
Replied by andypugh on topic Lathe threading random start
Do 10 (or 20, or more) full turns and see if the error accumulates or is constant (and therefore due only to how accurately you can do a single turn)Connected the encoder to my 7i76e and checked the movement with the comparator against the chuck jaw. Turned the spindle a few turns in one direction, reading the encoder rawcounts each turn. Then turned it back to 0. Still see some error in the numbers but not too much, a few counts.
The error isn't by any chance 1000 v 1024 is it? Both are common.
Please Log in to join the conversation.
4 years 1 month ago #251549
by andypugh
Replied by andypugh on topic Lathe threading random start
Actually, forget that. The threading start doesn't depend on the scale at all, it all resets to index at the start of each pass.
Do 10 (or 20, or more) full turns and see if the error accumulates or is constant (and therefore due only to how accurately you can do a single turn)
The error isn't by any chance 1000 v 1024 is it? Both are common.
Please Log in to join the conversation.
Time to create page: 2.949 seconds
