setting up threading with a missing tooth encoder on a lathe

More
28 Mar 2023 13:27 #267698 by rowow
Hello I am using linux 2.9 with a G0602 lathe im converting to CNC and already have the X and Z axis converted. I want to setup threading capability but am having issues (mostly I dont know what im doing or where to start from). Im using a 60 tooth encoder with 1 missing tooth with a parallel port breakout board. I have the two phase pins from the encoder (DAOKI LM393) running to pins 10 and 11 on the board. It reads the RPM but gives double the rpm, so when I set the missing teeth in the hal file to 2 it fixes itself. Then when I try to run a test g33 command it says "spindle not turning in g33". Im stuck and not sure how to proceed. I have attached the hal file to the post.
Attachments:

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

More
31 Mar 2023 08:27 #267955 by bkt
think first of all need to clarify to yourself encoder signal .... if you have 1 channel you can see Upper level and 0V level .... so 2 encoder signal .... with 2 channel you can see 4 encoder signal .... for better explain, normally a 2500 step encoder generate 10000 pulses every revolution .... so based on these you need to calculate reduction ratio too .... maybe 1 lathe revolution on 2500 pulses encoder have 10.000.000 of pulses ....

regards

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

More
01 Apr 2023 19:57 #268032 by rowow
sorry I dont quite understand. so each time it switches from low to high and vice versa is considered a encoder signal? since I have 60 slots (with one missing) that would mean my encoder scale should be 120?

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

More
18 Apr 2023 22:33 - 18 Apr 2023 22:33 #269386 by smc.collins
add a additional sensor and give it 1 tooth for the Z or index pulse, and then use a 60 tooth wheel with all 60 teeth by adding the missing tooth back, OR turn it into a 30 tooth wheel, by removing every other tooth and then adding a second sensor at 30 degrees otomh. ORRRR get a cheap 600ppr encoder with a A B and Z pulse and put that on. I have a 1024ppr with A B and Z on my lathe, very good very nice.
Last edit: 18 Apr 2023 22:33 by smc.collins.

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

More
18 Apr 2023 23:38 - 18 Apr 2023 23:46 #269390 by joekline9
I think there is a way to generate a fake index pulse every time the spindle completes a turn. So you could just use your 60 tooth encoder.
 You also need to set spindle.0.at-speed in hal.
Last edit: 18 Apr 2023 23:46 by joekline9.

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

More
19 Apr 2023 12:58 #269425 by smc.collins
you'd have to write a low level driver at the fpga and decode it with a tpu state machine, to have it be useful and low latency.

the output would be in degrees and distance, and it's definitely doable. the tooth period would get to short for a hal component with any significant rpm.

it's easier and more reliable to just use a standard a b z encoder.

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

More
19 Apr 2023 17:31 #269433 by JPL
There is such a thing as encoder.N.missing-teeth see here: manpages.debian.org/testing/linuxcnc-uspace/encoder.9.en.html
and here: github.com/LinuxCNC/linuxcnc/blob/master...components/encoder.c

And it is working. See here: forum.linuxcnc.org/24-hal-components/431...he-encoder-component

This been added sometime ago by Andy I believe.
 

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

More
19 Apr 2023 17:40 - 19 Apr 2023 17:41 #269437 by JPL
Original video from Andy:
Last edit: 19 Apr 2023 17:41 by JPL.
The following user(s) said Thank You: joekline9

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

More
19 Apr 2023 18:27 #269442 by andypugh
The missing-tooth index scheme would generally be used with a single sensor (it's a way to save wires).

You seem to be using one pin for phase A and one for index (Z). I am not sure how that works with a missing-index scheme, I suspect that it will simply ignore the Z phase.

I think that you can (probably) use phases A and B (and no Z) to detect speed _and_ direction and rely on the missing tooth for index, but I don't think I actually tested that...

You have set counter-mode = true, so it should be able to work with a single phase (A)

Make sure that the spindle encoder position _increases_ by 1.0 for each revolution of the lathe spindle in the positive direction (ie, clockwise looking down the spindle axis towards the workpiece)

If it decreases then I am a bit puzzled, as it shouldn't be able to with only one phase pin and index

Does it detect the index? You should be able to test this by (at the command line) "halcmd sets spindle-index-enable 1" then rotating the spindle past index and using "halcmd show sig spindle-index-enable" and it should have set back to false.
The following user(s) said Thank You: joekline9, Stanislavz

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

Time to create page: 0.511 seconds
Powered by Kunena Forum