Lathe Spindle encoder with cheap (max. 50$) LPT Breakeout board

More
16 May 2018 21:46 #110793 by denhen89
denhen89 created the topic: Lathe Spindle encoder with cheap (max. 50$) LPT Breakeout board
Hello Guys,

after some time i again need your help, but this time (as you already noticed by the title) its not an problem with setting up my cnc router :), because it runs since about 3 month perfectly, also because of your help.

About 2 month ago i i bought an old (year 1974) heavy Lathe (TUD-50), which i want to restorate, install Linear guide rails and also convert to CNC.
First i wanted so much to have 2 MPG Handwheels for each axis, so i was sure to buy the 5i25 + 7i76 or just the 7i76E.
I wanted the handwheels, because of small quick jobs, where i dont want to spend much time to make an drawing + generating gcode, etc.., but an good friend told me that i can use NCGGUI for quick jobs and of course i can also do simple jobs just with the keyboard. I didnt know that there is something like NCGGUI, so since i know it, i stopped thinking about the MPG Handwheels

Now, the only reason i should buy the MESA cards would be, if the spindle encoder would not work properly with an cheap LPT breakeout board. I read, that some poeple had problems when it comes to higher RPMs. For example, until 300rpm everything worked fine, but above the read out (if i can say so..) wasnt correct anymore.
I am still an beginner and have never used encoders, but even if i wouldnt loose much money trying it with an cheap BOB, i dont want to loose much time and later waiting until the Mesa card arrives.
So, what i like to know is, if its possible to use the Software encoder and get it to work properpy at e.g. 1850 rpm at the spindle ?

Originally the Lathe had max. 1850rpm and i am not sure if the original spindle bearings survive, lets say 3000 rpm (i am also thinking which motor i shoud buy).

Much text, sorry for that, but currently i thinking much about it, because i wanted to start buying the electronic components for doing some tests and learn a bit and later the mechanical (until i find someone who will remove the bed ways etc.).

Thanks in advance.
Br, Denis
More
16 May 2018 22:09 #110795 by PCW
PCW replied the topic: Lathe Spindle encoder with cheap (max. 50$) LPT Breakeout board
A parallel port+BOB can work to almost any RPM but because then encoder signals are sampled by the base thread
this limits the maximum frequency that the encoder signals can be read reliably. The encoder frequency (count rate)
is the encoder counts per turn time the turns per second (RPM/60). In addition the base thread has jitter and the encoder signals will not be perfectly timed so you really want the maximum encoder count frequency to be about 1/3 of the base thread frequency

For example if you have a 25 KHz base thread (40000 ns) you would want a maximum count rate of about 8 KHz
This is what you get with a 100 line encoder (400 counts per turn) at 20 RPS = 1200 RPM

You can trade off resolution for RPM so you could go to 2400 RPM with a 50 line (200 count) encoder

Also you may not need the encoder to work at the highest spindle speeds unless you are threading at those speeds
More
16 May 2018 23:18 #110796 by denhen89
denhen89 replied the topic: Lathe Spindle encoder with cheap (max. 50$) LPT Breakeout board
Thank you PCW for your quick reply and the explanation.
I have to say that its a bit difficult for me right now and i feel a bit stupid.
I somehow understand what the problem is, but you were talking about base thread and jitter and now i am not sure if it has also something to do with the latency.
If so, my latency of my PC will be about 5000-7000 (which i know is pretty good), because i am curently looking for the same pc hardware as i have in my CNC Router PC and there i have an latency of 5000-7000.

Your calculation i do understand, but if i lower the resolution, then it would mean also lower accuracy of the spindle speed read out, correct? If so, that would mean the rpm wouldnt be that accurate at threading.
I think the spindle encoder is mainly for threading, but at what things an spindle encoder is necessary?

Sorry for asking those questions, but somehow i have to learn.
I am of course slowly thinking that i should just buy the 7i76 and then i can be sure everything will work good.
More
16 May 2018 23:54 - 17 May 2018 00:00 #110798 by PCW
PCW replied the topic: Lathe Spindle encoder with cheap (max. 50$) LPT Breakeout board
Yes jitter and latency are the same in this context, normally I think its suggested to set your base thread period to about 2 times the maximum latency so you should have a encoder sampling rate in the 50-60 KHz region. If you have a working configuration, you can determine this frequency by calculating the inverse of the base thread period in your .ini file (1000000000 /base thread period)

At 50 to 60 KHz you could read a 100 line (400 count) encoder up to about 2500-3000 RPM

And sure higher resolution encoders allow better tracking but 400 edges per turn is normally plenty for threading and rigid tapping, even a considerably lower resolution encoder can work well especially on a lathe because a lathe spindle typically has a large amount of inertia so even with variable loads the spindle speed doesn't change much between encoder edges

Its even possible to thread with a single pulse per turn spindle sensor (of course this depends on accurate speed control)

Single pulse per turn threading works because LinuxCNCs encoder component can estimate the spindle position based on
the time since the last pulse and the estimated RPM (based on the time between pulses) Of course this will fail if the
spindle RPM changes while threading
Last Edit: 17 May 2018 00:00 by PCW.
More
17 May 2018 10:32 - 17 May 2018 10:39 #110812 by denhen89
denhen89 replied the topic: Lathe Spindle encoder with cheap (max. 50$) LPT Breakeout board
Thanks again very much PCW. You help me a lot with those explanations, but i hope its fine if i still have some questions.

1.

Yes jitter and latency are the same in this context, normally I think its suggested to set your base thread period to about 2 times the maximum latency so you should have a encoder sampling rate in the 50-60 KHz region.

So, i should have encoder sampling rate of 50-60 KHz, if i have an Max Jitter (ns) result of 5000-7000, correct?

If so, then there are some things i dont understand.
I went to my CNC router PC and checked again the Latency tests (without any glxgears running and without stressing the cpu) and also i checked what Base Thread Period is written in my .ini file. See the picture below:

What i now dont understand is, that when i did the stepconf, i wrote in the value 7000 at the first screen at "Base Period Maximum Jitter" where the standart value is 15000.
So, why in my .ini file stands 31250 at "BASE_PERIOD" ?

I hope you understand that this all is pretty confusing for me, but i really would like to understand it, even it might be a bit difficult for me :)

The next thing:

you can determine this frequency by calculating the inverse of the base thread period in your .ini file (1000000000 /base thread period)

By doing this calculation 1000000000 / 31250 (BASE_PERIOD value in the .ini) i get this result: 32000
I am not sure what i should think about it, but of course this value does not show me the KHz value, so i did something wrong.
I hope you are patient enough with me :D Of copurse i tryed to find any official explanation about that, but it seems there are no informations available about the calculation.

EDIT: Everything else you wrote is pretty informative, and i understand that if my latency is that low (5000-7000) i can use an 100 line encoder to RPM up to 3000 and for sure i will have no higher RPMs, due to the original spindle bearings which are in good condition and i dont plan to change them for now.
Attachments:
Last Edit: 17 May 2018 10:39 by denhen89.
More
18 May 2018 21:59 #110857 by andypugh
andypugh replied the topic: Lathe Spindle encoder with cheap (max. 50$) LPT Breakeout board
Stepconf seems pretty conservative when choosing base thread rate. It might calculate it based on the actual step timing you need at max claimed speed.

It's easy enough to edit the INI and reduce the value.
More
18 May 2018 22:43 #110863 by denhen89
denhen89 replied the topic: Lathe Spindle encoder with cheap (max. 50$) LPT Breakeout board
You are right and i was thinking the same to reduce it in the .ini. Still. thanks for taht Andy.

Now i am still wondering how the calculation of the spindle encoder sampling rate works. Could you help me out with that. Even is someone would say (as PCW think i did ont he example with my latency of 5000-7000) that i should have an sampling rate of 50-60 Khz, i would still like to understand that, just to learn it :)

Thanks in advance.
More
18 May 2018 23:16 #110865 by andypugh
andypugh replied the topic: Lathe Spindle encoder with cheap (max. 50$) LPT Breakeout board

denhen89 wrote: Now i am still wondering how the calculation of the spindle encoder sampling rate works.


You already did the calculation, you just chose not to believe the answer.

1000000000 / 31250 = 32kHz

If you use a 10,000 base thread then you get 100kHz
More
19 May 2018 00:08 #110866 by denhen89
denhen89 replied the topic: Lathe Spindle encoder with cheap (max. 50$) LPT Breakeout board
Thank you very much ! :)
Now i know that i can also try it with an cheaper board, because it should theoretically work pretty good with the spindle "software encoder".

Andy, it would be great if you could answer me 2 questions:
1. I saw on your youtube videos that you are using 2 mpg handwheels on your lathe. Do you use them much? If so, more just for positioning or also for cutting ?
2. If i would also want to add 2 mpgs, how does it then work with the encoder sampling rate? 100 KHz no mater how many software encoder i use or does the sampling rate gets lower the more software encoder i use?

Thanks in advance!
More
19 May 2018 00:30 #110867 by andypugh
andypugh replied the topic: Lathe Spindle encoder with cheap (max. 50$) LPT Breakeout board

denhen89 wrote: 1. I saw on your youtube videos that you are using 2 mpg handwheels on your lathe. Do you use them much? If so, more just for positioning or also for cutting ?


I actually have 4 mpgs on the lathe, one for feed override, one for spindle override and the X and Z ones on the saddle.

I use them a lot. Both for positioning before starting a cycle and for touching-off, and also for some machining (mainly for parting rather than other ops)

2. If i would also want to add 2 mpgs, how does it then work with the encoder sampling rate? 100 KHz no mater how many software encoder i use or does the sampling rate gets lower the more software encoder i use?


Every encoder is sampled every rev, so they all work at the same speed irrespective of how many there are.

Though I should point out that my lathe has a big collection of Mesa cards. There is even a 7i73 in the saddle just to handle the MPGs and the limit switches (so that the only wire from the saddle to the main controller is a single CAT5)
Time to create page: 0.116 seconds
Powered by Kunena Forum