Lathe threading Need some help...
16 Oct 2012 03:37 #25364
by JR1050
Lathe threading Need some help... was created by JR1050
I have been running my Emc'd Hardinge hnc for several moths turning various small pins,plugs ect,and it has been working fine.I recently took in a job to cut some 8mm od threads,this shouldn't be a problem as Ive run fanuc lathes for years. I set the job up,wrote the program.The machine will cut the first pass then cuts over the first pass,similar to cross threading,it finishes the cycle and done.Ive programmed it with both G33 and G76 ,same. Setup is 5i20,7i33.
Constant surface speed works fine and and the spindle turns the programmed rpm.
I was looking at the manual today and suspect I found the problem,I had the encoder counter set to quadrature. I set the counter to true and rest the encoder scale to the actual encoder value(2048 vs 8192 for quad). Now the machine gets to the G33 line and locks up,No synchronized movement.
My spindle commands are handled in a separate comp.
Below is the spindle section of my hal file. Encoder is 2048 accucoder,A,B,Z quad.Hardware is mesa.
# axis enable chain
newsig emcmot.01.enable bit
sets emcmot.01.enable true
net emcmot.01.enable => pid.1.enable
#net emcmot.01.enable => hm2_5i20.0.pwmgen.01.enable
net emcmot.01.enable <= axis.1.amp-enable-out
# encoder feedback
setp hm2_5i20.0.encoder.01.counter-mode 0
setp hm2_5i20.0.encoder.01.filter 1
setp hm2_5i20.0.encoder.01.index-invert 1
setp hm2_5i20.0.encoder.01.index-mask 0
setp hm2_5i20.0.encoder.01.index-mask-invert 0
setp hm2_5i20.0.encoder.01.scale [SPINDLE_1]INPUT_SCALE ## set in ini file to 8192
# set PID loop gains from inifile
setp pid.1.Pgain [SPINDLE_1]P
setp pid.1.Igain [SPINDLE_1]I
setp pid.1.Dgain [SPINDLE_1]D
setp pid.1.bias [SPINDLE_1]BIAS
setp pid.1.deadband [SPINDLE_1]DEADBAND
setp pid.1.maxoutput [SPINDLE_1]MAX_VELOCITY
# position command signals
setp hm2_5i20.0.pwmgen.01.output-type 1 #pwm on pin1, dir on pin2
##################enable m3 and m4#####################3
net spindle_on_for motion.spindle-forward = spindle.0.spindle-on-for
net spindle_on_rev motion.spindle-reverse = spindle.0.spindle-on-rev
net spl_enabled spindle.0.spl-enabled = hm2_5i20.0.pwmgen.01.enable
net mot_spl_on motion.spindle-on = spindle.0.mot-spl-on
# Set up spindle speed
setp hm2_5i20.0.pwmgen.01.scale 3000
net spindle_rpm_cmd motion.spindle-speed-out => hm2_5i20.0.pwmgen.01.value
# Attach the encoder to the motion and the scale
net spindle_rev_count motion.spindle-revs = hm2_5i20.0.encoder.01.position
net spindle_index_enable motion.spindle-index-enable = hm2_5i20.0.encoder.01.index-enable
net encoder_velocity motion.spindle-speed-in = hm2_5i20.0.encoder.01.velocity
I suspect the reason its cutting over its self is it see's 4 index pulses,but I cant seem to get it to work with the hm2_5i20.0.encoder.01.counter-mode set to true. What am I missing?Thanks in advance
Constant surface speed works fine and and the spindle turns the programmed rpm.
I was looking at the manual today and suspect I found the problem,I had the encoder counter set to quadrature. I set the counter to true and rest the encoder scale to the actual encoder value(2048 vs 8192 for quad). Now the machine gets to the G33 line and locks up,No synchronized movement.
My spindle commands are handled in a separate comp.
Below is the spindle section of my hal file. Encoder is 2048 accucoder,A,B,Z quad.Hardware is mesa.
# axis enable chain
newsig emcmot.01.enable bit
sets emcmot.01.enable true
net emcmot.01.enable => pid.1.enable
#net emcmot.01.enable => hm2_5i20.0.pwmgen.01.enable
net emcmot.01.enable <= axis.1.amp-enable-out
# encoder feedback
setp hm2_5i20.0.encoder.01.counter-mode 0
setp hm2_5i20.0.encoder.01.filter 1
setp hm2_5i20.0.encoder.01.index-invert 1
setp hm2_5i20.0.encoder.01.index-mask 0
setp hm2_5i20.0.encoder.01.index-mask-invert 0
setp hm2_5i20.0.encoder.01.scale [SPINDLE_1]INPUT_SCALE ## set in ini file to 8192
# set PID loop gains from inifile
setp pid.1.Pgain [SPINDLE_1]P
setp pid.1.Igain [SPINDLE_1]I
setp pid.1.Dgain [SPINDLE_1]D
setp pid.1.bias [SPINDLE_1]BIAS
setp pid.1.deadband [SPINDLE_1]DEADBAND
setp pid.1.maxoutput [SPINDLE_1]MAX_VELOCITY
# position command signals
setp hm2_5i20.0.pwmgen.01.output-type 1 #pwm on pin1, dir on pin2
##################enable m3 and m4#####################3
net spindle_on_for motion.spindle-forward = spindle.0.spindle-on-for
net spindle_on_rev motion.spindle-reverse = spindle.0.spindle-on-rev
net spl_enabled spindle.0.spl-enabled = hm2_5i20.0.pwmgen.01.enable
net mot_spl_on motion.spindle-on = spindle.0.mot-spl-on
# Set up spindle speed
setp hm2_5i20.0.pwmgen.01.scale 3000
net spindle_rpm_cmd motion.spindle-speed-out => hm2_5i20.0.pwmgen.01.value
# Attach the encoder to the motion and the scale
net spindle_rev_count motion.spindle-revs = hm2_5i20.0.encoder.01.position
net spindle_index_enable motion.spindle-index-enable = hm2_5i20.0.encoder.01.index-enable
net encoder_velocity motion.spindle-speed-in = hm2_5i20.0.encoder.01.velocity
I suspect the reason its cutting over its self is it see's 4 index pulses,but I cant seem to get it to work with the hm2_5i20.0.encoder.01.counter-mode set to true. What am I missing?Thanks in advance
Please Log in or Create an account to join the conversation.
16 Oct 2012 05:06 #25365
by cmorley
Replied by cmorley on topic Re:Lathe threading Need some help...
If you are using A,B and Index signals then you should use quadrature mode.
counter mode is for using one pulse per revolution indexing.
I wonder if there is electrical interference? Does it start in a different place every pass?
counter mode is for using one pulse per revolution indexing.
I wonder if there is electrical interference? Does it start in a different place every pass?
Please Log in or Create an account to join the conversation.
16 Oct 2012 11:55 #25368
by BigJohnT
Replied by BigJohnT on topic Re:Lathe threading Need some help...
JR1050 wrote:
The index pulse should only happen once per revolution of the spindle. It is possible that your index is not connected properly.
Short bit on encoders here:
gnipsel.com/linuxcnc/tuning/encoder.html
Just looking at my CHNC hal file and the only thing I set was the encoder scale, the rest are default settings.
John
I suspect the reason its cutting over its self is it see's 4 index pulses,but I cant seem to get it to work with the hm2_5i20.0.encoder.01.counter-mode set to true. What am I missing?Thanks in advance
The index pulse should only happen once per revolution of the spindle. It is possible that your index is not connected properly.
Short bit on encoders here:
gnipsel.com/linuxcnc/tuning/encoder.html
Just looking at my CHNC hal file and the only thing I set was the encoder scale, the rest are default settings.
John
Please Log in or Create an account to join the conversation.
16 Oct 2012 12:59 #25373
by JR1050
Replied by JR1050 on topic Re:Lathe threading Need some help...
I suspect it doesnt start in the same place every time.The Z axis postion is correct,but it seems as though the index pulse on the spindle(which I assume is what is timing the sychronization) is off . It seems as though this would have to be a lot of noise?
The fact that the machine tries to cut the thread,seems to indicate that I have the hal connections correct.....
anyone?
The fact that the machine tries to cut the thread,seems to indicate that I have the hal connections correct.....
anyone?
Please Log in or Create an account to join the conversation.
16 Oct 2012 14:30 - 16 Oct 2012 14:41 #25374
by PCW
Replied by PCW on topic Re:Lathe threading Need some help...
I would HALScope the A,B and INDEX signals to see what you have. These can be monitored on the GPIO pins that are used for the encoder (if you have standard encoders = 7I33TA, 7I47 daughtercards) this will not work with muxed encoders
It does sound like you have more than one index per spindle turn
Another way to check this is to comment out the index-enable line:
#net spindle_index_enable motion.spindle-index-enable = hm2_5i20.0.encoder.01.index enable
Then run LinuxCNC (with spindle drive safely disabled)
add a "show pin" LED on hm2_5i20.0.encoder.01.index enable
using the show hal configuration menu in Axis
then setp hm2_5i20.0.encoder.01.index enable true using the Axis show hal configuration menu
Now if you turn the spindle slowly by hand, and watch the index enable "LED". It should stay on until the index position is hit. There should only be one place that this happens in one spindle rotation. If the index enable gets cleared immediately regardless of spindle position, the index needs to be inverted.
It does sound like you have more than one index per spindle turn
Another way to check this is to comment out the index-enable line:
#net spindle_index_enable motion.spindle-index-enable = hm2_5i20.0.encoder.01.index enable
Then run LinuxCNC (with spindle drive safely disabled)
add a "show pin" LED on hm2_5i20.0.encoder.01.index enable
using the show hal configuration menu in Axis
then setp hm2_5i20.0.encoder.01.index enable true using the Axis show hal configuration menu
Now if you turn the spindle slowly by hand, and watch the index enable "LED". It should stay on until the index position is hit. There should only be one place that this happens in one spindle rotation. If the index enable gets cleared immediately regardless of spindle position, the index needs to be inverted.
Last edit: 16 Oct 2012 14:41 by PCW.
Please Log in or Create an account to join the conversation.
17 Oct 2012 02:20 #25392
by JR1050
Replied by JR1050 on topic Re:Lathe threading Need some help...
A huge thanks to PCW for his time on the phone today!! You advice about hal show made all the difference in tying this down.
Im sure stranger things have happened,but it turned out to be a bad encoder,brand new at that....go figure!
Thanks for the advice to all!!
Im sure stranger things have happened,but it turned out to be a bad encoder,brand new at that....go figure!
Thanks for the advice to all!!
Please Log in or Create an account to join the conversation.
Time to create page: 0.088 seconds