Spindle speed?

  • TheTinkeringMechanic1
  • Offline
  • Junior Member
  • Junior Member
More
03 Aug 2025 13:35 - 03 Aug 2025 13:36 #332719 by TheTinkeringMechanic1
Replied by TheTinkeringMechanic1 on topic Spindle speed?
Alright. I went from:

P = 2
I = 2
D =0
FF0 = 1
FF1 = 0
FF2 = 0
BIAS = 0
DEADBAND = 1
MAX_OUTPUT = 3000
ENCODER_SCALE = 4096

to

P = 0
I = 0
D = 0
FF0 = 1.0
FF1 = 0
FF2 = 0
BIAS = 0
DEADBAND = 1
MAX_OUTPUT = 3000
ENCODER_SCALE 4096

By just changing the ini I now have same forward and reverse spindle control.
However two things are different. The speed is a fraction of what is being commanded, S300, it's closer to S25 and it doesn't show a scale on the GUI in reverse, a minor issue I can address later.

I'm not sure what to # and where to add:

"PID command = signed commanded spindle speed in RPM
PID feedback = encoder RPM
PID output --> ABS --> analog out
ABS sign (of PID output) determines the FWD/REV pins"

This is definitely a step in the right direction.
Last edit: 03 Aug 2025 13:36 by TheTinkeringMechanic1.

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

  • TheTinkeringMechanic1
  • Offline
  • Junior Member
  • Junior Member
More
03 Aug 2025 14:52 #332727 by TheTinkeringMechanic1
Replied by TheTinkeringMechanic1 on topic Spindle speed?
One step forward. After some digging on the internet I went into custom_postgui.hal and changed this:

net spindle-vel-cmd-rpm gmoccapy.spindle_feedback_bar

To this:

net spindle-vel-cmd-rpm-abs gmoccapy.spindle_feedback_bar

And it now shows a green status bar in the GUI in forward and reverse.
Still working on the rpm issue.

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

  • TheTinkeringMechanic1
  • Offline
  • Junior Member
  • Junior Member
More
03 Aug 2025 15:54 #332731 by TheTinkeringMechanic1
Replied by TheTinkeringMechanic1 on topic Spindle speed?
Got it! Now that I had RPM control forward and reverse with a bonus green GUI scale in both directions it was just a matter of adjusting this:

setp scale.0.gain 0.00275

To this:

setp scale.0.gain 0.008

Which so far is the closest to s300 command. I'll know more when I get an RPM gauge on it.

It may require some adjustments in the VFD. But I'm content with the progress so far.

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

More
03 Aug 2025 18:40 #332743 by andypugh
Replied by andypugh on topic Spindle speed?
Just to explain what was going on previously.

The config is set up with closed-loop control of spindle speed, using a PID component. You can look up PID elsewhere, but most references will tend to overcomplicate it. They have existed since long before digital computers. You run a PID controller in your head when you drive a car. Feedback is looking at the speedo, the command is how hard you press the pedal, and the output is how much power the engine makes.

To stretch the analogy, in your linuxcnc config you have a speedo that goes negative, but you are stupid (as you are a computer) and when told to do 70mph in reverse you see -70mph on the speedo, think "that's 140mph less than 70mph" and press the pedal to the floor.

You have to ensure that the domains of the signals are the same. If you are using single-sided speed command (spindle.0.speed-out-abs for example) then the PID neds to see a single-sided speed feedback, typically achieved by passing the measured encoder speed thorugh an "abs" component in HAL.

You might find it instructive to browse through the available HAL components, they are fundamental to the flexibility of lInuxCNC as you can do all sorts of manimpuations on the input and output signals.

You can see the list here:
linuxcnc.org/docs/stable/html/
if you scroll-down to "Realtime components and kernel modules" and (to a slightly lesser extent in this context) "Commands and userspace components"
The following user(s) said Thank You: Clive S

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

  • TheTinkeringMechanic1
  • Offline
  • Junior Member
  • Junior Member
More
03 Aug 2025 22:30 - 04 Aug 2025 00:29 #332770 by TheTinkeringMechanic1
Replied by TheTinkeringMechanic1 on topic Spindle speed?
After not having a single bit of Linux, let alone LinuxCNC experience beyond knowing the name, I'm quite happy with what I accomplished within the space of a few weeks. Took a CNC converted lathe and turned it into a dual head urethane grinder with notching and grooving cutting. I'll take what wins I can get at the moment. I'm fairly certain as time progresses and my understanding expands, I'll look back on what I did and facepalm at my "work". For now, I have to stick with the old saying: If it's stupid and it works, it's still stupid and you're lucky.
Thanks for the resource, I will go through it as I have other homework sources I need to review to gain a better understanding of this system.
Last edit: 04 Aug 2025 00:29 by TheTinkeringMechanic1.

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

Time to create page: 0.116 seconds
Powered by Kunena Forum