Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Modbus CNC Spindle Control (3.6 RC2) Shihlin SL3

    Scheduled Pinned Locked Moved
    CNC
    4
    7
    219
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Firky_CNCundefined
      Firky_CNC
      last edited by

      Re: Modbus Spindle Control

      Very interested in the use of MODBUS on the Duet platform. While the duet mini 5 + doesn't support Modbus directly, using a UART on Aux 1 to a TTL to RS485 Adapter Module 3.3V ( Youmile). However, I'm not able to control the VFD from the Duet.

      I have found only one thread that discusses the options of using a converter. Here's where I am so far:

      In config.g

      M575 P2 B9600 S7 ; Enable IO_1 for MODBUS RTU at 9600 baud, 8E1

      Wiring :

      Duet Pins-------------->Youmile Pins
      Pin 1 (3.3V)--------------> VCC
      Pin 3 (GND)-------------> GND
      Pin 4 (IO_1_out = TX) ---> RXD
      Pin 2 (IO_1_in = RX) -----> TXD

      SL3 configuration
      07-00 Communication control enable 0 Enables MODBUS
      07-01 Station number (device ID) 1 Match Duet G-code A1
      07-02 Baud rate 1 9600 bps
      07-07 Format 4 RTU mode (1,8,E,1)

      The TX light on the converter flashes when sending M261.1 P2 A1 F3 R0 B1 V"reg0"; however returns Error: M261.1: no or bad response from Modbus device.

      The RX light on the converter only flashed when the VFD is first started.

      See below my Config.g file. This is just a test situation with one axis somewhat configured.

      ; Configuration file for Duet 3 Mini 5+ (firmware version 3.6.0-rc.2+2)
      ; Config Version: 1.1 - Updated 2025-04-14
      ; • Fixed invalid string concatenation for error messages
      ; • Added full MODBUS spindle control and safety interlock

      ; General preferences
      ; M952 B121 A51 ; change the CAN address of expansion board 121 to 51
      G90 ; send absolute coordinates
      M83 ; ...but relative extruder moves
      M550 P"Tiny_Mill" ; set printer name
      M453 ; select CNC device mode

      ; Drives
      M569 P0.0 S1 ; physical drive 0.0 goes forwards
      M569 P51 S1 D4 ; physical drive 121.0 goes forwards
      M569.1 P51 T2 C5 E0.1:2.0 H0.8 ; Stepper driver closed loop configuration
      M569 P0.2 S1 ; physical drive 0.2 goes forwards
      M569 P0.3 S1 ; physical drive 0.3 goes forwards
      M584 X0.0 Y51 Z0.2 E0.3 ; set drive mapping
      M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation
      M92 X80.00 Y80.00 Z400.00 E420.00 ; set steps per mm
      M566 X900.00 Y900.00 Z60.00 E120.00 ; set max instantaneous speed changes (mm/min)
      M203 X6000.00 Y6000.00 Z180.00 E1200.00 ; set max speeds (mm/min)
      M201 X500.00 Y500.00 Z20.00 E250.00 ; set accelerations (mm/s^2)
      M906 X800 Y2000 Z800 E800 I30 ; set motor currents (mA) and idle factor in %
      M84 S30 ; Set idle timeout

      ; Axis Limits
      M208 X0 Y0 Z0 S1 ; set axis minima
      M208 X230 Y210 Z200 S0 ; set axis maxima

      ; Endstops
      M574 Y1 S1 P"51.io0. in" ; endstop for low end on Y

      ; Z-Probe
      M558 P0 H5 F120 T6000 ; disable Z probe, set dive height/speeds
      M557 X15:215 Y15:195 S20 ; define mesh grid

      ; Heaters
      M140 H-1 ; disable heated bed

      ; Tools
      M563 P0 D0 F0 ; define tool 0
      G10 P0 X0 Y0 Z0 ; tool 0 axis offsets
      G10 P0 R0 S0 ; tool 0 standby and active temps

      ; RS485 MODBUS for SL3 VFD (via M260.1 and M261.1)

      M950 P0 T2 ; Define logical spindle 0 for object model access (spindles[0])
      M575 P2 B9600 S7 ; Enable IO_1 for MODBUS RTU at 9600 baud, 8E1

      ; Example MODBUS write commands using M260.1:
      ; Start forward (write 0x0002 to H1001 = register 4097)
      ; M260.1 P2 A1 R4097 B2
      ; Start reverse (write 0x0004 to H1001)
      ; M260.1 P2 A1 R4097 B4
      ; Stop (write 0x0000 to H1001)
      ; M260.1 P2 A1 R4097 B0
      ; Emergency stop (write 0x007F to H1001)
      ; M260.1 P2 A1 R4097 B127
      ; Set frequency: write value (e.g. 30000 = 300.00 Hz) to H1002
      ; M260.1 P2 A1 R4098 B30000

      ; Optional Read Monitoring (manual trigger or used in macros)
      ; Read spindle state (5 registers starting at H1001)
      M261.1 P2 A1 F3 R4097 B5 V"spindleState"
      ; Read output frequency (H1003)
      M261.1 P2 A1 F3 R4099 B1 V"spindleFreq"
      ; Read output power (H101B)
      M261.1 P2 A1 F3 R4123 B1 V"spindlePower"
      ; Read fault/error codes (H1003-H1004)
      M261.1 P2 A1 F3 R4103 B2 V"spindleErrors"

      ; Safety Interlocks & Error Handling
      if { exists(global.spindleErrors) && global.spindleErrors != null && global.spindleErrors[0] != 0 }
      M118 S"[MODBUS] VFD error detected." L1
      M118 S{"VFD error code = " ^ global.spindleErrors[0]} L1
      abort "VFD Error - Operation halted."

      ; These values can be accessed in object model via global variables after being read.

      jay_s_ukundefined 1 Reply Last reply Reply Quote 0
      • jay_s_ukundefined
        jay_s_uk @Firky_CNC
        last edited by

        @Firky_CNC I control an SL3 is RRF on my Milo Mill.
        One of the Milo Guys (@NineMile) has been developing the SL3 control stuff so it may be easier for you to test his stuff out.
        Discord is probably the best place to go https://discord.gg/Bn55Hj2Tsj

        Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

        Firky_CNCundefined 1 Reply Last reply Reply Quote 0
        • Firky_CNCundefined
          Firky_CNC @jay_s_uk
          last edited by

          @jay_s_uk Thanks, I've joined the discord, need to be a member 10 mins before I can post while I wait. Are you able to confirm if you have a specific mode that you need to put the VFD in to receive Modbus commands?

          jay_s_ukundefined 1 Reply Last reply Reply Quote 0
          • jay_s_ukundefined
            jay_s_uk @Firky_CNC
            last edited by

            @Firky_CNC i'm at work so I can't remember off the top of my head what registers need changing on the VFD

            Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

            1 Reply Last reply Reply Quote 0
            • Firky_CNCundefined
              Firky_CNC
              last edited by

              Just an update to say, using the MillenniumMachines ArborCTL release 0.0.5, I am able to control a SL3 VFD using the RJ45 connector using a TLL to RS845 converter connected to UART (OI_1) on the mini 5+

              Unable to post a link. But it is on GitHub.

              NineMileundefined 1 Reply Last reply Reply Quote 0
              • NineMileundefined
                NineMile @Firky_CNC
                last edited by

                @Firky_CNC said in Modbus CNC Spindle Control (3.6 RC2) Shihlin SL3:

                Just an update to say, using the MillenniumMachines ArborCTL release 0.0.5, I am able to control a SL3 VFD using the RJ45 connector using a TLL to RS845 converter connected to UART (OI_1) on the mini 5+

                Unable to post a link. But it is on GitHub.

                https://github.com/MillenniumMachines/ArborCTL/releases/tag/v0.0.5

                <- Author

                It's a RRF addon written in a similar vein to MillenniumOS, the idea is to provide a framework around which Modbus spindle control implementations can be written for particular VFD types.

                Currently it configures and runs the Shihlin SL3 and has untested support for the HY02 VFDs. It is alpha quality so if you do use it, be careful and it is at your own risk.

                Help supporting more VFD types appreciated.

                dc42undefined 1 Reply Last reply Reply Quote 0
                • dc42undefined
                  dc42 administrators @NineMile
                  last edited by dc42

                  @NineMile @Firky_CNC I have created https://github.com/Duet3D/RepRapFirmware/issues/1107. I welcome feedback on this feature request from anyone with experience of controlling spindles over Modbus.

                  dc42 created this issue in Duet3D/RepRapFirmware

                  open Add direct Modbus spindle control #1107

                  Duet WiFi hardware designer and firmware engineer
                  Please do not ask me for Duet support via PM or email, use the forum
                  http://www.escher3d.com, https://miscsolutions.wordpress.com

                  1 Reply Last reply Reply Quote 1
                  • First post
                    Last post
                  Unless otherwise noted, all forum content is licensed under CC-BY-SA