Minnimum Spinlde Speed

More
07 Nov 2018 22:29 #120215 by davidimurray
Hi

I'm a Linuxnc newbie but after a few weeks of learning I now have my CNC lathe working pretty well with gmoccapy and Nativecam and I've started making some bits. Having used Mach3 for over 10 years it is a bit of a culture shock but I think I am becoming a Linuxcnc convert ;)


One issue I have is that my lathe minimum speed isn't great and while it will run down to 100rpm, it doesn't have much torgue below 300rpm, So when I try and use CSS I find that the commanded speed is too slow.


Is there a way I could put a statement in the HAL file that says if commanded speed is less than 300rpm set spindle speed to 300rpm else set commanded speed to spindle speed.

Thanks in advance for the help.

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

More
08 Nov 2018 07:26 #120236 by cmorley
Replied by cmorley on topic Minnimum Spinlde Speed
linuxcnc doesn't have a built in way to set a minimum speed.
You would have to craft some HAL components to do this.
Can you elaborate on your spindle control hardware.
And posting your config file would help too.

Chris M

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

More
08 Nov 2018 13:24 #120259 by andypugh
Replied by andypugh on topic Minnimum Spinlde Speed

One issue I have is that my lathe minimum speed isn't great and while it will run down to 100rpm, it doesn't have much torgue below 300rpm, So when I try and use CSS I find that the commanded speed is too slow.


You can often configure a minimum speed in the VFD (in fact you generally should). Though there is a chance that it might simply not run the motor below minimum speed rather than clip the output.

The same problem exists with the obvious HAL component, limit1 .
(You could use limit2 to limit acceleration, too, if you wanted)

This is probably a case for using the " lincurve " HAL component.


loadrt lincurve personality=4
addf lincurve.0 servo thread
setp lincurve.0.x-val-00 0
setp lincurve.0.y-val-00 0
setp lincurve.0.x-val-01 5
setp lincurve.0.y-val-01 300
setp lincurve.0.x-val-02 300
setp lincurve.0.y-val-02 300
setp lincurve.0.x-val-03 3000
setp lincurve.0.y-val-03 3000

net spindle-raw motion.spindle-speed-out-rpm-abs => lincurve.0.in
net spindle-clipped lincurve.0.out => {whatever your current HAL uses}
Attachments:

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

More
08 Nov 2018 22:05 #120294 by davidimurray
Replied by davidimurray on topic Minnimum Spinlde Speed
Thanks for the replies. I've got a 1/2hp DC motor which is the original on the lathe. While there is a minimum setting on the drive I found it is rather unreliable - it seems to vary upto 100rpm from day to day. However the commanded speed is always seems to good from 300rpm upwards.


Thanks for the guide on lincurve - I will have a go at the weekend and see how I get on.

Cheers

Dave

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

More
10 Nov 2018 13:27 #120386 by davidimurray
Replied by davidimurray on topic Minnimum Spindle Speed
Right, i've had a go, but think I may not be linking the right HAL pins together.

I had an initial issue with the addf but realised that was a missing - between the servo and thread.

Below is my spindle section - i've split it into original and new section for lincurve. In the original section you can see that I have commented out two lines(in blue) - that's because I got errors about pins being connected more than once. The orange lines are where i have added the connection to lincurve which i think is wrong but not sure where i should connect it to.

With the code below the spindle just runs at a constant 500rpm and I cannot vary the spindle speed.

Any advice/help would be much appreciated

Thanks

Dave

#ORIGINAL WORKING SPINDLE
#net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= motion.spindle-on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
setp pwmgen.0.pwm-freq 50.0
setp pwmgen.0.scale 2600 #2333.33333333
setp pwmgen.0.offset -0.03 #-0.0285714285714
setp pwmgen.0.dither-pwm true
net spindle-cmd-rpm <= motion.spindle-speed-out
net spindle-cmd-rpm-abs <= motion.spindle-speed-out-abs
net spindle-cmd-rps <= motion.spindle-speed-out-rps
#net spindle-cmd-rps-abs <= motion.spindle-speed-out-rps-abs
net spindle-at-speed => motion.spindle-at-speed
net spindle-cw <= motion.spindle-forward

setp encoder.0.position-scale 48.000000
setp encoder.0.counter-mode 1
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-velocity-feedback-rps encoder.0.velocity => motion.spindle-speed-in
net spindle-index-enable encoder.0.index-enable <=> motion.spindle-index-enable
net spindle-phase-a encoder.0.phase-A
net spindle-phase-b encoder.0.phase-B
net spindle-index encoder.0.phase-Z
#ORIGINAL WORKING SPINDLE ENDS HERE

addf lincurve.0 servo-thread
setp lincurve.0.x-val-00 0
setp lincurve.0.y-val-00 0
setp lincurve.0.x-val-01 5
setp lincurve.0.y-val-01 300
setp lincurve.0.x-val-02 300
setp lincurve.0.y-val-02 300
setp lincurve.0.x-val-03 2600
setp lincurve.0.y-val-03 2600

net spindle-raw motion.spindle-speed-out-rps-abs => lincurve.0.in
net spindle-clipped lincurve.0.out => pwmgen.0.value

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

More
10 Nov 2018 17:41 #120404 by andypugh
Replied by andypugh on topic Minnimum Spindle Speed
I think I confused myself when writing the HAL.
It has spindle speed in RPS connected to a lincurve table with rpm numbers in it

Change it to use the spindle-sped-rpm-abs instead

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

More
10 Nov 2018 18:22 #120411 by davidimurray
Replied by davidimurray on topic Minnimum Spindle Speed
Just tried modifying to use RPM but i ketp getting the debug window saying RPM not assigned. Removed the spindle raw at start and Linuxcnc now opens and I can run the spindle but the speed does not change.

I've attached my hal and ini files below.

Thanks

Dave
Attachments:

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

More
11 Nov 2018 10:52 - 11 Nov 2018 10:53 #120438 by andypugh
Replied by andypugh on topic Minnimum Spindle Speed

Just tried modifying to use RPM but i ketp getting the debug window saying RPM not assigned.


It is really unhelpful when you paraphrase the error message. The exact error message will typically say exactly what you did wrong.

The problem is here
net motion.spindle-speed-out-rpm-abs => lincurve.0.in
net spindle-clipped lincurve.0.out => pwmgen.0.value

You are creating a new HAL "signal" called "motion.spindle-speed-out-rpm-abs" which has exactly the same name as an existing HAL pin (which isn't a great idea for readability) and that signal has no "writer" to give it a value.

What you need is:
net spindle-cmd-rpm-abs => lincurve.0.in
net spindle-clipped lincurve.0.out => pwmgen.0.value

Rather than just paste this in, can you try to understand what these HAL lines do, and what the difference is between this code and what you had?
Last edit: 11 Nov 2018 10:53 by andypugh.
The following user(s) said Thank You: tommylight

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

More
11 Nov 2018 18:56 #120454 by davidimurray
Replied by davidimurray on topic Minnimum Spindle Speed
Thanks Andy

I am slowly starting to understand the HAL but as there is quite a bit to it, it is taking some time to get into the detail. I think the thing that threw me was the direction of the arrows which for some reason I thought defined an input or an output - reading the HAL manual I can see that is not the case - my error.

With regard to the debugging, is there any easy way to copy from the debug window?

I've updated the code now and it is doing exactly what I want. There is a slight issue as I am using spindle at speed, so that doesn't quite work right when the commanded speed is below 300rpm with constant surface speed but I will have a play and see what I can do.

Thanks for your help.

Dave

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

More
13 Nov 2018 13:56 #120542 by andypugh
Replied by andypugh on topic Minnimum Spindle Speed
For spindle-at-speed just connect your "near" to the post-lincurve signal instead.

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

Time to create page: 0.117 seconds
Powered by Kunena Forum