Re: [Emc-users] Runaway PID spindle.

2021-07-10 Thread John Dammeyer
I knew I'd need more spindle torque for tapping.  That's why I made a two step 
pulley for the spindle and the 1800W servo.  

One tiny little problem.
http://www.autoartisans.com/mill/SpindlePulleyRawCasting.jpg

In thinking through the process to be able to pull the pattern from the sand 
the larger pulley is in the wrong place.  The cone drive to the spindle is 
largest at the bottom and the taper ends up putting the smallest pulley at the 
bottom.  Which is why the encoder wheel was large enough to clear it but not 
really large enough that I had room to move the belt without removing the 
encoders.

Another mistake was the length of the keyed arbour for the tapered pulley 
holder.
http://www.autoartisans.com/mill/Arbour-2.jpg
Way too long.  Lots of vibration when I was cutting the pulley.
http://www.autoartisans.com/mill/SpindlePulleyBuild-1.jpg 
http://www.autoartisans.com/mill/SpindlePulleyBuild-2.jpg

And when I bored out the motor pulley I was oversize just enough that the 
pulley isn't a tight fit on the shaft.  I think it wobbles a tad.  

So I could either rebuild and make a proper 2:1 reduction for the heavier 
cutting operations.  Or do like I always wanted and finish some of the other 
projects so I can make toothed pulleys for perfect 1:1 and 2:1.

John


> -Original Message-
> From: ken.stra...@gmail.com [mailto:ken.stra...@gmail.com]
> Sent: July-10-21 5:56 PM
> To: 'Enhanced Machine Controller (EMC)'
> Subject: Re: [Emc-users] Runaway PID spindle.
> 
> I've never used any form taps from KBC but R is a known brand. You'd think
> that a tap without flutes would be cheaper!
> 
> Remember to drill the hole oversize. For example,
> https://www.natool.com/wp-content/uploads/2019/06/tapdrillsizes-inmet_web_ca
> tp113-116.pdf) suggests a #1 rather than #7 drill for a 1/4-20 tap. You'll
> also need more spindle torque than with a cutting tap.
> 
> -Original Message-
> From: John Dammeyer 
> Sent: July 10, 2021 8:07 PM
> To: 'Enhanced Machine Controller (EMC)' 
> Subject: Re: [Emc-users] Runaway PID spindle.
> 
> Looks like KBCTools has a few at reasonable prices
> https://www.kbctools.ca/products/search/?Keyword=thread%20forming%20tap
> 
> Inexpensive KBC brand
> https://www.kbctools.ca/itemdetail/1-363A-0326
> 
> 
> They also have a brand name at quite a bit more.
> https://www.kbctools.ca/itemdetail/16B-1420-03B
> 
> 
> John
> 
> > -Original Message-
> > From: ken.stra...@gmail.com [mailto:ken.stra...@gmail.com]
> > Sent: July-10-21 4:46 PM
> > To: 'Enhanced Machine Controller (EMC)'
> > Subject: Re: [Emc-users] Runaway PID spindle.
> >
> > The one in the picture came from Fastenal. When they discontinued
> > selling them and had them on clearance I purchased their inventory of
> > 8-32 and 4-40 taps. I scored a good supply of Balax
> (https://www.balax.com/) 2-56 taps from a local flea market. I don't think
> the seller understood taps without flutes!
> >
> > -----Original Message-
> > From: John Dammeyer 
> > Sent: July 10, 2021 6:07 PM
> > To: 'Enhanced Machine Controller (EMC)'
> > 
> > Subject: Re: [Emc-users] Runaway PID spindle.
> >
> > Where did you get your forming taps?
> >
> > I just ran my 10-32 into a casting remnant.  I keep the risers and turn
> them round for bar stock.In this case a solid coupler.
> > Clamp in vise, used LED touch sensor to determine center point between
> > vise jaws and edge of piece.  Move over 1/2" , spot, drill and then use
> LCNC to power tap.
> >
> > Why is this one different from the last exmaple?  Because I loaded the
> > 'B' version of the BIT file into the 7i92 and changed the HAL file so
> > it wouldn't complain that DB25-5 was not available as an output (now
> stepgen5 DIR) instead of an output connected to DIR for PWM.  Change the Pn
> parameter in the servo to use step/dir instead of 0-10V,IN3 for velocity and
> direction.
> >
> > The odd thing compared to my test bench setup was that I had to change
> > the sign of the STEP_SCALE to negative to make the spindle motor turn
> clockwise.
> >
> > I then asked it to turn 400 RPM and looked at what the encoder reported
> for the spindle.   Divide the encoder RPM into 400 and
> > multiply the STEP_SCALE by that to set up the pulley ratio since they
> aren't quite the same diameter.  Now RPM is really close and
> > tapping starts immediately.   No PID needed.
> >
> > Freakin awesome!
> > John
> >
> >
> >
> > > -Original Message-
> > > From: ken.stra...@gmail.com [mailto:ken.stra...@gmail.com]
> > > Sent: July-10-21 2:35 PM
> > > To: 'Enhanced Machine Controller (E

Re: [Emc-users] Runaway PID spindle.

2021-07-10 Thread ken.strauss
I've never used any form taps from KBC but R is a known brand. You'd think
that a tap without flutes would be cheaper!

Remember to drill the hole oversize. For example,
https://www.natool.com/wp-content/uploads/2019/06/tapdrillsizes-inmet_web_ca
tp113-116.pdf) suggests a #1 rather than #7 drill for a 1/4-20 tap. You'll
also need more spindle torque than with a cutting tap.

-Original Message-
From: John Dammeyer  
Sent: July 10, 2021 8:07 PM
To: 'Enhanced Machine Controller (EMC)' 
Subject: Re: [Emc-users] Runaway PID spindle.

Looks like KBCTools has a few at reasonable prices
https://www.kbctools.ca/products/search/?Keyword=thread%20forming%20tap

Inexpensive KBC brand
https://www.kbctools.ca/itemdetail/1-363A-0326


They also have a brand name at quite a bit more.
https://www.kbctools.ca/itemdetail/16B-1420-03B


John

> -Original Message-
> From: ken.stra...@gmail.com [mailto:ken.stra...@gmail.com]
> Sent: July-10-21 4:46 PM
> To: 'Enhanced Machine Controller (EMC)'
> Subject: Re: [Emc-users] Runaway PID spindle.
> 
> The one in the picture came from Fastenal. When they discontinued 
> selling them and had them on clearance I purchased their inventory of 
> 8-32 and 4-40 taps. I scored a good supply of Balax
(https://www.balax.com/) 2-56 taps from a local flea market. I don't think
the seller understood taps without flutes!
> 
> -Original Message-
> From: John Dammeyer 
> Sent: July 10, 2021 6:07 PM
> To: 'Enhanced Machine Controller (EMC)' 
> 
> Subject: Re: [Emc-users] Runaway PID spindle.
> 
> Where did you get your forming taps?
> 
> I just ran my 10-32 into a casting remnant.  I keep the risers and turn
them round for bar stock.In this case a solid coupler.
> Clamp in vise, used LED touch sensor to determine center point between 
> vise jaws and edge of piece.  Move over 1/2" , spot, drill and then use
LCNC to power tap.
> 
> Why is this one different from the last exmaple?  Because I loaded the 
> 'B' version of the BIT file into the 7i92 and changed the HAL file so 
> it wouldn't complain that DB25-5 was not available as an output (now
stepgen5 DIR) instead of an output connected to DIR for PWM.  Change the Pn
parameter in the servo to use step/dir instead of 0-10V,IN3 for velocity and
direction.
> 
> The odd thing compared to my test bench setup was that I had to change 
> the sign of the STEP_SCALE to negative to make the spindle motor turn
clockwise.
> 
> I then asked it to turn 400 RPM and looked at what the encoder reported
for the spindle.   Divide the encoder RPM into 400 and
> multiply the STEP_SCALE by that to set up the pulley ratio since they
aren't quite the same diameter.  Now RPM is really close and
> tapping starts immediately.   No PID needed.
> 
> Freakin awesome!
> John
> 
> 
> 
> > -Original Message-
> > From: ken.stra...@gmail.com [mailto:ken.stra...@gmail.com]
> > Sent: July-10-21 2:35 PM
> > To: 'Enhanced Machine Controller (EMC)'
> > Subject: Re: [Emc-users] Runaway PID spindle.
> >
> > I haven't been following this thread too closely but why not use 
> > thread forming taps? They work great in ductile materials such as 
> > aluminum and there is no problem with chip clearing since there are 
> > no chips. Just be sure that you drill the right size hole according 
> > to the tap manufacturer's material (somewhat larger hole than for a
normal tap).
> >
> > On the idea that without a picture it didn't happen, see 
> > https://www.youtube.com/watch?v=_DmvkC3tOQw
> >
> > -Original Message-
> > From: John Dammeyer 
> > Sent: July 10, 2021 3:08 PM
> > To: 'Enhanced Machine Controller (EMC)'
> > 
> > Subject: Re: [Emc-users] Runaway PID spindle.
> >
> > Thanks.
> > I've got some really cheap metric ones coming from amazon.  Just for 
> > aluminium castings and to play with.
> > John
> >
> > > -Original Message-
> > > From: Dave Cole [mailto:linuxcncro...@gmail.com]
> > > Sent: July-10-21 10:39 AM
> > > To: emc-users@lists.sourceforge.net
> > > Subject: Re: [Emc-users] Runaway PID spindle.
> > >
> > > I think that is a spiral point tap.
> > > The flute is straight along the length of the tap then the flute 
> > > is is ground deeper toward the backside of the cutting edge.
> > >
> > > AutomationDirect.com sells some really nice taps for reasonable
amounts.
> > >
> > > Dave
> > >
> > >
> > > On 7/9/2021 8:32 PM, John Dammeyer wrote:
> > > > The saying we have on another group is if there aren't pictures 
> > > > it didn't happen.  I hand held the camera so depth of fie

Re: [Emc-users] Runaway PID spindle.

2021-07-10 Thread John Dammeyer
Looks like KBCTools has a few at reasonable prices
https://www.kbctools.ca/products/search/?Keyword=thread%20forming%20tap

Inexpensive KBC brand
https://www.kbctools.ca/itemdetail/1-363A-0326


They also have a brand name at quite a bit more.
https://www.kbctools.ca/itemdetail/16B-1420-03B


John

> -Original Message-
> From: ken.stra...@gmail.com [mailto:ken.stra...@gmail.com]
> Sent: July-10-21 4:46 PM
> To: 'Enhanced Machine Controller (EMC)'
> Subject: Re: [Emc-users] Runaway PID spindle.
> 
> The one in the picture came from Fastenal. When they discontinued selling 
> them and had them on clearance I purchased their
> inventory of 8-32 and 4-40 taps. I scored a good supply of Balax 
> (https://www.balax.com/) 2-56 taps from a local flea market. I don't
> think the seller understood taps without flutes!
> 
> -Original Message-
> From: John Dammeyer 
> Sent: July 10, 2021 6:07 PM
> To: 'Enhanced Machine Controller (EMC)' 
> Subject: Re: [Emc-users] Runaway PID spindle.
> 
> Where did you get your forming taps?
> 
> I just ran my 10-32 into a casting remnant.  I keep the risers and turn them 
> round for bar stock.In this case a solid coupler.
> Clamp in vise, used LED touch sensor to determine center point between vise 
> jaws and edge of piece.  Move over 1/2" , spot, drill
> and then use LCNC to power tap.
> 
> Why is this one different from the last exmaple?  Because I loaded the 'B' 
> version of the BIT file into the 7i92 and changed the HAL
> file so it wouldn't complain that DB25-5 was not available as an output (now 
> stepgen5 DIR) instead of an output connected to DIR for
> PWM.  Change the Pn parameter in the servo to use step/dir instead of 
> 0-10V,IN3 for velocity and direction.
> 
> The odd thing compared to my test bench setup was that I had to change the 
> sign of the STEP_SCALE to negative to make the
> spindle motor turn clockwise.
> 
> I then asked it to turn 400 RPM and looked at what the encoder reported for 
> the spindle.   Divide the encoder RPM into 400 and
> multiply the STEP_SCALE by that to set up the pulley ratio since they aren't 
> quite the same diameter.  Now RPM is really close and
> tapping starts immediately.   No PID needed.
> 
> Freakin awesome!
> John
> 
> 
> 
> > -Original Message-
> > From: ken.stra...@gmail.com [mailto:ken.stra...@gmail.com]
> > Sent: July-10-21 2:35 PM
> > To: 'Enhanced Machine Controller (EMC)'
> > Subject: Re: [Emc-users] Runaway PID spindle.
> >
> > I haven't been following this thread too closely but why not use
> > thread forming taps? They work great in ductile materials such as
> > aluminum and there is no problem with chip clearing since there are no
> > chips. Just be sure that you drill the right size hole according to
> > the tap manufacturer's material (somewhat larger hole than for a normal 
> > tap).
> >
> > On the idea that without a picture it didn't happen, see
> > https://www.youtube.com/watch?v=_DmvkC3tOQw
> >
> > -Original Message-
> > From: John Dammeyer 
> > Sent: July 10, 2021 3:08 PM
> > To: 'Enhanced Machine Controller (EMC)'
> > 
> > Subject: Re: [Emc-users] Runaway PID spindle.
> >
> > Thanks.
> > I've got some really cheap metric ones coming from amazon.  Just for
> > aluminium castings and to play with.
> > John
> >
> > > -Original Message-
> > > From: Dave Cole [mailto:linuxcncro...@gmail.com]
> > > Sent: July-10-21 10:39 AM
> > > To: emc-users@lists.sourceforge.net
> > > Subject: Re: [Emc-users] Runaway PID spindle.
> > >
> > > I think that is a spiral point tap.
> > > The flute is straight along the length of the tap then the flute is
> > > is ground deeper toward the backside of the cutting edge.
> > >
> > > AutomationDirect.com sells some really nice taps for reasonable amounts.
> > >
> > > Dave
> > >
> > >
> > > On 7/9/2021 8:32 PM, John Dammeyer wrote:
> > > > The saying we have on another group is if there aren't pictures it
> > > > didn't happen.  I hand held the camera so depth of field is out a
> > > little on the 10-32 screw head and the macro lens is bad for depth
> > > of
> > field as it is.
> > > >
> > > > Short G-Code 200 RPM tapping into really soft aluminium trimmed
> > > > off an old box or something.  Not sure if this classifies as a
> > > > spiral
> > > tip tap but even a forming tap would have pushing this soft metal around.
> > > >
> > > > http://www.autoartisans.c

Re: [Emc-users] Runaway PID spindle.

2021-07-10 Thread ken.strauss
The one in the picture came from Fastenal. When they discontinued selling them 
and had them on clearance I purchased their inventory of 8-32 and 4-40 taps. I 
scored a good supply of Balax (https://www.balax.com/) 2-56 taps from a local 
flea market. I don't think the seller understood taps without flutes!

-Original Message-
From: John Dammeyer  
Sent: July 10, 2021 6:07 PM
To: 'Enhanced Machine Controller (EMC)' 
Subject: Re: [Emc-users] Runaway PID spindle.

Where did you get your forming taps?

I just ran my 10-32 into a casting remnant.  I keep the risers and turn them 
round for bar stock.In this case a solid coupler.
Clamp in vise, used LED touch sensor to determine center point between vise 
jaws and edge of piece.  Move over 1/2" , spot, drill and then use LCNC to 
power tap.

Why is this one different from the last exmaple?  Because I loaded the 'B' 
version of the BIT file into the 7i92 and changed the HAL file so it wouldn't 
complain that DB25-5 was not available as an output (now stepgen5 DIR) instead 
of an output connected to DIR for PWM.  Change the Pn parameter in the servo to 
use step/dir instead of 0-10V,IN3 for velocity and direction.

The odd thing compared to my test bench setup was that I had to change the sign 
of the STEP_SCALE to negative to make the spindle motor turn clockwise.   

I then asked it to turn 400 RPM and looked at what the encoder reported for the 
spindle.   Divide the encoder RPM into 400 and multiply the STEP_SCALE by that 
to set up the pulley ratio since they aren't quite the same diameter.  Now RPM 
is really close and tapping starts immediately.   No PID needed.

Freakin awesome!
John



> -Original Message-
> From: ken.stra...@gmail.com [mailto:ken.stra...@gmail.com]
> Sent: July-10-21 2:35 PM
> To: 'Enhanced Machine Controller (EMC)'
> Subject: Re: [Emc-users] Runaway PID spindle.
> 
> I haven't been following this thread too closely but why not use 
> thread forming taps? They work great in ductile materials such as 
> aluminum and there is no problem with chip clearing since there are no 
> chips. Just be sure that you drill the right size hole according to 
> the tap manufacturer's material (somewhat larger hole than for a normal tap).
> 
> On the idea that without a picture it didn't happen, see 
> https://www.youtube.com/watch?v=_DmvkC3tOQw
> 
> -Original Message-
> From: John Dammeyer 
> Sent: July 10, 2021 3:08 PM
> To: 'Enhanced Machine Controller (EMC)' 
> 
> Subject: Re: [Emc-users] Runaway PID spindle.
> 
> Thanks.
> I've got some really cheap metric ones coming from amazon.  Just for 
> aluminium castings and to play with.
> John
> 
> > -Original Message-
> > From: Dave Cole [mailto:linuxcncro...@gmail.com]
> > Sent: July-10-21 10:39 AM
> > To: emc-users@lists.sourceforge.net
> > Subject: Re: [Emc-users] Runaway PID spindle.
> >
> > I think that is a spiral point tap.
> > The flute is straight along the length of the tap then the flute is 
> > is ground deeper toward the backside of the cutting edge.
> >
> > AutomationDirect.com sells some really nice taps for reasonable amounts.
> >
> > Dave
> >
> >
> > On 7/9/2021 8:32 PM, John Dammeyer wrote:
> > > The saying we have on another group is if there aren't pictures it 
> > > didn't happen.  I hand held the camera so depth of field is out a
> > little on the 10-32 screw head and the macro lens is bad for depth 
> > of
> field as it is.
> > >
> > > Short G-Code 200 RPM tapping into really soft aluminium trimmed 
> > > off an old box or something.  Not sure if this classifies as a 
> > > spiral
> > tip tap but even a forming tap would have pushing this soft metal around.
> > >
> > > http://www.autoartisans.com/mill/SpindleControl/Tapping10-32.jpg
> > >
> > > John Dammeyer
> > >
> > >
> > >
> > >
> > > ___
> > > Emc-users mailing list
> > > Emc-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/emc-users
> >
> >
> > ___
> > Emc-users mailing list
> > Emc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/emc-users
> 
> 
> 
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
> 
> 
> 
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users



___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-10 Thread ken.strauss
I haven't been following this thread too closely but why not use thread
forming taps? They work great in ductile materials such as aluminum and
there is no problem with chip clearing since there are no chips. Just be
sure that you drill the right size hole according to the tap manufacturer's
material (somewhat larger hole than for a normal tap).

On the idea that without a picture it didn't happen, see
https://www.youtube.com/watch?v=_DmvkC3tOQw

-Original Message-
From: John Dammeyer  
Sent: July 10, 2021 3:08 PM
To: 'Enhanced Machine Controller (EMC)' 
Subject: Re: [Emc-users] Runaway PID spindle.

Thanks.
I've got some really cheap metric ones coming from amazon.  Just for
aluminium castings and to play with.
John

> -Original Message-
> From: Dave Cole [mailto:linuxcncro...@gmail.com]
> Sent: July-10-21 10:39 AM
> To: emc-users@lists.sourceforge.net
> Subject: Re: [Emc-users] Runaway PID spindle.
> 
> I think that is a spiral point tap.
> The flute is straight along the length of the tap then the flute is is 
> ground deeper toward the backside of the cutting edge.
> 
> AutomationDirect.com sells some really nice taps for reasonable amounts.
> 
> Dave
> 
> 
> On 7/9/2021 8:32 PM, John Dammeyer wrote:
> > The saying we have on another group is if there aren't pictures it 
> > didn't happen.  I hand held the camera so depth of field is out a
> little on the 10-32 screw head and the macro lens is bad for depth of
field as it is.
> >
> > Short G-Code 200 RPM tapping into really soft aluminium trimmed off 
> > an old box or something.  Not sure if this classifies as a spiral
> tip tap but even a forming tap would have pushing this soft metal around.
> >
> > http://www.autoartisans.com/mill/SpindleControl/Tapping10-32.jpg
> >
> > John Dammeyer
> >
> >
> >
> >
> > ___
> > Emc-users mailing list
> > Emc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/emc-users
> 
> 
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users



___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users



___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-10 Thread John Dammeyer
Thanks.
I've got some really cheap metric ones coming from amazon.  Just for aluminium 
castings and to play with.
John

> -Original Message-
> From: Dave Cole [mailto:linuxcncro...@gmail.com]
> Sent: July-10-21 10:39 AM
> To: emc-users@lists.sourceforge.net
> Subject: Re: [Emc-users] Runaway PID spindle.
> 
> I think that is a spiral point tap.
> The flute is straight along the length of the tap then the flute is is
> ground deeper toward the backside of the cutting edge.
> 
> AutomationDirect.com sells some really nice taps for reasonable amounts.
> 
> Dave
> 
> 
> On 7/9/2021 8:32 PM, John Dammeyer wrote:
> > The saying we have on another group is if there aren't pictures it didn't 
> > happen.  I hand held the camera so depth of field is out a
> little on the 10-32 screw head and the macro lens is bad for depth of field 
> as it is.
> >
> > Short G-Code 200 RPM tapping into really soft aluminium trimmed off an old 
> > box or something.  Not sure if this classifies as a spiral
> tip tap but even a forming tap would have pushing this soft metal around.
> >
> > http://www.autoartisans.com/mill/SpindleControl/Tapping10-32.jpg
> >
> > John Dammeyer
> >
> >
> >
> >
> > ___
> > Emc-users mailing list
> > Emc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/emc-users
> 
> 
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users



___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-10 Thread Dave Cole

I think that is a spiral point tap.
The flute is straight along the length of the tap then the flute is is 
ground deeper toward the backside of the cutting edge.


AutomationDirect.com sells some really nice taps for reasonable amounts.

Dave


On 7/9/2021 8:32 PM, John Dammeyer wrote:

The saying we have on another group is if there aren't pictures it didn't 
happen.  I hand held the camera so depth of field is out a little on the 10-32 
screw head and the macro lens is bad for depth of field as it is.

Short G-Code 200 RPM tapping into really soft aluminium trimmed off an old box 
or something.  Not sure if this classifies as a spiral tip tap but even a 
forming tap would have pushing this soft metal around.

http://www.autoartisans.com/mill/SpindleControl/Tapping10-32.jpg

John Dammeyer




___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users



___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-09 Thread John Dammeyer
The saying we have on another group is if there aren't pictures it didn't 
happen.  I hand held the camera so depth of field is out a little on the 10-32 
screw head and the macro lens is bad for depth of field as it is.  

Short G-Code 200 RPM tapping into really soft aluminium trimmed off an old box 
or something.  Not sure if this classifies as a spiral tip tap but even a 
forming tap would have pushing this soft metal around.

http://www.autoartisans.com/mill/SpindleControl/Tapping10-32.jpg

John Dammeyer




___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-09 Thread John Dammeyer
> From: andy pugh [mailto:bodge...@gmail.com]
> On Fri, 9 Jul 2021 at 18:43, John Dammeyer  wrote:
> 
> > Although if I understand the G31.1 correctly the Z axis tracks the encoder 
> > reported speed right?
> 
> No, that would be silly. It tracks the actual spindle position.
> 
> G74 / G84 work  on open-loop velocity, but assume a tension/compression head.
> 
> > So the spindle speed before the tapping starts and for reversing is really 
> > more of a guide than an actual written in stone value?
> >
> > In other words, is the PID even needed?
> 
> No, you can, in fact, turn the spindle off and rotate it by hand and
> LinuxCNC will still track.
> 
Haven't tried that as the spindle servo enable is tied to the general system 
enable so it's locked when not turning.  Handy since I can loosen and tighten 
the drawbar without a second wrench.

At some point I want to add a few switches and a control so I can manually 
switch on the spindle and set the speed without touching the mouse.  I can do 
that from my pendant but it's not as convenient was what I'd really like to do. 
 Plus still want to get into Modbus using the modio I have lying around here.

At the moment I can consider the PWM to 0V-10V with 60 slot encoder project 
complete.   The PID works well enough to bring the spindle to the target speed 
and hold it there.  

I believe that if you are running PWM to voltage with the encoder back to LCNC 
with PID that the +/- output is perfectly reasonable since the closed loop 
control is only being done my LCNC and a minus voltage to the windings would 
cause hard braking to slow down the spindle (or whatever).  

But running a high end servo with internal PID that has the capability of 
decelerating and spinning in the other direction rather than just braking to 
slow down with a minus PID output from the LCNC PID is dangerous.  I'd suggest 
rather than having to add a limit block, that the PID module have the same sort 
of min/max parameters added.  Doing it outside the PID seems slower.

Thanks for everyone's help.  Time to rewire for step/dir and change the BIT 
file in the 7i92H.

John






___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-09 Thread andy pugh
On Fri, 9 Jul 2021 at 18:43, John Dammeyer  wrote:

> Although if I understand the G31.1 correctly the Z axis tracks the encoder 
> reported speed right?

No, that would be silly. It tracks the actual spindle position.

G74 / G84 work  on open-loop velocity, but assume a tension/compression head.

> So the spindle speed before the tapping starts and for reversing is really 
> more of a guide than an actual written in stone value?
>
> In other words, is the PID even needed?

No, you can, in fact, turn the spindle off and rotate it by hand and
LinuxCNC will still track.

-- 
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1912


___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-09 Thread John Dammeyer
Hi Andy,

The system currently uses PWM to a cheap (not the most linear) 0V-10V 
converter.Which means the PWM values for requested RPM at 100 should 
different than the requested PWM for RPM at 1500.  All because originally the 
BIT file I was using for the 7i92H did not have an extra step/dir on the first 
parallel port and I still required the system to run off a single port for 
either LCNC or MACH3.  With MACH3 it's easy.  Change a check box for step/dir 
or PWM and it uses the same port pins.  Hence the system is still wired for PWM.

Also the spindle pulley ratio is about 1.040/1.000 if the requested verses 
target speeds are to be believed.

Before I added the quadrature feedback I was using a limit block I called 
spindle-ramped.  That's because the Bergerda AC servo drive is extremely well 
tuned and the motor does what it's asked to do almost instantly.  So a change 
from say 700 to 200 RPM felt jerky.  Hence adding the ramp to move up and down 
in speed more slowly.  I removed that ramp block once the encoder was there.

I've put the ramp block back in but set .maxv back up to the largest value.  
Set .max to largest value and set .min to 0.  Now when told to go to 0 RPS it 
goes to 0 and not in the reverse direction which the spindle would rapidly do 
if given a negative value that changed the direction output.  A PID outside 
another PID is never really a good idea.  

In either case, I've set FF0 down to 0.68 and bumped up the P and I which makes 
the system more responsive and reached the target velocity faster which means 
the up to speed indication is there sooner and tapping begins sooner.  It was 
the retraction of the tap that had me worried as the change in direction and 
lagging spindle speed made it look like it would break taps.

Although if I understand the G31.1 correctly the Z axis tracks the encoder 
reported speed right?  So the spindle speed before the tapping starts and for 
reversing is really more of a guide than an actual written in stone value?

In other words, is the PID even needed?

John

> -Original Message-
> From: andy pugh [mailto:bodge...@gmail.com]
> Sent: July-09-21 12:44 AM
> To: Enhanced Machine Controller (EMC)
> Subject: Re: [Emc-users] Runaway PID spindle.
> 
> On Fri, 9 Jul 2021 at 01:20, John Dammeyer  wrote:
> 
> > If I set it to 0.05 then the spindle does stop but now the PID isn't very 
> > responsive.  I have to add large amounts of P and I to get it to
> stabilize quickly and at 100RPM it then surges
> 
> I would expect a spindle PID to mainly rely on FF0 and I.
> (Set the FF0 to give the right speed at a mid-range point without any
> P, I or D)
> 
> You could _try_ running the PID output through a limit block, so that
> a negative value can't get through, but the PID will still output a
> negative value, and might get "confused" if that has no effect.
> 
> --
> atp
> "A motorcycle is a bicycle with a pandemonium attachment and is
> designed for the especial use of mechanical geniuses, daredevils and
> lunatics."
> � George Fitch, Atlanta Constitution Newspaper, 1912
> 
> 
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users



___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-09 Thread andy pugh
On Fri, 9 Jul 2021 at 01:20, John Dammeyer  wrote:

> If I set it to 0.05 then the spindle does stop but now the PID isn't very 
> responsive.  I have to add large amounts of P and I to get it to stabilize 
> quickly and at 100RPM it then surges

I would expect a spindle PID to mainly rely on FF0 and I.
(Set the FF0 to give the right speed at a mid-range point without any
P, I or D)

You could _try_ running the PID output through a limit block, so that
a negative value can't get through, but the PID will still output a
negative value, and might get "confused" if that has no effect.

-- 
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1912


___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-08 Thread Peter C. Wallace

On Thu, 8 Jul 2021, John Dammeyer wrote:


Date: Thu, 8 Jul 2021 18:16:15 -0700
From: John Dammeyer 
Reply-To: "Enhanced Machine Controller (EMC)"

To: "'Enhanced Machine Controller (EMC)'" 
Subject: Re: [Emc-users] Runaway PID spindle.


From: Peter C. Wallace [mailto:p...@mesanet.com]

From: John Dammeyer 

Maybe it's a MESA issue?  It's set up as output type 1 which is 0-100% which
means either the Out2 should invert when pwmgen gets negative?  Or the output
should clip to 0 when the calculation determines a negative output.
http://linuxcnc.org/docs/html/man/man9/hostmot2.9.html#pwmgen


PWM mode 1 is basically sign-manitude mode so if you connect
the PWM direction to the drives direction control,
and give signed command and feedback inputs to the PID
it should work properly.

I don't understand that Peter.  The PIN file for my device doesn't have an 
explicit PWM Direction controlled by the PWM module.  And in either case the 
potential for a random change in direction as it approaches 0 RPM is 
unacceptable behavior for a spindle.



This is required behavior if you wish to control the velocity around 0
via PID



What should the pwmgen do when hm2_7i92.0.pwmgen.00.value is assigned a 
negative value if it's configured with setp hm2_7i92.0.pwmgen.00.output-type 1


The PWM duty cycle should be the same for positive and negative numbers
(only the direction pin will change), This is what is meant by sign-magnitude



If there isn't anything in the PIN file that assigned a direction output to 
the pwmgen shouldn't the PWM output pin then stay at 0?  For the spindle it's 
not safe to have the pwmgen decide to change the direction because the 
response to slowing down isn't fast enough so the error term goes negative.


If you need a valid direction signal, you could use the absolute functions
sign bit as Andy suggested. This is like the only way to get a stable PID
because if you have 0 output for negative number you have a nonlinearity
the PID cannot really deal well with.

If you really want 0 output for negative PWM values, you could choise
PWM mode2 (up/down mode)



I'll just double check again to see if indeed a negative value is assigned 
into 00.value.


It should not, that would be contrary to mode 1's definition







___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users



Peter Wallace
Mesa Electronics

(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination.



___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-08 Thread John Dammeyer
> From: Peter C. Wallace [mailto:p...@mesanet.com]
> > From: John Dammeyer 
> >
> > Maybe it's a MESA issue?  It's set up as output type 1 which is 0-100% which
> > means either the Out2 should invert when pwmgen gets negative?  Or the 
> > output
> > should clip to 0 when the calculation determines a negative output.
> >http://linuxcnc.org/docs/html/man/man9/hostmot2.9.html#pwmgen
> 
> PWM mode 1 is basically sign-manitude mode so if you connect
> the PWM direction to the drives direction control,
> and give signed command and feedback inputs to the PID
> it should work properly.
> 
I don't understand that Peter.  The PIN file for my device doesn't have an 
explicit PWM Direction controlled by the PWM module.  And in either case the 
potential for a random change in direction as it approaches 0 RPM is 
unacceptable behavior for a spindle.

What should the pwmgen do when
hm2_7i92.0.pwmgen.00.value is assigned a negative value if it's configured with
setp   hm2_7i92.0.pwmgen.00.output-type  1

If there isn't anything in the PIN file that assigned a direction output to the 
pwmgen shouldn't the PWM output pin then stay at 0?  For the spindle it's not 
safe to have the pwmgen decide to change the direction because the response to 
slowing down isn't fast enough so the error term goes negative.

I'll just double check again to see if indeed a negative value is assigned into 
00.value.





___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-08 Thread Peter C. Wallace

On Thu, 8 Jul 2021, John Dammeyer wrote:


Date: Thu, 8 Jul 2021 17:17:09 -0700
From: John Dammeyer 
Reply-To: "Enhanced Machine Controller (EMC)"

To: "'Enhanced Machine Controller (EMC)'" 
Subject: Re: [Emc-users] Runaway PID spindle.

Maybe it's a MESA issue?  It's set up as output type 1 which is 0-100% which 
means either the Out2 should invert when pwmgen gets negative?  Or the output 
should clip to 0 when the calculation determines a negative output.

http://linuxcnc.org/docs/html/man/man9/hostmot2.9.html#pwmgen


PWM mode 1 is basically sign-manitude mode so if you connect
the PWM direction to the drives direction control,
and give signed command and feedback inputs to the PID
it should work properly.

BTW this is commented out. 
setp   pid.s.maxerror .0005
If I set it to 0.05 then the spindle does stop but now the PID isn't very 
responsive.  I have to add large amounts of P and I to get it to stabilize 
quickly and at 100RPM it then surges


Set it to 0.5 and it goes wonky with the negative error again.  Any smaller 
than 0.05 and response is so poor that it's really not a manageable system.


I could just switch over to using step/dir and do away with the PWM but that 
likely won't solve the closed loop problem.   The AC Servo by itself is 
responsive and stable.  But the pulley ratio means what I tell it isn't what 
it's doing and that's an issue for tapping.


John




-Original Message-
From: andy pugh [mailto:bodge...@gmail.com]
Sent: July-08-21 4:25 PM
To: Enhanced Machine Controller (EMC)
Subject: Re: [Emc-users] Runaway PID spindle.

On Fri, 9 Jul 2021 at 00:21, John Dammeyer  wrote:
>
> Oh and I was using this series of postings as a guide.
> https://forum.linuxcnc.org/49-basic-configuration/32553-spindle-pid-control
> but he never ran into this issue.  Same with the other postings where they 
have problems achieving the speed.  Not running away
with a negative correction.

I have had exactly your problem in the past, but I can't remember how
I fixed it, as it was years ago.

But it was definitely caused by the PID going negative, but negative
output giving positive speed/

--
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
?? George Fitch, Atlanta Constitution Newspaper, 1912


___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users




___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Peter Wallace
Mesa Electronics

(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination.
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-08 Thread John Dammeyer
Maybe it's a MESA issue?  It's set up as output type 1 which is 0-100% which 
means either the Out2 should invert when pwmgen gets negative?   Or the output 
should clip to 0 when the calculation determines a negative output. 
http://linuxcnc.org/docs/html/man/man9/hostmot2.9.html#pwmgen

BTW this is commented out.   
setp   pid.s.maxerror .0005
If I set it to 0.05 then the spindle does stop but now the PID isn't very 
responsive.  I have to add large amounts of P and I to get it to stabilize 
quickly and at 100RPM it then surges

Set it to 0.5 and it goes wonky with the negative error again.  Any smaller 
than 0.05 and response is so poor that it's really not a manageable system.

I could just switch over to using step/dir and do away with the PWM but that 
likely won't solve the closed loop problem.   The AC Servo by itself is 
responsive and stable.  But the pulley ratio means what I tell it isn't what 
it's doing and that's an issue for tapping.

John


> -Original Message-
> From: andy pugh [mailto:bodge...@gmail.com]
> Sent: July-08-21 4:25 PM
> To: Enhanced Machine Controller (EMC)
> Subject: Re: [Emc-users] Runaway PID spindle.
> 
> On Fri, 9 Jul 2021 at 00:21, John Dammeyer  wrote:
> >
> > Oh and I was using this series of postings as a guide.
> > https://forum.linuxcnc.org/49-basic-configuration/32553-spindle-pid-control
> > but he never ran into this issue.  Same with the other postings where they 
> > have problems achieving the speed.  Not running away
> with a negative correction.
> 
> I have had exactly your problem in the past, but I can't remember how
> I fixed it, as it was years ago.
> 
> But it was definitely caused by the PID going negative, but negative
> output giving positive speed/
> 
> --
> atp
> "A motorcycle is a bicycle with a pandemonium attachment and is
> designed for the especial use of mechanical geniuses, daredevils and
> lunatics."
> � George Fitch, Atlanta Constitution Newspaper, 1912
> 
> 
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users



___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-08 Thread andy pugh
On Fri, 9 Jul 2021 at 00:21, John Dammeyer  wrote:
>
> Oh and I was using this series of postings as a guide.
> https://forum.linuxcnc.org/49-basic-configuration/32553-spindle-pid-control
> but he never ran into this issue.  Same with the other postings where they 
> have problems achieving the speed.  Not running away with a negative 
> correction.

I have had exactly your problem in the past, but I can't remember how
I fixed it, as it was years ago.

But it was definitely caused by the PID going negative, but negative
output giving positive speed/

-- 
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1912


___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-08 Thread John Dammeyer
Oh and I was using this series of postings as a guide.
https://forum.linuxcnc.org/49-basic-configuration/32553-spindle-pid-control
but he never ran into this issue.  Same with the other postings where they have 
problems achieving the speed.  Not running away with a negative correction.

> -Original Message-
> From: andy pugh [mailto:bodge...@gmail.com]
> Sent: July-08-21 3:57 PM
> To: Enhanced Machine Controller (EMC)
> Subject: Re: [Emc-users] Runaway PID spindle.
> 
> On Thu, 8 Jul 2021 at 23:19, John Dammeyer  wrote:
> 
> > When I click the '-' with the RPM at 501 it drops to 401. Again and so on 
> > down to 101.  The last click should take it down to 1 or 0
> RPM.  However that last click sends it to max speed of 3000 RPM.
> 
> This happens when the PID goes negative. Imagine that the PID output
> is 0, but the speed is still positive, so the PID reduces the output
> to -10. This becomes an absolute speed ot 10, which is still too high,
> so the PID goes down to -100
> 
> The best way round this is probably to pass the pid output through an
> abs block (I think that you do that) but then control the spindle
> direction using the abs.0.is-positive / is-negative outputs rather
> than the spindle direction pins.
> 
> --
> atp
> "A motorcycle is a bicycle with a pandemonium attachment and is
> designed for the especial use of mechanical geniuses, daredevils and
> lunatics."
> � George Fitch, Atlanta Constitution Newspaper, 1912
> 
> 
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users



___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-08 Thread John Dammeyer
> From: andy pugh [mailto:bodge...@gmail.com]
> On Thu, 8 Jul 2021 at 23:19, John Dammeyer  wrote:
> 
> > When I click the '-' with the RPM at 501 it drops to 401. Again and so on 
> > down to 101.  The last click should take it down to 1 or 0
> RPM.  However that last click sends it to max speed of 3000 RPM.
> 
> This happens when the PID goes negative. Imagine that the PID output
> is 0, but the speed is still positive, so the PID reduces the output
> to -10. This becomes an absolute speed ot 10, which is still too high,
> so the PID goes down to -100

That's what I though was happening.   Isn't it possible to also just use the 
equivalent of a floor function.  Ie. Don't really want the absolute value but 
instead not allow it to go negative?

If the speed is too high I can see the error term multiplied by the P being a 
negative value to be added to the commanded velocity.  So velocity is reduced. 
But should the spindle motor even be allowed to go backwards during the control 
loop?  That could damage cutters.  

If the error term * P is negative added to the current velocity < 0 then then 
0.  Not positive with a direction change.

John


> 
> The best way round this is probably to pass the pid output through an
> abs block (I think that you do that) but then control the spindle
> direction using the abs.0.is-positive / is-negative outputs rather
> than the spindle direction pins.
> 
> --
> atp
> "A motorcycle is a bicycle with a pandemonium attachment and is
> designed for the especial use of mechanical geniuses, daredevils and
> lunatics."
> � George Fitch, Atlanta Constitution Newspaper, 1912
> 
> 
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users



___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Runaway PID spindle.

2021-07-08 Thread andy pugh
On Thu, 8 Jul 2021 at 23:19, John Dammeyer  wrote:

> When I click the '-' with the RPM at 501 it drops to 401. Again and so on 
> down to 101.  The last click should take it down to 1 or 0 RPM.  However that 
> last click sends it to max speed of 3000 RPM.

This happens when the PID goes negative. Imagine that the PID output
is 0, but the speed is still positive, so the PID reduces the output
to -10. This becomes an absolute speed ot 10, which is still too high,
so the PID goes down to -100

The best way round this is probably to pass the pid output through an
abs block (I think that you do that) but then control the spindle
direction using the abs.0.is-positive / is-negative outputs rather
than the spindle direction pins.

-- 
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1912


___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


[Emc-users] Runaway PID spindle.

2021-07-08 Thread John Dammeyer
I'm at a loss to understand what is going wrong and therefore other than 
randomly trying different parameter values I'm not really moving forward.
 
What's happening is this on the 2.7.14 LinuxCNC system:
I've set the PID with P=1.8 and I=1.0 using the PWM module on the 7i92H which 
is creating a 0-10V signal to rotate the spindle.  Feedback is into the mesa 
encoder module with 60 slots per rev quadrature is 240 edges.
 
If I enable the spindle button for clockwise and then click the '+' button the 
spindle starts at 101 RPM.  As I recall when not using feedback the clicks 
would start at 1RPM so each click of the plus increments by 100RPM (the PID 
pulls it in pretty closely although the display oscillates around 101.9 to 99.1 
RPM but mostly 100.xxx RPM.
 
When I click the '-' with the RPM at 501 it drops to 401. Again and so on down 
to 101.  The last click should take it down to 1 or 0 RPM.  However that last 
click sends it to max speed of 3000 RPM.
 
After that the clicks +/- don't do anything.  Only the STOP buttons stops the 
spindle.  It's like the PID has overflowed and after that can't fix itself.  
 
Also another clue.  If I have it turning at say 2000 RPM and I click on stop 
and then on the clockwise button again before it's stopped it also takes off to 
3000.  I think it's like it sees too large an error and the negative value is 
turned into the absolute value rather than 0 to tell it to stop turning because 
the error is so large.
 
Below is the spindle hal file information.
Thanks
John
 
#***
#  SPINDLE S
#***
#===
# SPINDLE ENCODER
# Hardware assumptions:
#An encoder is connected to the spindle and puts out 60 pulses per 
revolution on phase A
#The encoder A phase is connected to the DB25 #2 Pin 11
#The encoder A phase is connected to the DB25 #2 Pin 12
#The encoder index pulse is connected to DB25 #2 Pin 13
 
# ---Encoder feedback signals/setup---
setphm2_7i92.0.encoder.01.counter-mode 0
setphm2_7i92.0.encoder.01.filter 1
setphm2_7i92.0.encoder.01.index-invert 1
setphm2_7i92.0.encoder.01.index-mask 0
setphm2_7i92.0.encoder.01.index-mask-invert 0
setphm2_7i92.0.encoder.01.scale  [SPINDLE_9]ENCODER_SCALE
 
 
# couple the encoder output to the motion control system so it knows what the 
spindle is doing.
net spindle-revs <=   hm2_7i92.0.encoder.01.position
net spindle-vel-fb-rps   <=   hm2_7i92.0.encoder.01.velocity
net spindle-index-enable <=>  hm2_7i92.0.encoder.01.index-enable
 
# ---setup spindle control signals---
net spindle-index-enable  <=>  motion.spindle-index-enable
net spindle-vel-cmd-rps-abs<=  motion.spindle-speed-out-rps-abs
net spindle-vel-cmd-rpm<=  motion.spindle-speed-out
#net spindle-vel-cmd-rpm-abs<=  motion.spindle-speed-out-abs
net spindle-enable <=  motion.spindle-on
net spindle-cw <=  motion.spindle-forward
net spindle-ccw<=  motion.spindle-reverse
net spindle-brake  <=  motion.spindle-brake
net spindle-revs   =>  motion.spindle-revs
 
# ---Setup spindle at speed signals---
#  Use ACTUAL spindle velocity from spindle encoder
#  spindle-velocity bounces around so we filter it with lowpass
#  spindle-velocity is signed so we use absolute component to remove sign
#  ACTUAL velocity is in RPS not RPM so we scale it.
 
# Filter uneven encoder signals with low pass filer.
setp scale.spindle.gain 60
setp lowpass.spindle.gain 0.005
 
net spindle-vel-fb-rps => lowpass.spindle.in
net spindle-vel-fb-rps-filtered <= lowpass.spindle.out
 
# Pass filtered rps to spindle
net spindle-vel-fb-rps-filtered =>  motion.spindle-speed-in
 
# create absolute value so RPS is unsigned
net spindle-vel-fb-rps-filtered => abs.spindle.in
net spindle-vel-fb-rps-abs  <= abs.spindle.out
 
# Convert RPS to RPM
net spindle-vel-fb-rps-abs => scale.spindle.in
net spindle-vel-fb-rpm-abs  <= scale.spindle.out
 
 
#=
# SPINDLE RAMP control  -- Open loop with no encoder feedback.
# set the parameter for max rate-of-change
# (max spindle accel/decel in units per second)
setp spindle-ramp.maxv 10
 
# hijack the spindle-speed-out and send it to spindle-ramp.in
net spindle-cmd <= motion.spindle-speed-out-rps => spindle-ramp.in
 
# Grab the output of the ramp component.  This is what changes slowly
net spindle-ramped <= spindle-ramp.out
 
#=
# SPINDLE PID control
setp   pid.s.Pgain [SPINDLE_9]P
setp   pid.s.Igain [SPINDLE_9]I
setp   pid.s.Dgain [SPINDLE_9]D
setp   pid.s.bias  [SPINDLE_9]BIAS
setp   pid.s.FF0   [SPINDLE_9]FF0
setp   pid.s.FF1   [SPINDLE_9]FF1
setp   pid.s.FF2   [SPINDLE_9]FF2
setp   pid.s.deadband  [SPINDLE_9]DEADBAND
setp   pid.s.maxoutput [SPINDLE_9]MAX_OUTPUT
setp   pid.s.error-previous-target true
#setp