10rpm Spindle Encoder

More
22 May 2014 22:14 #47208 by Poma
10rpm Spindle Encoder was created by Poma
I have what I think is an uncommon problem since I can't seem to find anything using search.

This is an 11KW servo spindle without encoder-to-drive feedback on the motor. The spindle on my machine is geared down to 10rpm, at which point it is belted to a 1024 encoder. At full speed, that is about 680 pulses per second, or 1 pulse every 1.5ms. The encoder is being counted by my Motenc card, and I have a DDT function determining speed from position. Unfortunately this doesn't work because the DDT is in the servo thread (1ms), so there is no change for half the scans, so it calculates a zero. Then one, then zero again. Maybe a 2 if I'm lucky.

Since I don't yet know this software very well, I don't have a good idea to fix it. Is there a robust way to measure the time accurately between pulses and calculate speed from that? Or, is it possible to create another thread that has, say 250ms or 500ms period, then put the DDT in that thread? I suppose I could change the encoder placement to the high-speed side of the gearbox, but I'd rather find a software solution.

I don't need threading, but I would like the ability to change the feedrate on each revolution (reduces vibrations). Also I would like to use the "Spindle at speed" signal (I have the logic, but am missing the speed from encoder, as said above).

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

More
22 May 2014 22:37 #47209 by andypugh
Replied by andypugh on topic 10rpm Spindle Encoder

Since I don't yet know this software very well, I don't have a good idea to fix it. Is there a robust way to measure the time accurately between pulses and calculate speed from that?.


The Pico and Mesa cards use internal time-stamping of the encoder edges to calculate a high-quality velocity output. Unfortunately the Motenc cards don't seem to (or, at least, the driver doesn't make a HAL pin for it).

You could try using ilowpass ( www.linuxcnc.org/docs/html/man/man9/ilowpass.9.html ) to smooth the input to the ddt, or lowpass ( www.linuxcnc.org/docs/html/man/man9/lowpass.9.html ) on the output of the ddt. or maybe both.

Another possibility is to change the belt ratio, you could run 10:1 and pretend it is a 10240 count per turn encoder. If you needed an index you could use a separate switch on the actual spindle to generate it.

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

More
22 May 2014 22:44 #47210 by ArcEye
Replied by ArcEye on topic 10rpm Spindle Encoder

Or, is it possible to create another thread that has, say 250ms or 500ms period, then put the DDT in that thread?


I don't know if that is the way to go, but yes it is possible

www.linuxcnc.org/docs/devel/html/man/man9/threads.9.html

The threads must be declared in order of speed (fastest first ) in your hal file

See this thread (no pun intended) for example
www.linuxcnc.org/index.php/english/forum...el-port-config#40554

I expect Andy or PCW will have a much better way, await incoming

regards

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

More
23 May 2014 01:41 #47213 by Poma
Replied by Poma on topic 10rpm Spindle Encoder
These are good ideas, guys. Thank you. Andy, I checked the hardware documentation from Vital Systems for the MOTENC and it has a timer built in. That would take some creative driver re-writing to get a period, even more so to get a velocity. I've never written a drive and I don't plan on jumping in that deep at this point.

I do think the Lowpass function could work. I would think use Lowpass on the input to the DDT so my position would be in float going into the DDT.

I'm a bit enamoured with the slow thread idea, just because that is what I would probably do on a PLC.

There is a way to software generate an index, iirc?

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

More
23 May 2014 03:58 #47214 by Poma
Replied by Poma on topic 10rpm Spindle Encoder
I plugged LowPass in front of the DDT with a 0.001 gain and it works great.

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

More
23 May 2014 19:20 #47251 by andypugh
Replied by andypugh on topic 10rpm Spindle Encoder

There is a way to software generate an index, iirc?


Maybe.

You can't just take every tenth index in HAL, because the 1mS thread will typically be too slow to spot the index pulse.
If the total counts is a power of 2, then watching for the change in state of a single bit in the total counts might be one way. You would then need to export that pulse as an output to a hardware pin and back into the encoder counter..

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

More
23 May 2014 21:16 - 23 May 2014 21:18 #47253 by PCW
Replied by PCW on topic 10rpm Spindle Encoder
A software index comp would be a generally useful device, with the proviso that
index location would be random at linuxcnc startup or encoder reset,
so dont restart linuxcnc and expect to resume threading...

something like:

if delta(abs(counts mod counts_turn)) > counts_turn/2 then index_det <= true


This would allow threading with a single pickup multi count/turn encoder
Last edit: 23 May 2014 21:18 by PCW.

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

More
23 May 2014 21:33 #47255 by andypugh
Replied by andypugh on topic 10rpm Spindle Encoder

A software index comp would be a generally useful device, with the proviso that
index location would be random at linuxcnc startup or encoder reset,


It actually exists on the Hostmot2 smart-serial encoders. You can emulate an index on a 7i73 for example.
However, that leaves the excess counts in place after the index-enable reset. (1027 becomes 3 counts on a 1024 count encoder, for example).

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

More
24 May 2014 00:44 #47261 by Poma
Replied by Poma on topic 10rpm Spindle Encoder
I'm starting to regret not getting the MESA card...it sounds really cool.

...because the 1mS thread will typically be too slow to spot the index pulse.

True for most spindles, but in my case the encoder count is never going to happen faster than 1ms per pulse (4x quadrature).

Just thought of something: divide the position by 1024 and put that in an integer. Run a DDT on the integer which will give me that "one" value every time it rolls over. Won't work for anyone with a normal speed spindle, though, but it will work for me!

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

More
24 May 2014 00:52 #47262 by andypugh
Replied by andypugh on topic 10rpm Spindle Encoder

Just thought of something: divide the position by 1024 and put that in an integer. Run a DDT on the integer which will give me that "one" value every time it rolls over. Won't work for anyone with a normal speed spindle, though, but it will work for me!


Looking at bit 9 with this component is easier (and less computationally intensive)
www.linuxcnc.org/docs/devel/html/man/man9/bitslice.9.html

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

Time to create page: 0.138 seconds
Powered by Kunena Forum