Configuring step/dir Lathe spindle for threading

More
22 Sep 2012 17:23 - 22 Sep 2012 17:24 #24554 by Jonathan
I've just connected a 12Nm stepper motor to my micro lathe spindle in the hope that I can use it for threading, see here:



I've edited the .hal file to link the spindle control commands to the A-axis, which is where the motor is connected via a standard step/dir driver.
My question is how can I do threading using G33/G63? I could just treat the spindle as an A-axis and program a move in Z and A to make the thread, but that seems a bit crude and I think it would require separate configurations to run as a rotary axis and a spindle?

It seems that the encoder needs to be enabled for G33 to work, so could I, by editing the .hal file, link the non-existent encoder to the motor step signal divided by the right ratio to get one pulse per revolution?

I've attached my current .hal file as I'm not sure I've done everything right - for a start I'm in mill not lathe mode!

File Attachment:

File Name: CNC_Lathe.hal
File Size:4 KB


Thanks in advance...
Attachments:
Last edit: 22 Sep 2012 17:24 by Jonathan.

Please Log in or Create an account to join the conversation.

More
24 Sep 2012 12:02 #24580 by andypugh
Jonathan wrote:

I've just connected a 12Nm stepper motor to my micro lathe spindle in the hope that I can use it for threading, see here:

This seems like a slightly odd thing to do. Would it not have been simpler to have attached an encoder and threaded in the normal way?

My question is how can I do threading using G33/G63?

Onterestingly, a stepper motor can be used as an encoder, as they produce quadrature pulses. But that is probably not any help as such, but does suggest one way to proceed.

For spindle synchronised moves you need to connect up the motion.spindle-revs and motion.spindle-index-enable pins.
The former would be trivial (stepgen.3.position-fb woudl be ideal) but the index-enable pin is much more difficult. That requires a once-per rev signal, then when it goes high simultaneously zeros the encoder position and takes the enable pin low to indicate that is has indexed.

One way of doing this would be to use the sim-encoder HAL function, combined with the encoder HAL function. (though that does seem a little eccentric)
www.linuxcnc.org/docs/html/man/man9/sim_encoder.9.html
You would need to connect the sim-encoder.0.speed pin to the same HAL signal as the stepgen velocity input. You can then connect the A/B/Z phases from the simulated encoder to the encoder counter, and it will act like a real encoder as far as the rest of the system is concerned.
It would be more sensible to do it with a custom component which simply emulated the index-enable pin behaviour, but that would involve writing a custom component. (it might already have been done)

Please Log in or Create an account to join the conversation.

More
15 May 2020 21:44 #167893 by xenon-alien
Hello!

I'm new in LinuxCNC. (a few weeks I'm reading and watching videos about it)
There are a PC with MESA 5i25 + 7i76 + a working lathe.
Here is the lathe setup:

File Attachment:

File Name: my_LinuxCN...hine.rar
File Size:8 KB

Is it possible to use M19 command for positioning the spindle with a step/dir configuration using a closed loop stepper motor like a spindle?
Need all functions: threading, positioning and continuous rotation.
I saw also this topic , but not really understanding yet the HAL files, but I'm trying.
Images you can find on another forum link1 link2

I will appreciate any advice's.
My English not is the best, so sorry about it. (I'm from Ukraine)
Attachments:

Please Log in or Create an account to join the conversation.

Time to create page: 0.132 seconds
Powered by Kunena Forum