Spindle RPM control and Z-axis homing
04 Sep 2014 18:11 #50746
by olesk
Spindle RPM control and Z-axis homing was created by olesk
Hi!
I'm now almost done with my Shapeoko2 build, based on the Leadshine MX3660 stepper driver, but two small kinks remain.
The first is homing of the Z-axis. Manual homing, when working with wood for example, works well. Also, switching to auto-homing with a touch plate works fine. However, I'm not able to easily switch between the two. I know of course I could always use a touch plate (I need auto-homing for PCB milling), but I was hoping to have one "auto-home Z" and one "manually set home Z" button in Axis. Is it possible to have it both ways, or can I only chose one type of homing?
The second issue is spindle RPM. I have a "Quiet Cut" spindle, and a matching PWM-based speed controller from Inventables. The setup is a bit cumbersome, as LinuxCNC provides the MX3660 stepper driver a PWM signal (MX3660 requirement), which it in turn outputs as an analog voltage. Since the spindle speed controller needs a PWM signal, I make an Arduino UNO read the analog voltage from the MX3660, and convert it back to a PWM signal for the spindle speed controller. Cumbersome, I know, but I don't have easy physical access to the PWM pin from the parallel port. Still, it works, so I'm ok with it. The problem is however, to control the spindle RPM.
When I click the "clockwise rotation" button in Axis, it starts from 0 RPM, completely ignoring the "DEFAULT_SPINDLE_SPEED = 12000" line in my INI-file, meaning I have to click like mad on the "increase RPM" button to get it to full speed. I haven't found a way of adjusting the steps (like one would for jogging) for the spindle speed. I presume this doesn't matter much in practice, as spindle speed would normally be given by the g-code anyways, but there are cases when I would like to have manual control. Does this mean that the DEFAULT_SPINDLE_SPEED is only used when the G-code does not explicitly specify a spindle speed? And can I solve this though MDI commands and buttons in axis? (A "Set spindle 100%" button for example)? And finally, to deal with imprecisions from my digital-analog-digital conversion, can I specify more PWM/RPM relationships using spindlepwm1, spindlepwm2, spindlepwm3 etc., or is only spindlepwm1 and spindlepwm2 understood by LinuxCNC?
I'm now almost done with my Shapeoko2 build, based on the Leadshine MX3660 stepper driver, but two small kinks remain.
The first is homing of the Z-axis. Manual homing, when working with wood for example, works well. Also, switching to auto-homing with a touch plate works fine. However, I'm not able to easily switch between the two. I know of course I could always use a touch plate (I need auto-homing for PCB milling), but I was hoping to have one "auto-home Z" and one "manually set home Z" button in Axis. Is it possible to have it both ways, or can I only chose one type of homing?
The second issue is spindle RPM. I have a "Quiet Cut" spindle, and a matching PWM-based speed controller from Inventables. The setup is a bit cumbersome, as LinuxCNC provides the MX3660 stepper driver a PWM signal (MX3660 requirement), which it in turn outputs as an analog voltage. Since the spindle speed controller needs a PWM signal, I make an Arduino UNO read the analog voltage from the MX3660, and convert it back to a PWM signal for the spindle speed controller. Cumbersome, I know, but I don't have easy physical access to the PWM pin from the parallel port. Still, it works, so I'm ok with it. The problem is however, to control the spindle RPM.
When I click the "clockwise rotation" button in Axis, it starts from 0 RPM, completely ignoring the "DEFAULT_SPINDLE_SPEED = 12000" line in my INI-file, meaning I have to click like mad on the "increase RPM" button to get it to full speed. I haven't found a way of adjusting the steps (like one would for jogging) for the spindle speed. I presume this doesn't matter much in practice, as spindle speed would normally be given by the g-code anyways, but there are cases when I would like to have manual control. Does this mean that the DEFAULT_SPINDLE_SPEED is only used when the G-code does not explicitly specify a spindle speed? And can I solve this though MDI commands and buttons in axis? (A "Set spindle 100%" button for example)? And finally, to deal with imprecisions from my digital-analog-digital conversion, can I specify more PWM/RPM relationships using spindlepwm1, spindlepwm2, spindlepwm3 etc., or is only spindlepwm1 and spindlepwm2 understood by LinuxCNC?
Please Log in or Create an account to join the conversation.
04 Sep 2014 19:10 #50747
by BigJohnT
Replied by BigJohnT on topic Spindle RPM control and Z-axis homing
I think your confusing "homing" with "touch off". Homing sets the machine coordinate system so the soft limits work. Touch Off is how you set the offsets for the working coordinate system which is usually G54.
JT
JT
The following user(s) said Thank You: olesk
Please Log in or Create an account to join the conversation.
04 Sep 2014 19:28 - 04 Sep 2014 19:34 #50750
by BigJohnT
Replied by BigJohnT on topic Spindle RPM control and Z-axis homing
For the spindle question are you running 2.6.x and the Axis GUI? And did you put DEFAULT_SPINDLE_SPEED in the [DISPLAY] section of your ini file?
And even more important than all the above are you running a version that is newer than Aug 18, 2014 when that feature was added.
I just looked and 2.6.2 will not have the spindle feature. You will have to either wait for 2.6.3 or be using a version from the buildbot.
JT
And even more important than all the above are you running a version that is newer than Aug 18, 2014 when that feature was added.
I just looked and 2.6.2 will not have the spindle feature. You will have to either wait for 2.6.3 or be using a version from the buildbot.
JT
Last edit: 04 Sep 2014 19:34 by BigJohnT.
The following user(s) said Thank You: olesk
Please Log in or Create an account to join the conversation.
04 Sep 2014 20:04 - 04 Sep 2014 20:05 #50754
by olesk
Replied by olesk on topic Spindle RPM control and Z-axis homing
Just to quickly address the homing issue first, I believe I am aware of the difference between homing and touching off, but if I'm not mistaken one needs to home an axis before touching it off. This means two possibilities: either home to a homing plate (or switch), i.e. do an automatic homing. Or, if of doesn't have a plate, or simply wants to set home manually, one can disable autohoming in the INI-file and just home the axis manually in the Axis GUI (either on the work piece or somewhere random and then touch off on the work piece). I used to auto-home X and Y, and manually set home for Z. What I'm looking for is a trick where I can perform auto-home whenever I use a touch plate, and set manual home via Axis whenever I don't. The reason is that I only want auto-home for the Z axis when I mill PCBs, and then I connect the Z-axis homing switch pins to the spindle on one end, and the PCB's copper surface on the other. When working with wood, I just manually home the axis somewhere and touch off on the surface of the wood. I don't know if that makes sense? ![:) :)](/media/kunena/emoticons/smile.png)
For the spindle speed, yes, I am using 2.6.x and Axis GUI. As for the exact version, I would have to check. I didn't know that the options was so brand new. Since I'm using official Ubuntu repositories, I am probably a few versions behind. Thank you for that - saved me a bit of frustration, as this is more me being a details fanatic than any critical issue, I will simply wait I think.
If you don't mind, I just wanted to revisit the options from the stepconfig file, spindlepwm1/spindlepwm2 and spindlespeed1/spindlespeed2. I'm trying to understand how they affect the PWM LinuxCNC creates. My guess is that LinuxCNC assumes a linear relationship from 0 PWM / 0 RPM to spindlepwm1/spindlespeed1, then a separate linear relationship from spindlepwm1/spindlespeed1 to spindlepwm2/spindlespeed2, and finally a similarly linear relationship from spindlepwm2/spindlespeed2 to maximum PWM / maximum spindle speed. Meaning that if you drew a graph it would look like I've sketched here. Is that correct?
![:) :)](/media/kunena/emoticons/smile.png)
For the spindle speed, yes, I am using 2.6.x and Axis GUI. As for the exact version, I would have to check. I didn't know that the options was so brand new. Since I'm using official Ubuntu repositories, I am probably a few versions behind. Thank you for that - saved me a bit of frustration, as this is more me being a details fanatic than any critical issue, I will simply wait I think.
If you don't mind, I just wanted to revisit the options from the stepconfig file, spindlepwm1/spindlepwm2 and spindlespeed1/spindlespeed2. I'm trying to understand how they affect the PWM LinuxCNC creates. My guess is that LinuxCNC assumes a linear relationship from 0 PWM / 0 RPM to spindlepwm1/spindlespeed1, then a separate linear relationship from spindlepwm1/spindlespeed1 to spindlepwm2/spindlespeed2, and finally a similarly linear relationship from spindlepwm2/spindlespeed2 to maximum PWM / maximum spindle speed. Meaning that if you drew a graph it would look like I've sketched here. Is that correct?
Last edit: 04 Sep 2014 20:05 by olesk. Reason: Attachments appeared missing
Please Log in or Create an account to join the conversation.
04 Sep 2014 21:37 #50761
by BigJohnT
Replied by BigJohnT on topic Spindle RPM control and Z-axis homing
I still think your confused about homing and touch off and cross the two up.
Homing is moving the machine to a preset position independent of any tools that may be in the spindle. Usually Z is all the way up and X and Y are at the left rear corner (tool position not table or gantry position). This is usually done with homing switches or match marks not touch off plates. Homing establishes the machine coordinate system and makes the soft limits useful. If you home to a tool or random positions then the soft limits are of no use.
After homing you can touch off to your material and for wood a dowel or paper works well.
I spoke to the developers about DEFAULT_SPINDLE_SPEED and they should have 2.6.3 released in a few days so stand by on that.
JT
Homing is moving the machine to a preset position independent of any tools that may be in the spindle. Usually Z is all the way up and X and Y are at the left rear corner (tool position not table or gantry position). This is usually done with homing switches or match marks not touch off plates. Homing establishes the machine coordinate system and makes the soft limits useful. If you home to a tool or random positions then the soft limits are of no use.
After homing you can touch off to your material and for wood a dowel or paper works well.
I spoke to the developers about DEFAULT_SPINDLE_SPEED and they should have 2.6.3 released in a few days so stand by on that.
JT
The following user(s) said Thank You: olesk
Please Log in or Create an account to join the conversation.
04 Sep 2014 22:04 #50762
by olesk
Replied by olesk on topic Spindle RPM control and Z-axis homing
Funny, now I start thinking that you're right about me being confused about homing and touching off ![:huh: :huh:](/media/kunena/emoticons/wassat.png)
After some reading I realize that it's not really confusion about homing and touching off, as much as confusion between homing and probing. What I'm trying to do is illustrated here:
Which means that I need another pin set up in LinuxCNC, a pull-up resistor and 5V source![:laugh: :laugh:](/media/kunena/emoticons/laughing.png)
Sorry about the confusion. I now think I need to read up on probing, since it seems I had the wrong idea all along. I wanted probing, and used homing instead, which seems to be the wrong approach (though it does "work" I suppose). Sorry, this is new to me, so the concepts confuse me somewhat.
Thanks for the update on DEFAULT_SPINDLE_SPEED - much appreciated!
![:huh: :huh:](/media/kunena/emoticons/wassat.png)
After some reading I realize that it's not really confusion about homing and touching off, as much as confusion between homing and probing. What I'm trying to do is illustrated here:
Which means that I need another pin set up in LinuxCNC, a pull-up resistor and 5V source
![:laugh: :laugh:](/media/kunena/emoticons/laughing.png)
Sorry about the confusion. I now think I need to read up on probing, since it seems I had the wrong idea all along. I wanted probing, and used homing instead, which seems to be the wrong approach (though it does "work" I suppose). Sorry, this is new to me, so the concepts confuse me somewhat.
Thanks for the update on DEFAULT_SPINDLE_SPEED - much appreciated!
Please Log in or Create an account to join the conversation.
05 Sep 2014 07:00 #50789
by BigJohnT
Replied by BigJohnT on topic Spindle RPM control and Z-axis homing
Homing the tool to the material only works in the sense that the tool offset is correct, however soft limits will not be correct after that. I understand how easy it is to be confused as I was really confused at the start, so confused about the manuals that I joined the team and changed them to make sense to me as a newbie.
Your diagram shows probing then after you find the touch off point you can set the Z offset of your tool. The numbered parameter #5063 holds the exact point of the probe tripping. So you can use G10 L2 to set the working coordinate system offset after your probe move.
www.linuxcnc.org/docs/html/gcode/overvie...umbered_parameters_a
www.linuxcnc.org/docs/html/gcode/gcode.html#sec:G10-L2_
JT
Your diagram shows probing then after you find the touch off point you can set the Z offset of your tool. The numbered parameter #5063 holds the exact point of the probe tripping. So you can use G10 L2 to set the working coordinate system offset after your probe move.
www.linuxcnc.org/docs/html/gcode/overvie...umbered_parameters_a
www.linuxcnc.org/docs/html/gcode/gcode.html#sec:G10-L2_
JT
The following user(s) said Thank You: olesk
Please Log in or Create an account to join the conversation.
06 Sep 2014 00:44 #50818
by DaBit
Replied by DaBit on topic Spindle RPM control and Z-axis homing
Not an answer to your original question, but my preferred method to turn on the spindle at the desired speed is to go the the MDI tab (press F5), and enter S<desired rpm>M3. Thus, if you want 12000rpm, you enter S12000M3. Then press F3 to go back to the jogging/homing tab.
The following user(s) said Thank You: olesk
Please Log in or Create an account to join the conversation.
06 Sep 2014 17:01 #50841
by olesk
Yes, that sounds like a good manual override. I can't for the life of me get the RPMs to fit at all with the PWM ("non-linear" is a massive understatement), but since I'm using an Arduino between the PWM from LinuxCNC and the final PWM the speed controller is getting, I'll probably cheat and simply do the conversion on the Arudino, so that S12000M3 in your example, _actually_ gives me 12000RPM
Replied by olesk on topic Spindle RPM control and Z-axis homing
Not an answer to your original question, but my preferred method to turn on the spindle at the desired speed is to go the the MDI tab (press F5), and enter S<desired rpm>M3. Thus, if you want 12000rpm, you enter S12000M3. Then press F3 to go back to the jogging/homing tab.
Yes, that sounds like a good manual override. I can't for the life of me get the RPMs to fit at all with the PWM ("non-linear" is a massive understatement), but since I'm using an Arduino between the PWM from LinuxCNC and the final PWM the speed controller is getting, I'll probably cheat and simply do the conversion on the Arudino, so that S12000M3 in your example, _actually_ gives me 12000RPM
![;) ;)](/media/kunena/emoticons/wink.png)
Please Log in or Create an account to join the conversation.
06 Sep 2014 18:25 #50845
by DaBit
Replied by DaBit on topic Spindle RPM control and Z-axis homing
Maybe you can use a
lincurve
component between the spindle speed output of motion and the PWM?
The following user(s) said Thank You: olesk
Please Log in or Create an account to join the conversation.
Time to create page: 0.096 seconds