Spindle speed control
27 May 2015 00:25 #59086
by donell
Replied by donell on topic Spindle speed control
Hi,
I realise the last post to this topic is almost exactly a year old, but I am having the same sort of issue.
I am controlling the spindle speed on my machine with a variable frequency converter which uses 0 - 10 V to control the speed. The CW and CCW signals control the direction. I have built a simple PWM - voltage converter to generate the control voltage. Essentially it all works fine and the speed and direction can be controlled using S(peed) and M3, M4 and M5 commands.
If I set the 'pwmgen.0.offset' value to 0 it all works fine and the speed is the same in both CW and CCW directions. However if there is an offset the speeds are different in the two directions. To get the machine spindle speeds to match the command speeds I need to have some offset because of non linearity somewhere in the system, particularly at low speed.
Having looked at the PWM output it is clear that the the duty cycle is different in CW and CCW directions for the same set speed if the offset is not zero.
I am now at something of a loss at how to progress. I don't really understand why the PWM is not the same when the commanded speed is the same value.
I have looked around the HAL manual and it is not very helpful with regard to how the offset works. I would really appreciate some help with this or ideas about where to go next..
Thanks
Don
I realise the last post to this topic is almost exactly a year old, but I am having the same sort of issue.
I am controlling the spindle speed on my machine with a variable frequency converter which uses 0 - 10 V to control the speed. The CW and CCW signals control the direction. I have built a simple PWM - voltage converter to generate the control voltage. Essentially it all works fine and the speed and direction can be controlled using S(peed) and M3, M4 and M5 commands.
If I set the 'pwmgen.0.offset' value to 0 it all works fine and the speed is the same in both CW and CCW directions. However if there is an offset the speeds are different in the two directions. To get the machine spindle speeds to match the command speeds I need to have some offset because of non linearity somewhere in the system, particularly at low speed.
Having looked at the PWM output it is clear that the the duty cycle is different in CW and CCW directions for the same set speed if the offset is not zero.
I am now at something of a loss at how to progress. I don't really understand why the PWM is not the same when the commanded speed is the same value.
I have looked around the HAL manual and it is not very helpful with regard to how the offset works. I would really appreciate some help with this or ideas about where to go next..
Thanks
Don
Please Log in or Create an account to join the conversation.
27 May 2015 00:32 #59087
by andypugh
Offset adds a fixed offset to the output. So making the output different in different directions is exactly what it is meant to do.
Do you have a spindle encoder? Of so your best solution might be closed-loop spindle control.
Replied by andypugh on topic Spindle speed control
I am now at something of a loss at how to progress. I don't really understand why the PWM is not the same when the commanded speed is the same value.
I have looked around the HAL manual and it is not very helpful with regard to how the offset works.
Offset adds a fixed offset to the output. So making the output different in different directions is exactly what it is meant to do.
Do you have a spindle encoder? Of so your best solution might be closed-loop spindle control.
Please Log in or Create an account to join the conversation.
27 May 2015 01:43 #59088
by donell
Replied by donell on topic Spindle speed control
Andy,
Thanks for the prompt reply.
It did occur to me that might be the way it worked. So effectively if the spindle speed is, say, 200 rpm to high CW it reduces it by 200 to get the correct speed. If you are going in reverse CCW it effectively increases the rpm as it regards the CCW rpm as negative.
In the HAL manual it suggests for Output type 1 that if you need positive PWM for both CW and CCW to use the 'abs' component to convert the PWM signal to always be a positive value. I am not sure quite what the implications of this are in terms of the CW and CCW signals. My HAL coding skills are pretty negligible at the moment so I cannot easily try it. Might this be a solution?
I could have a spindle encoder input. Is there a function that allows this to be used to control the spindle speed or would I have to write one?
Don
Thanks for the prompt reply.
It did occur to me that might be the way it worked. So effectively if the spindle speed is, say, 200 rpm to high CW it reduces it by 200 to get the correct speed. If you are going in reverse CCW it effectively increases the rpm as it regards the CCW rpm as negative.
In the HAL manual it suggests for Output type 1 that if you need positive PWM for both CW and CCW to use the 'abs' component to convert the PWM signal to always be a positive value. I am not sure quite what the implications of this are in terms of the CW and CCW signals. My HAL coding skills are pretty negligible at the moment so I cannot easily try it. Might this be a solution?
I could have a spindle encoder input. Is there a function that allows this to be used to control the spindle speed or would I have to write one?
Don
Please Log in or Create an account to join the conversation.
27 May 2015 02:06 - 27 May 2015 02:06 #59089
by andypugh
Well, one possibility would be to use the motion.spindle-speed-abs HAL pin, or even the revs-per-second version so you are only working in one side of zero.
The full list: www.linuxcnc.org/docs/html/man/man9/motion.9.html
Another option is the HAL lincurve component, which lets you use an XY graph (of straight lines) to map X inputs to Y outputs.
But try the abs output first, it ought to work.
Currently you have
motion -> pwmgen -> output pin -> spindle
You need
motion -> pid -> output pin -> spindle
pid <- input pin <- encoder
Replied by andypugh on topic Spindle speed control
In the HAL manual it suggests for Output type 1 that if you need positive PWM for both CW and CCW to use the 'abs' component to convert the PWM signal to always be a positive value. I am not sure quite what the implications of this are in terms of the CW and CCW signals. My HAL coding skills are pretty negligible at the moment so I cannot easily try it. Might this be a solution?
Well, one possibility would be to use the motion.spindle-speed-abs HAL pin, or even the revs-per-second version so you are only working in one side of zero.
The full list: www.linuxcnc.org/docs/html/man/man9/motion.9.html
Another option is the HAL lincurve component, which lets you use an XY graph (of straight lines) to map X inputs to Y outputs.
But try the abs output first, it ought to work.
You need a bit of HAL.I could have a spindle encoder input. Is there a function that allows this to be used to control the spindle speed or would I have to write one?
Currently you have
motion -> pwmgen -> output pin -> spindle
You need
motion -> pid -> output pin -> spindle
pid <- input pin <- encoder
Last edit: 27 May 2015 02:06 by andypugh.
Please Log in or Create an account to join the conversation.
27 May 2015 20:10 #59106
by donell
Replied by donell on topic Spindle speed control
Andy,
Again thanks for the reply. I agree that the ' motion.spindle-speed-out-abs' HAL pin is the way to go.
However, this is not loaded in my configuration, only the motion.spindle-speed-out and motion.spindle-speed-out-rps are available. I have tried loading the abs function without success.
How to I make the motion.spindle-speed-out-abs pin available?
As I said I am something of a novice regarding HAL so apologies if this is a foolish question.
Don
Again thanks for the reply. I agree that the ' motion.spindle-speed-out-abs' HAL pin is the way to go.
However, this is not loaded in my configuration, only the motion.spindle-speed-out and motion.spindle-speed-out-rps are available. I have tried loading the abs function without success.
How to I make the motion.spindle-speed-out-abs pin available?
As I said I am something of a novice regarding HAL so apologies if this is a foolish question.
Don
Please Log in or Create an account to join the conversation.
27 May 2015 20:32 #59107
by andypugh
It looks like you have an older version of LinuxCNC from before those pins were created. (This isn't a HAL problem as such)
wiki.linuxcnc.org/cgi-bin/wiki.pl?UpdatingTo2.6
Replied by andypugh on topic Spindle speed control
However, this is not loaded in my configuration, only the motion.spindle-speed-out and motion.spindle-speed-out-rps are available
It looks like you have an older version of LinuxCNC from before those pins were created. (This isn't a HAL problem as such)
wiki.linuxcnc.org/cgi-bin/wiki.pl?UpdatingTo2.6
Please Log in or Create an account to join the conversation.
27 May 2015 21:01 #59108
by donell
Replied by donell on topic Spindle speed control
Andy,
That seems to have cracked it. Have upgraded to 2.6.8 and I now have the pins. A quick check using the motion.spindle-speed-out-abs pin seems to provide the same DAC output in both directions. I will now need to calibrate it to get the right speeds.
Many thanks for your patience and help.
Don
That seems to have cracked it. Have upgraded to 2.6.8 and I now have the pins. A quick check using the motion.spindle-speed-out-abs pin seems to provide the same DAC output in both directions. I will now need to calibrate it to get the right speeds.
Many thanks for your patience and help.
Don
Please Log in or Create an account to join the conversation.
Time to create page: 0.159 seconds