HAL Edits for RS485 / VFD Spindle Control

More
06 Feb 2026 21:05 #342571 by andypugh
Replied by andypugh on topic HAL Edits for RS485 / VFD Spindle Control
spindle.0.speed-out is clearly there in the screenshot.

Two possibilities spring to mind, one of them rather wierd.

1) You have the net commands for the spindle too early in the HAL file, ie before the motmod module has been loaded.

2) The - in speed-out is the wrong sort of dash. Though it looks right in this case. Maybe try re-typing it using the minus key. I think I typed out the example text on my Mac on a train, and it likes to be clever with typography.
The following user(s) said Thank You: Mr1576

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

More
08 Feb 2026 11:12 #342647 by Mr1576
Replied by Mr1576 on topic HAL Edits for RS485 / VFD Spindle Control
@andypugh I relocated the net commands after the motmod .......

IT WORKS!

I cannot tell you how grateful I am -- I've been going round in circles for so long and now cannot stop smiling.

The following user(s) said Thank You: tommylight

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

More
10 Feb 2026 20:21 - 10 Feb 2026 21:40 #342786 by jtrantow
Replied by jtrantow on topic HAL Edits for RS485 / VFD Spindle Control
Looks like you have a very simple VFD/Spindle setup. If you are using a simple spindle setup that may be enough. If you have a machine with any type of gear ration between the motor and spindle the following may be of use.I'm using RS485 VFD to control the spindle on three different machines:
  • Router - high speed spindle 24000 RPM with a CommanderSK VFD (capable of 1000hz).
  • Mill - Six pulley combinations connected to nominal 1725 RPM @ 60 hz motor with a GS2 VFD. [MANUAL BELT CHANGE]
  • Lathe - Six pulley combinations connected to nominal 1750 RPM @ 60 hz motor with a CommanderSK VFD. [MANUAL BELT CHANGE]

    With the Router I don't have to worry about gearing changes (or sending commands greater than the VFD can handle). 

    With the Mill and Lathe, I only recently figured out a way to easily change scaling to match the gearing using pid FF0.
     
    Using PID component is nice for several reasons:
    1. I can use the gmoccapy/Calibration to change/test/save [SPINDLE_0]FF0 while running linuxcnc whenever I change belts.
    2. I can set [SPINDLE_0]MAX_OUTPUT to avoid sending illegal RPM commands to the VFD which get ignored and can cause a crash if you aren't checking the at-speed status.I added a [SPINDLE_0]MAXIMUM_MOTOR_RPM parameter to the .ini and kick off a message to change belt if the motor RPM is maxed out.  

      Here are my additions to Mill.ini for this implementation:
      Mill.ini

      [DISPLAY]
      MESSAGE_BOLDTEXT = NONE
      MESSAGE_TEXT = VFD using maximum motor RPM.
      MESSAGE_TYPE = okdialog
      MESSAGE_PINNAME = VFD-max-motor-rpm
      
      [SPINDLE_0]
      P = 0
      I = 0
      D = 0
      FF0 = 1.135
      [code]MAX_OUTPUT = 1799
      [/code]

In the near future I intend to redo my spindle encoders and use the forum.linuxcnc.org/47-hal-examples/27071-automatic-spindle-gea idea to automatically choose FF0.
Attachments:
Last edit: 10 Feb 2026 21:40 by jtrantow. Reason: Used wrong graphic for Mill.
The following user(s) said Thank You: rodw

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

Time to create page: 0.267 seconds
Powered by Kunena Forum