Need Help with Setup
10 May 2017 18:16 #92980
by brojt
Replied by brojt on topic Need Help with Setup
Thanks for the help. I tried but failed looks like Mach3 is the answer but kind of expensive. I have attached the portion of the hal configuration just in the likely event that I have something wrong.
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 <= motion.spindle-speed-out
setp encoder.0.position-scale 1
setp encoder.0.counter-mode 1
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-velocity 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
With this I get no index when I look at hal meter "spindle index" and no spindle on screen showing RPM's. I do get true and false on pin 10 in function.
I try to run a thread file using g76 and the tool moves to the start of the thread and then stops.
I guess I was hoping since there are so many hobby lathes running and thousands of very smart people using LinuxCNC that there would be a somewhat simple file to add to LinuxCNC that would allow a single prox or hall effect sensor to be able to do simple lathe threading. Looks like this is beyond me to accomplish. I realize that this type of setup would not do rigid tapping but would help the hobbyist with a minimum amount of parts to add to their lathe.
I do appreciate the help I received and hope to contributre in the future as I learn more about LinuxCNC.
Best to all,
Brojt
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 <= motion.spindle-speed-out
setp encoder.0.position-scale 1
setp encoder.0.counter-mode 1
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-velocity 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
With this I get no index when I look at hal meter "spindle index" and no spindle on screen showing RPM's. I do get true and false on pin 10 in function.
I try to run a thread file using g76 and the tool moves to the start of the thread and then stops.
I guess I was hoping since there are so many hobby lathes running and thousands of very smart people using LinuxCNC that there would be a somewhat simple file to add to LinuxCNC that would allow a single prox or hall effect sensor to be able to do simple lathe threading. Looks like this is beyond me to accomplish. I realize that this type of setup would not do rigid tapping but would help the hobbyist with a minimum amount of parts to add to their lathe.
I do appreciate the help I received and hope to contributre in the future as I learn more about LinuxCNC.
Best to all,
Brojt
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Away
- Platinum Member
-
Less
More
- Posts: 4978
- Thank you received: 1377
10 May 2017 19:18 #92990
by Todd Zuercher
Replied by Todd Zuercher on topic Need Help with Setup
Mach3 is never the answer (unless the question was "Name a crappy cnc cotroler that runs on Windows?")
We Just helped another fellow set up a similar lathe config for Linuxcnc to run on his (formerly) Mach3 lathe. (I believe that he can duel boot and run either.)
You should post your entire hal file, because there are a number of important details that are missing from your little snippets of the hal file you posted.
Things like the loadrt line for the encoder component and the input pins that your spindle sensor is connected to. (Lots of little details that need to be confirmed and set just right.)
We Just helped another fellow set up a similar lathe config for Linuxcnc to run on his (formerly) Mach3 lathe. (I believe that he can duel boot and run either.)
You should post your entire hal file, because there are a number of important details that are missing from your little snippets of the hal file you posted.
Things like the loadrt line for the encoder component and the input pins that your spindle sensor is connected to. (Lots of little details that need to be confirmed and set just right.)
The following user(s) said Thank You: rodw
Please Log in or Create an account to join the conversation.
10 May 2017 21:17 #92995
by brojt
Replied by brojt on topic Need Help with Setup
Thanks for your reply and insight. I do agree that Mach is not the answer. I use Linuxcnc on my mill as well as the lathe. I have found that Linuxcnc is a great program and it is my preference.
I have included my full hal file. I know that a single pulse is not the best but if I can get this working I can move up to an encoder with around 120 pulses. I do appreciate the help and I am not down on Linuxcnc, just somewhat frustrated as I don't know much about programming. This is a small lathe running 2 axis with stepper motors and one homing switch for the X axis, nothing else except one hall effect sensor attached to the spindle with one pulse per revolution. Here is my hal file that I couldn't get to work with the spindle:
# Generated by stepconf at Tue May 9 04:06:56 2017
# If you make changes to this file, they will be
# overwritten when you run stepconf again
loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt probe_parport
loadrt hal_parport cfg="0xcd00 out "
setp parport.0.reset-time 2000
loadrt stepgen step_type=0,0
loadrt encoder num_chan=1
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 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 <= motion.spindle-speed-out
setp encoder.0.position-scale 1
setp encoder.0.counter-mode 1
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-velocity 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
net dout-00 <= motion.digital-out-00
net dout-01 <= motion.digital-out-01
net dout-02 <= motion.digital-out-02
net ystep => parport.0.pin-01-out
setp parport.0.pin-01-out-reset 1
setp parport.0.pin-02-out-invert 1
net dout-01 => parport.0.pin-02-out
setp parport.0.pin-03-out-invert 1
net xdir => parport.0.pin-03-out
net zdir => parport.0.pin-04-out
net zstep => parport.0.pin-05-out
setp parport.0.pin-05-out-reset 1
setp parport.0.pin-06-out-invert 1
net dout-02 => parport.0.pin-06-out
setp parport.0.pin-07-out-invert 1
net ydir => parport.0.pin-07-out
net xstep => parport.0.pin-08-out
setp parport.0.pin-08-out-reset 1
setp parport.0.pin-14-out-invert 1
net dout-00 => parport.0.pin-14-out
net spindle-phase-a <= parport.0.pin-10-in
net home-x <= parport.0.pin-13-in
setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 30000
setp stepgen.0.dirsetup 30000
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
net home-x => axis.0.home-sw-in
setp stepgen.1.position-scale [AXIS_2]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 30000
setp stepgen.1.dirsetup 30000
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
I have included my full hal file. I know that a single pulse is not the best but if I can get this working I can move up to an encoder with around 120 pulses. I do appreciate the help and I am not down on Linuxcnc, just somewhat frustrated as I don't know much about programming. This is a small lathe running 2 axis with stepper motors and one homing switch for the X axis, nothing else except one hall effect sensor attached to the spindle with one pulse per revolution. Here is my hal file that I couldn't get to work with the spindle:
# Generated by stepconf at Tue May 9 04:06:56 2017
# If you make changes to this file, they will be
# overwritten when you run stepconf again
loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt probe_parport
loadrt hal_parport cfg="0xcd00 out "
setp parport.0.reset-time 2000
loadrt stepgen step_type=0,0
loadrt encoder num_chan=1
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 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 <= motion.spindle-speed-out
setp encoder.0.position-scale 1
setp encoder.0.counter-mode 1
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-velocity 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
net dout-00 <= motion.digital-out-00
net dout-01 <= motion.digital-out-01
net dout-02 <= motion.digital-out-02
net ystep => parport.0.pin-01-out
setp parport.0.pin-01-out-reset 1
setp parport.0.pin-02-out-invert 1
net dout-01 => parport.0.pin-02-out
setp parport.0.pin-03-out-invert 1
net xdir => parport.0.pin-03-out
net zdir => parport.0.pin-04-out
net zstep => parport.0.pin-05-out
setp parport.0.pin-05-out-reset 1
setp parport.0.pin-06-out-invert 1
net dout-02 => parport.0.pin-06-out
setp parport.0.pin-07-out-invert 1
net ydir => parport.0.pin-07-out
net xstep => parport.0.pin-08-out
setp parport.0.pin-08-out-reset 1
setp parport.0.pin-14-out-invert 1
net dout-00 => parport.0.pin-14-out
net spindle-phase-a <= parport.0.pin-10-in
net home-x <= parport.0.pin-13-in
setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 30000
setp stepgen.0.dirsetup 30000
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
net home-x => axis.0.home-sw-in
setp stepgen.1.position-scale [AXIS_2]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 30000
setp stepgen.1.dirsetup 30000
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
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Away
- Platinum Member
-
Less
More
- Posts: 4978
- Thank you received: 1377
11 May 2017 02:56 #93006
by Todd Zuercher
Replied by Todd Zuercher on topic Need Help with Setup
The main mistake I see is with the encoder inputs. Since you only have the one "index" pulse. You need to connect that signal to both the phase-a and phase-z of the encoder component.
Change these lines in your hal file.to this
I think that should get the feedback working. Then if later you connect a real encoder, you would want to change these lines back to what they were, and also set up the appropriate parallel port inputs.
Then to get some on screen indication of what is going on, you could set up a VCP like the one in the Axis lathe simulation. (infact it is pretty simple to add that exact one.)
Change these lines in your hal file.
net spindle-phase-a encoder.0.phase-A
net spindle-phase-b encoder.0.phase-B
net spindle-index encoder.0.phase-Z
net spindle-phase-a => encoder.0.phase-A => encoder.0.phase-Z
#net spindle-phase-b encoder.0.phase-B
#net spindle-index encoder.0.phase-Z
I think that should get the feedback working. Then if later you connect a real encoder, you would want to change these lines back to what they were, and also set up the appropriate parallel port inputs.
Then to get some on screen indication of what is going on, you could set up a VCP like the one in the Axis lathe simulation. (infact it is pretty simple to add that exact one.)
Please Log in or Create an account to join the conversation.
11 May 2017 20:42 #93047
by brojt
Replied by brojt on topic Need Help with Setup
Thanks for the help and input.
I changed the file to the suggested but the machine still stops at the G76 line. I now get a signal on Z and A when I rotate the spindle in the hal meter. It reads true when not on the magnet and false when the magnet passes the sensor. The changes did help but it seems I am still missing something. Trying to understand the program and with so many features I am at a complete loss. Guess I will just cut threads the old fashion way the lead screw.
My Best to all
Brojt
I changed the file to the suggested but the machine still stops at the G76 line. I now get a signal on Z and A when I rotate the spindle in the hal meter. It reads true when not on the magnet and false when the magnet passes the sensor. The changes did help but it seems I am still missing something. Trying to understand the program and with so many features I am at a complete loss. Guess I will just cut threads the old fashion way the lead screw.
My Best to all
Brojt
Please Log in or Create an account to join the conversation.
12 May 2017 08:56 - 12 May 2017 08:58 #93063
by Clive S
Replied by Clive S on topic Need Help with Setup
I had these problems when I first started threading with Lcnc try this;-
G0 G40 G18 G80 G21 G49 G95
G90 G7
F1.5 S470
M3
G4 P1
M7
(Change the fist X to the Dia P = the Pitch K = Thread depth)
G0 X10 Z10
G76 P1.5 Z-12 I-0.1 J0.1 R1 K1.5 Q29.5 L0 H1
g0 X30
g0 Z50
M9
M5
M2
%
I found that if you did not have the F set it would halt at the G76 line and the S peram has to be somewhere near the spindle speed.
G0 G40 G18 G80 G21 G49 G95
G90 G7
F1.5 S470
M3
G4 P1
M7
(Change the fist X to the Dia P = the Pitch K = Thread depth)
G0 X10 Z10
G76 P1.5 Z-12 I-0.1 J0.1 R1 K1.5 Q29.5 L0 H1
g0 X30
g0 Z50
M9
M5
M2
%
I found that if you did not have the F set it would halt at the G76 line and the S peram has to be somewhere near the spindle speed.
Last edit: 12 May 2017 08:58 by Clive S.
Please Log in or Create an account to join the conversation.
12 May 2017 14:53 #93096
by andypugh
Replied by andypugh on topic Need Help with Setup
With a single-pulse per rev you will get a better result with:
net spindle-position encoder.0.position-interpolated => motion.spindle-revs
Stopping at the beginning of the G76 normally means that the index isn't being seen.
If you put a halmeter on the spindle-index-enable signal do you see it go true at the start of the pass then false when the magnet passes the sensor?
net spindle-position encoder.0.position-interpolated => motion.spindle-revs
Stopping at the beginning of the G76 normally means that the index isn't being seen.
If you put a halmeter on the spindle-index-enable signal do you see it go true at the start of the pass then false when the magnet passes the sensor?
Please Log in or Create an account to join the conversation.
12 May 2017 15:51 #93102
by Clive S
Replied by Clive S on topic Need Help with Setup
Andy I think that if the feed rate was was missing the code stopped at the G76. I will have to do a test and check.
Please Log in or Create an account to join the conversation.
12 May 2017 16:59 #93104
by brojt
Replied by brojt on topic Need Help with Setup
Thanks for this,
I made the changes that Todd recommended and then:
I ran your suggested program and it ran perfectly. Well almost, I changed the speed to 75 RPM as that is about where I do threads manually and the Z was somewhat jumpy. I changed the speed back to 450 RPM and everything smoothed out and ran well.
Thanks so much for your help.
I made the changes that Todd recommended and then:
I ran your suggested program and it ran perfectly. Well almost, I changed the speed to 75 RPM as that is about where I do threads manually and the Z was somewhat jumpy. I changed the speed back to 450 RPM and everything smoothed out and ran well.
Thanks so much for your help.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Away
- Platinum Member
-
Less
More
- Posts: 4978
- Thank you received: 1377
12 May 2017 17:46 #93105
by Todd Zuercher
Replied by Todd Zuercher on topic Need Help with Setup
If you didn't do it yet, the change Andy suggested, may help a little with the jumpiness at slower spindle speeds.
changingto
But what would help a lot more would be adding either real encoder or at least multiple count/rev phase-A.
changing
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-position encoder.0.position-interpolated => motion.spindle-revs
But what would help a lot more would be adding either real encoder or at least multiple count/rev phase-A.
The following user(s) said Thank You: brojt
Please Log in or Create an account to join the conversation.
Time to create page: 0.094 seconds