Spindle as speed counter clockwise.

More
9 years 2 months ago #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 to join the conversation.

More
9 years 2 months ago #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

Please Log in to join the conversation.

More
9 years 2 months ago #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 to join the conversation.

More
9 years 2 months ago #97505 by andypugh

timmert wrote: 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 to join the conversation.

More
9 years 2 months ago #97513 by timmert

Attachment not found



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

Please Log in to join the conversation.

More
9 years 2 months ago #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 to join the conversation.

More
9 years 2 months ago #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 to join the conversation.

More
9 years 2 months ago #97519 by andypugh

timmert wrote: 0.1
CW 500RPM = 8.33333....
CCW 500RPM = - 8.3333...

0.2
CW 500RPM = 8.5
CCW 500RPM = 8.5

Code:
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:
Code:
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:
Code:
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.

Please Log in to join the conversation.

More
9 years 2 months ago #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?

Please Log in to join the conversation.

More
9 years 2 months ago #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 to join the conversation.

Time to create page: 0.116 seconds
Powered by Kunena Forum