Sasana Year 2568 , Myanmar Year 1386 , Tabaung waning 14 , Thursday , Sb Eve.

Tuesday, March 25, 2025

Grbl_ESP32 MKS DLC32 Board with FluidNC CNC Firmware

When constructing robotic rigs capable of movement along the x, y, and z axes, I have often relied on CNC controllers such as GRBL paired with the Arduino CNC shield, as detailed in my previous post:
DrawBot XY Plotter with Arduino GRBL Controller

With recent advancements in this field, I would like to explore emerging controllers like FluidNC and new hardware boards such as the Makerbase MKS DLC32.
FluidNC is a CNC firmware that utilizes the ESP32, offering an alternative to using Arduino UNO. It is compatible with GRBL, enabling the seamless transmission of GCode. It also officially supports a lot of third party hardware boards such as Makerbase MKS DLC32 V2.1 Controller.

Figure 1. MKS DLC32 V2.1 board.

In my experience, CoreXY mechanisms that employ timing belts tend to operate more quickly and quietly compared to those utilizing lead screw rods. For those interested, I have discussed the process of updating the FluidNC firmware for the MKS DLC32 board tailored for a CoreXY type machine.


Hardware

We will utilize the
Makerbase MKS DLC32 V2.1 Controller
, available at the Makerbase Official Store on AliExpress. The following table compares the ESP32 and ATMEGA328P MCUs.

MCU ATMEGA328P ESP32-WROOM-32U
Word size 8 bits 32 bits
Flash 32 kB 8192 kB
RAM 32 kB 520 kB
Table 1. MCU comparison.


As detailed in the DLC32 Wiring Manual, the controller features three sockets for X, Y, and Z motor drivers. You can install pupular stepper motor driver modules such as A4988, DRV8825, or TMC2209. Among these, the TMC2209 offers advanced features that provides smoothest motor operation, including sensorless homing.
When connecting the drivers, ensure that the black row of pins on the module aligns with that of the socket.


Figure 2. MKS DLC32 V2.1 pin configuration.


As shown in the figure above, there are two connectors for Y motors; however, they share the same driver chip, which is not optimal compared to having a separate driver for each motor. For limit switch connections, a mechanical switch requires only GND and S. The following figure illustrates the micro-step settings for the DIP switch for each motor driver.


Figure 3. Microstep settings.


For current adjustment, Table.2 summarizes the details for the DXIMTECH SL42STH34-1334A, a NEMA 17 stepper motor measuring 42 mm x 42 mm x 34 mm, which has 200 steps per revolution and a rated current of 1.33 A.

Module A4988 DRV8825 TMC2209
V-adj I-lim / 1.84 I-lim / 2 I-lim x 1.41
V for 1.33 A limit 0.72 V 0.67 V 1.9 V
Table 2. Current adjustment for NEMA 17.


Similarly, current adjustment details for the 28H30H0604A2, a NEMA 11 stepper motor measuring 28 mm x 28 mm , which has 200 steps per revolution and a rated current 0.67 A, are shown in Table 3.

Module A4988 DRV8825 TMC2209
V-adj I-lim / 1.84 I-lim / 2 I-lim x 1.41
V for 0.67 A limit 0.36 V 0.34 V 0.94 V
Table 3. Current adjustment for NEMA 11.


For detailed calibration procedures, please refer to the following link: https://cool-emerald.blogspot.com/2021/04/drawbot-xy-plotter-with-arduino-grbl.html#calibration

Firmware Update

The Github repository for Makerbase MKS can be found here:

https://github.com/makerbase-mks/MKS-DLC32

For the V2.1 model with a 3.5 inch LCD screen for CoreXY, you can download the following precompiled binary located in the firmware/TS35 directory:

https://github.com/makerbase-mks/MKS-DLC32/blob/main/MKS-DLC32-main/firmware/TS35/Laser/CoreXY/Board_v2.0/V2.10_H35_2022_0704_C_ZX_001.bin

You can then use the flash tools available at:

https://github.com/makerbase-mks/MKS-DLC32/blob/main/MKS-DLC32-main/firmware/tool/MKSLaserTool_setupV2.0.4.rar

as illustrated in the following figure. This tool also includes features for changing GRBL settings.


Figure 4. Firmware update tool.


IMPORTANT NOTE: Disconnect wire connections for stepper motors during the firmware update!

For more customization and flexibility, you may also consider using the firmware update from the FluidNC repository. However, please note that it does not support LCD screens.

https://github.com/bdring/FluidNC

FluidNC provides a simple and user-friendly web installer at:

https://installer.fluidnc.com/

To update the firmware, connect a USB cable to your PC, clike 'Connect', and proceed with the update. Afterward, update the config file for the MKS DLC32 V2.1 available at the following link:
MKS_DLC32_21_XYZ.yaml


Figure 5. FluidNC web installer.


Download the configuration file, change the kinematics to corexy, and upload it using the file browser from the FluidNC web installer. Activate the new configuration. The following listing shows the updated configuration yaml file.

board: MKS-DLC32 V2.1
name: K40 Laser
meta: (01.01.2022) by Skorpi

kinematics:
  corexy:

stepping:
  engine: I2S_STATIC
  idle_ms: 0
  pulse_us: 4
  dir_delay_us: 1
  disable_delay_us: 0
axes:
  shared_stepper_disable_pin: I2SO.0
  x:
    steps_per_mm: 52.5
    max_rate_mm_per_min: 4000.000
    acceleration_mm_per_sec2: 1500.000
    max_travel_mm: 325.000
    soft_limits: true
    homing:
      cycle: 1
      positive_direction: false
      mpos_mm: 0.000
      feed_mm_per_min: 300.000
      seek_mm_per_min: 5000.000
      settle_ms: 500
      seek_scaler: 1.100
      feed_scaler: 1.100

    motor0:
      limit_neg_pin: gpio.36
      hard_limits: false
      pulloff_mm: 2.000
      stepstick:
        step_pin: I2SO.1
        direction_pin: I2SO.2

  y:
    steps_per_mm: 52.5
    max_rate_mm_per_min: 4000.000
    acceleration_mm_per_sec2: 300.000
    max_travel_mm: 220.000
    soft_limits: true
    homing:
      cycle: 1
      positive_direction: false
      mpos_mm: 0.000
      feed_mm_per_min: 300.000
      seek_mm_per_min: 5000.000
      settle_ms: 500
      seek_scaler: 1.100
      feed_scaler: 1.100

    motor0:
      limit_neg_pin: gpio.35
      hard_limits: false
      pulloff_mm: 2.000
      stepstick:
        step_pin: I2SO.5
        direction_pin: I2SO.6:low

  z:
    steps_per_mm: 800.000
    max_rate_mm_per_min: 4000.000
    acceleration_mm_per_sec2: 500.000
    max_travel_mm: 80.000
    soft_limits: true
    homing:
      cycle: 0
      positive_direction: false
      mpos_mm: 0.000
      feed_mm_per_min: 300.000
      seek_mm_per_min: 1000.000
      settle_ms: 500
      seek_scaler: 1.100
      feed_scaler: 1.100

    motor0:
      limit_neg_pin: gpio.34
      hard_limits: false
      pulloff_mm: 1.000
      stepstick:
        step_pin: I2SO.3
        direction_pin: I2SO.4

i2so:
  bck_pin: gpio.16
  data_pin: gpio.21
  ws_pin: gpio.17

spi:
  miso_pin: gpio.12
  mosi_pin: gpio.13
  sck_pin: gpio.14

sdcard:
  cs_pin: gpio.15
  card_detect_pin: NO_PIN

control:
  safety_door_pin: NO_PIN
  reset_pin: NO_PIN
  feed_hold_pin: NO_PIN
  cycle_start_pin: NO_PIN
  macro0_pin: gpio.33:low:pu
  macro1_pin: NO_PIN
  macro2_pin: NO_PIN
  macro3_pin: NO_PIN

macros:
  startup_line0:
  startup_line1:
  macro0: $SD/Run=lasertest.gcode
  macro1: $SD/Run=home.gcode
  macro2:
  macro3:

coolant:
  flood_pin: NO_PIN
  mist_pin: NO_PIN
  delay_ms: 0

probe:
  pin: gpio.22
  check_mode_start: true

Laser:
  pwm_hz: 5000
  #L on Beeper / IN on TTL
  output_pin: gpio.32
  enable_pin: I2SO.7
  disable_with_s0: false
  s0_with_disable: false
  tool_num: 0
  speed_map: 0=0.000% 0=12.500% 1700=100.000%
# 135=0mA 270=5mA 400=10mA 700=16mA
user_outputs:
  analog0_pin: NO_PIN
  analog1_pin: NO_PIN
  analog2_pin: NO_PIN
  analog3_pin: NO_PIN
  analog0_hz: 5000
  analog1_hz: 5000
  analog2_hz: 5000
  analog3_hz: 5000
  digital0_pin: NO_PIN
  digital1_pin: NO_PIN
  digital2_pin: NO_PIN
  digital3_pin: NO_PIN

start:
  must_home: false

# 5,18,19,22,23,25,26,27,32,33,39,I2SO.7
# SDA 0 / SCL 4


Listing 1. MKS_DLC32_21_XYZ_CoreXY.yaml


If you intend to use a servo for the Z-axis, further details can be found in the FluidNC Wiki under the RC Servo section:

http://wiki.fluidnc.com/en/config/axes

For instance, you can control a small 5V servo using IO22 of the Prob connector by modifying the YAML file as follows:

z:
  steps_per_mm: 100.000
  max_rate_mm_per_min: 5000.000
  acceleration_mm_per_sec2: 100.000
  max_travel_mm: 5.000
  soft_limits: true
  homing:
    cycle: 1
    positive_direction: true
    mpos_mm: 5.000

  motor0:
    rc_servo:
      pwm_hz: 50
      output_pin: gpio.22
      min_pulse_us: 1000
      max_pulse_us: 2000
Listing 2. Config for RC servo.

No comments:

Post a Comment

Comments are moderated and don't be surprised if your comment does not appear promptly.