Spindle as speed counter clockwise.

More
14 Aug 2017 13:07 #97449 by timmert
Hi

I have configured spindle at speed, working great (clockwise rotation)!
The lathe sometimes needs to run counter clockwise. The gui shows for example: -2.500RPM.
The problem is that the gcode doesn't continue and the spindle as speed led stays off.
How to solve this?

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

More
15 Aug 2017 08:56 - 15 Aug 2017 08:57 #97496 by timmert
I think the problem is that counter clockwise shows a negative value?

How can I configure it to show a positive value?
This is what I can find in my HAL file about the direction of the motor

net spindle-ccw => hm2_5i25.0.7i76.0.0.spindir

net spindle-cw <= motion.spindle-forward
net spindle-ccw <= motion.spindle-reverse

net spindle-manual-cw halui.spindle.forward
net spindle-manual-ccw halui.spindle.reverse
Last edit: 15 Aug 2017 08:57 by timmert.

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

More
15 Aug 2017 12:50 #97502 by photomankc
Look at this:
linuxcnc.org/docs/2.4/html/hal_components.html#r1_2_1

You can feed the RPMs into that and it's output should always be a positive value. I'm not sure exactly where in your HAL that would need to be placed.

linuxcnc.org/docs/html/examples/spindle.html

That link explains how spindle-at-speed can be setup so you can probably look through your HAL to see how it's done and where to insert the ABS component to eliminate the sign.

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

More
15 Aug 2017 13:19 #97505 by andypugh

Hi

I have configured spindle at speed, working great (clockwise rotation)!
The lathe sometimes needs to run counter clockwise. The gui shows for example: -2.500RPM.
The problem is that the gcode doesn't continue and the spindle as speed led stays off.
How to solve this?


What drives your spindle-at-speed input?

You probably have motion.spindle-speed-out-abs connected to the hardware with separate fwd.rev logic.
It is likely that a "wcomp" or "near" component is being used to compare the spindle speed feedback from the encoder to the commanded speed, but it is probably looking at the absolute version of the commanded speed.

The simplest answer is probably to connect the "near" to motion.spindle-speed-out-rps instead, which is a positive/negative number matching the encoder velocity output scaling and sign.

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

More
15 Aug 2017 13:50 - 15 Aug 2017 13:55 #97513 by timmert

File Attachment:

File Name: lathe.hal
File Size:10 KB


I do use the near component
Not sure anymore how to edit it

# ---Setup spindle at speed signals---

net spindle-vel-cmd-rps => near.0.in1
net spindle-vel-fb-rps => near.0.in2
net spindle-at-speed motion.spindle-at-speed <= near.0.out
setp near.0.scale 1.10
Attachments:
Last edit: 15 Aug 2017 13:55 by timmert.

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

More
15 Aug 2017 14:07 #97516 by andypugh
OK, that HAL looks right to me.

Can you monitor near.0.in0 and near.0.in1 with halmeter and tell us the numbers at 500rpm fwd and 500 rpm reverse?

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

More
15 Aug 2017 14:14 #97517 by timmert
I don't see a near 0.in0 in the halmeter

I can see a near 0.in1 and 0.in2

0.1
CW 500RPM = 8.33333....
CCW 500RPM = - 8.3333...

0.2
CW 500RPM = 8.5
CCW 500RPM = 8.5

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

More
15 Aug 2017 15:09 #97519 by andypugh

0.1
CW 500RPM = 8.33333....
CCW 500RPM = - 8.3333...

0.2
CW 500RPM = 8.5
CCW 500RPM = 8.5

net spindle-vel-cmd-rps => near.0.in1
net spindle-vel-fb-rps => near.0.in2
net spindle-at-speed motion.spindle-at-speed <= near.0.out
setp near.0.scale 1.10

This seems to say that spindle-vel-fb-rps does not go negative when the spindle reverses.
That is directly linked to the encoder, so that seems to indicate that the encoder only shows positive numbers.

And this is why:
setp    hm2_5i25.0.encoder.00.counter-mode 1

Do you only have a single-pulse spindle encoder by any chance? (Do you have index?)
counter-mode can's sense direction. If you do have a proper quadrature encoder then set that to 0.

If you don't have a quadrature encoder then one solution is to use:
net spindle-vel-cmd-rps-abs=> near.0.in1
instead of the current net.

A better solution is to fit a proper encoder, so you can do rigid tapping.
The following user(s) said Thank You: timmert

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

More
16 Aug 2017 07:45 - 16 Aug 2017 07:46 #97551 by timmert
Thanks Andy, it's working!

I have an index single and 150ppr encoder
It's a (rotary?) encoder connected to the spindle with a belt.
What do you recommend?
A index and quadrature encoder?
Last edit: 16 Aug 2017 07:46 by timmert.

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

More
16 Aug 2017 09:07 #97555 by andypugh
I would be surprised if the encoder is a single channel + index? Do you have the B-phase connected?

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

Time to create page: 0.114 seconds
Powered by Kunena Forum