Suggestions on Spindle control options? (Analog, Step/Dir, ModBus)

More
26 Sep 2020 18:06 #183862 by jhandel
My Spindle is a 3.5kw 10000 RPM servo with an Encoder.. I can command it multiple ways, and for my usecase I am not sure which way to go..

Option 1: Modbus - easy to configure, I have already proofed out control in a python script, but I really want to keep my ability to rigid tap and most folks suggest avoiding userspace components in regards to things that need to be near realtime (at least servo loop responsive)

Option 2: Step and Direction - Tested and Works, accurate, however when the spindle is in that mode it really tries to act like a Servo, so a square form stop (IE the steps pulses just stop) shakes the heck out of things as it tries to stop instantly, and that can't be good for the ATC spindle, the Belt drive, or well the machine. And I haven't figured out how to get Linux CNC to play nice and ease down or up the pulses rather than just jumping to the desired pulse count. <-- will PID solve for that because spindle declaration settings doesn't and poking at PID settings with a stick didn't seem to... Also not sure how that hard stop with no pulsed based deceleration would get handled by a G33.1 command.

Option 3: Analog 0-10v with PID tuning (many, many threads on here around the pain of that approach).

Everything is driven off either a direct USB to ModBus connection or a 7i76e mesa card

My gut is pointing to option 2 with tuning of the PID or as-of-yet not found settings to get rid of the square form behavior and the spindle actually being eased down from a speed (so something in linuxcnc controlling the pulses/second in some form of scaling function rather than flooding them or turning them all off instantly..

Anyways, I am open to advice here given the many, many ways I "could" control this spindle and none of them jumping out as the "one best way"

Thanks

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

More
26 Sep 2020 19:55 - 26 Sep 2020 19:56 #183875 by PCW
I would probably suggest analog or Step/Dir

Note that you do not need PID to run a analog spindle and
in fact its not normally needed if the VFD is set up correctly.
For analog, you can use either VFD settings or LinuxCNCs
limit2 component to limit the spindle acceleration

If you choose Step/Dir, can use the stepgenerator
settings to limit acceleration if required.
Last edit: 26 Sep 2020 19:56 by PCW.

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

More
05 Oct 2020 00:52 - 05 Oct 2020 00:53 #184894 by jhandel
I finally got to a point where I can spin up and spin down my spindle via M03 M05 commands... I went with Step/Dir as I want the control for rigid tapping..

That being said, I ran into a bit of an issue... Is there a way to make M05 honor the MAX_ACCELORATION? When I do an M05 the spindle tries to break instantly (because the pulses are stoping instantly I imagine) and throws an over volt error (E Brake resister can not stop things instantly).


Or is this something I am going to have to put in my post processor to always go S0, G4P10, M05 or something?
Last edit: 05 Oct 2020 00:53 by jhandel.

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

More
05 Oct 2020 01:20 #184900 by PCW
Did you try setting the stepgen acceleration parameter?

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

More
05 Oct 2020 01:43 #184906 by jhandel
Both are set, StepGen gets ignored if Max_Acceleration isn't also set in the INI

Should StepGen acceloration be applied to an M05.. if so I'll dig back in there to figure out if I missed something..

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

More
05 Oct 2020 01:55 #184909 by jhandel
I see how these are wired up on the spindle (wired as in, between the configs)
These are the spindle settings from the INI file:
MAX_ACCELERATION = 50.0
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.
STEPGEN_MAXVEL = 187.50
STEPGEN_MAXACCEL = 100.00

here is the relivent part of the HAL file
setp   hm2_7i76e.0.stepgen.05.dirsetup        [SPINDLE_0]DIRSETUP
setp   hm2_7i76e.0.stepgen.05.dirhold         [SPINDLE_0]DIRHOLD
setp   hm2_7i76e.0.stepgen.05.steplen         [SPINDLE_0]STEPLEN
setp   hm2_7i76e.0.stepgen.05.stepspace       [SPINDLE_0]STEPSPACE
setp   hm2_7i76e.0.stepgen.05.position-scale  [SPINDLE_0]STEP_SCALE
setp   hm2_7i76e.0.stepgen.05.step_type        0
setp   hm2_7i76e.0.stepgen.05.control-type     1
setp   hm2_7i76e.0.stepgen.05.maxaccel         [SPINDLE_0]MAX_ACCELERATION
setp   hm2_7i76e.0.stepgen.05.maxvel           [SPINDLE_0]MAX_VELOCITY

this was configured by pnconfig so its wired to ignore stepgen_acceloration and use Max_Acceloration.. (which is great and does give me a nice soft start... I just need it to give me a nice soft stop with M05 too)

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

More
05 Oct 2020 21:03 #185007 by jhandel
I just found the power of remap.. So I might try to remap M5 to a custom ngc file that way I can do an S0, wait for that and then turn off the spindle... though I guess that means I have to figure out the right signals to turn off the spindle... maybe I can find those in a UI and I can steal them from there..

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

More
05 Oct 2020 23:19 - 05 Oct 2020 23:19 #185018 by PCW
This should be possible entirely in hal, you just need to not disable the spindle
until the actual speed is 0 or close to 0. You could use the stepgen velocity feedback
pin or actual encoder velocity if you have a spindle encoder.
Last edit: 05 Oct 2020 23:19 by PCW.

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

More
06 Oct 2020 01:37 - 06 Oct 2020 01:37 #185024 by jhandel
yah just learned that M5 isn't one I can override with remap..

So you are thinking the spindle off signal would be some kind of Anding logic with both the signal and the spindle speed being zero...

I haven't really gotten into HAL programming, but I guess I'll start poking around in that direction.. I saw someone on here doing a soft stop based on a time delay so maybe I can start from there..
Last edit: 06 Oct 2020 01:37 by jhandel.

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

More
06 Oct 2020 02:03 #185025 by PCW
I would consider using the near component to check the actual vs commanded
spindle speed and then some simple logic to keep the spindle on
if they are not equal, but make sure the spindle is off when LinuxCNC is not in
the machine-on state.

Note that there are some tricky safety issues if you leave the spindle enabled
for ramp down that need to be analyzed

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

Time to create page: 0.110 seconds
Powered by Kunena Forum