Control Board Subsystem – Arduino, CNC Shield & MKS DLC32

1. What Is a Control Board?

SOFTWARE G-code via USB CONTROL BOARD Arduino / MKS DLC32 GRBL Firmware DRIVERS A4988 / TMC2209 MOTORS + LASER Control Board: the brain of the CNC system

A control board is the brain of the CNC laser engraver. It receives G-code commands from software (via USB, Wi-Fi, or SD card), interprets them using embedded firmware (GRBL), and generates precise electrical signals — STEP, DIR, PWM — that drive motors and the laser module.

Two control board setups are common in DIY laser engravers: the classic Arduino Uno + CNC Shield (budget builds) and the modern MKS DLC32 V2 (dedicated laser controller, used in our CLE build).

2. Arduino Uno R3 + CNC Shield V3

ARDUINO UNO R3 ATmega328P @ 16 MHz 32 KB Flash, 2 KB SRAM USB → Serial (CH340) PWM: D11 (Laser TTL) ⚠ 5V logic only CNC SHIELD V3 Slots: X, Y, Z + Clone Accepts: A4988, DRV8825 Vmot: 12–24V (separate) Spindle/Laser: D11 PWM ⚠ No 5V on Vmot rail! stacks A4988 ×3 X / Y / Z Buck Conv. 12V → 5V Arduino Uno stacks under CNC Shield V3 — never power Arduino via Vmot rail

The Arduino Uno R3 is an 8-bit AVR microcontroller board (ATmega328P, 16 MHz) that runs the GRBL firmware. It communicates with the PC over USB-Serial and outputs STEP/DIR pulses to the CNC Shield, plus a 1 kHz PWM signal on pin D11 to control the laser.

The CNC Shield V3 is a plug-in expansion board that snaps directly onto the Arduino headers. It breaks out four stepper driver slots (X, Y, Z, and a clone channel), a spindle/laser PWM terminal, limit switch inputs, and separate motor power (Vmot) — isolating the high-current motor supply from the Arduino's 5V logic.

⚠ Critical Voltage Warning

The Arduino is powered at 5V. The CNC Shield motor rail (Vmot) is connected directly to 12V or 24V. Never connect the Vmot rail to the Arduino's VCC. The Arduino must be powered via USB or its barrel jack independently, or through a buck converter (12V → 5V) wired to the Arduino's 5V pin.

Vmot = 12–24 V (motor supply) ≠ VArduino = 5 V (logic supply)
Use Buck Converter: 12 V → 5 V, I ≥ 1 A → Arduino 5V pin

GRBL on Arduino Uno

GRBL is open-source CNC firmware flashed onto the Arduino's flash memory (32 KB). It parses G-code, runs a real-time motion planner, and drives three stepper axes simultaneously. Key settings:

$100=80   ; X steps/mm
$101=80   ; Y steps/mm
$102=400  ; Z steps/mm
$32=1     ; Laser mode ON (power scales with speed)
$30=1000  ; Max spindle speed (S1000 = 100% laser power)
    

Limitations of Arduino + CNC Shield

3. MKS DLC32 V2.1 – Dedicated Laser Controller

MKS DLC32 V2.1 ESP32 Core Dual-core 240 MHz Wi-Fi + Bluetooth FluidNC / GRBL-ESP32 Driver Slots 3× (X / Y / Z) A4988 / TMC2208 TMC2209 / DRV8825 24V safe on Vmot Power Regulation Input: 12–24V DC Built-in 5V / 3.3V ✅ No buck converter ✅ Safe 24V input Interfaces USB-C MicroSD TFT Touch (TS35-R) Laser PWM + TTL MKS DLC32: ESP32-based, built-in regulation, Wi-Fi, TFT support — used in our CLE build

The MKS DLC32 V2.1 is a 32-bit ESP32-based controller purpose-built for laser engravers. Unlike the Arduino + CNC Shield combo, it integrates everything on one board: the microcontroller, motor driver sockets, power regulation, laser PWM output, and interfaces for USB-C, SD card, and a TFT touchscreen.

It runs FluidNC (or GRBL-ESP32), a 32-bit port of GRBL optimized for the ESP32's dual-core 240 MHz processor. This gives it a far larger motion planning buffer, smoother step generation, and wireless G-code streaming over Wi-Fi.

MKS DLC32 V2.1 Hardware Specifications

Parameter Value
MicrocontrollerESP32 Dual-Core, 240 MHz (Xtensa LX6)
Flash / RAM4 MB Flash, 520 KB SRAM
WirelessWi-Fi 802.11 b/g/n + Bluetooth 4.2
Input Voltage12–24 V DC (built-in regulation)
Logic Level3.3 V (STEP/DIR/EN outputs)
Driver Slots3× (X, Y, Z) — A4988 / TMC2208 / TMC2209 / DRV8825
Laser OutputPWM + TTL (0–5 V, 1 kHz, dedicated laser port)
Limit Switch Inputs3× (X-min, Y-min, Z-min) + Probe
TFT ConnectorTS35-R (3.5" SPI capacitive touch)
USB InterfaceUSB-C (CH340 Serial-USB bridge)
SD CardMicroSD (SPI) for offline G-code
FirmwareFluidNC (GRBL-ESP32)

Why MKS DLC32 Was Chosen for Our CLE Build

4. STEP / DIR / EN Signal Protocol

Time → STEP 1 pulse = 1 microstep DIR HIGH = forward LOW = reverse EN LOW = driver enabled (active low)

The control board communicates with each stepper driver using three digital signals:

Motor speed (RPM) = (fSTEP × 60) / (steps/rev × microstep_divisor)
Example: 4000 Hz, 200 steps/rev, 1/16 → RPM = (4000 × 60) / (200 × 16) = 75 RPM

5. Microstepping – Resolution vs. Torque

Microstepping: Sinusoidal Current Decomposition Phase A Phase B Smaller microstep = finer sinusoidal approximation = smoother motion, less torque ripple

A full-step NEMA 17 motor moves 1.8° per step (200 steps/revolution). Microstepping divides each full step by driving the two motor phases with sinusoidal current ratios, producing intermediate rotor positions. The CNC shield jumpers (MS1/MS2/MS3 pins) or driver UART configuration set the divisor.

Mode Divisor Steps/Rev Step Angle Linear Res. (2mm lead, 16T pulley)
Full Step12001.800°0.100 mm/step
Half Step24000.900°0.050 mm/step
1/8 Step816000.225°0.0125 mm/step
1/16 Step1632000.1125°0.00625 mm/step
1/32 Step (TMC)3264000.05625°0.003125 mm/step
Steps/mm = (Steps/rev × Microstep divisor) / (Belt pitch × Pulley teeth)
Example: (200 × 16) / (2mm × 16T) = 3200 / 32 = 100 steps/mm → $100=100

Higher microstepping gives finer resolution and smoother motion, but reduces peak torque (since each microstep delivers less current per phase) and requires higher STEP frequency for the same speed.

6. Laser PWM Control – From G-code to Photons

PWM Duty Cycle vs. Laser Power S0 → 0% S250 → 25% S500 → 50% S800 → 80% S1000 → 100% G-code S-word (0–1000) maps linearly to PWM duty cycle on the laser pin

The control board outputs a PWM signal (Pulse-Width Modulation) on its dedicated laser pin to control laser power. The G-code M3 S<value> sets the power, where S ranges from 0 (off) to 1000 (full power by default in GRBL).

Duty Cycle D = S / Smax (Smax = $30, default 1000)
OCR1A = ⌊ 255 × S / 1000 ⌉ (Arduino 8-bit timer register)
MKS DLC32: 16-bit PWM → finer resolution, same mapping
M3 S0      → Laser OFF   (D = 0%)
M3 S500    → 50% power   (D = 50%)
M3 S1000   → Full power  (D = 100%)
M5         → Laser OFF + spindle disable
    

With laser mode enabled ($32=1), GRBL also applies velocity compensation: the actual PWM duty is scaled proportionally to the current feed rate vs. the programmed feed rate. This ensures constant energy per millimeter even when the head decelerates around corners — preventing over-burning.

Pactual = Pprogrammed × (vcurrent / vprogrammed)

7. GRBL / FluidNC Configuration Parameters

GRBL stores its configuration in non-volatile EEPROM (Arduino) or NVS flash (ESP32/MKS). Settings are accessed via the $$ command and modified with $N=value. The most critical parameters for a laser engraver:

Setting Name Typical Value Effect
$100X steps/mm80–100Steps per mm of X travel
$101Y steps/mm80–100Steps per mm of Y travel
$110X max feed (mm/min)5000–10000Maximum X travel speed
$120X acceleration (mm/s²)500–2000Ramp-up rate; too high causes missed steps
$30Spindle max RPM1000S1000 = 100% laser power
$32Laser mode1Enables velocity compensation for laser
$20Soft limits1Stops motion before hitting frame boundaries
$21Hard limits1Triggers emergency stop on limit switch contact
$22Homing cycle1Enables $H home command using limit switches

Homing Sequence

When $H is sent, GRBL moves the machine toward its limit switches at homing speed ($25), backs off, then approaches slowly ($27 pull-off distance). This establishes Machine Zero (MPos 0,0,0) — the absolute reference for all subsequent moves.

$H          ; Run homing cycle
G28         ; Move to pre-defined home position
G92 X0 Y0   ; Set current position as Work Zero
    

8. Complete Signal Flow: G-code → Motor + Laser

CLE SOFTWARE G1 X50 F3000 M3 S800 MKS DLC32 GRBL Motion Planner Trapezoid Accel. STEP DRIVER A4988 / TMC2209 H-bridge coil driver NEMA 17 Rotates axis belt X / Y movement LASER DRIVER PWM → I_LD current LASER MODULE 445 nm coherent beam Limit switch feedback → Emergency stop / Homing Two parallel paths: STEP/DIR → motor axis | PWM → laser power

The control board runs two parallel signal paths simultaneously. The motion path sends STEP/DIR pulses to the stepper drivers at the rate required to achieve the commanded feed rate, while the laser path outputs a PWM signal whose duty cycle encodes the commanded power (S-word), scaled by velocity compensation.

  1. G-code received (USB / Wi-Fi / SD): e.g., G1 X50 F3000 M3 S800
  2. Motion planner computes trapezoidal velocity profile — ramp up, cruise, ramp down.
  3. Step timer ISR fires at computed frequency: outputs STEP pulse to X/Y driver.
  4. PWM timer outputs duty = (S/1000) × (v/v_req) to laser pin simultaneously.
  5. Laser driver converts PWM to laser diode current (ILD = K × VPWM).
  6. Limit switch inputs (hardware interrupt) can trigger emergency stop at any time.

9. Arduino + CNC Shield vs. MKS DLC32 — Comparison

Feature Arduino Uno + CNC Shield MKS DLC32 V2.1
CPU ATmega328P — 8-bit, 16 MHz ESP32 — 32-bit dual-core, 240 MHz
Firmware GRBL 1.1 (AVR) FluidNC / GRBL-ESP32
Wireless None Wi-Fi + Bluetooth built-in
Voltage Safety ⚠ Manual buck converter required ✅ Built-in 5V/3.3V regulation
Offline Operation Requires PC connected via USB SD card + TFT touchscreen
Laser Output Spindle pin D11 (shared) Dedicated laser PWM + TTL port
Step Buffer 16 blocks (limited) 128+ blocks (smooth arcs)
Approximate Cost ~$31 (Uno + Shield + drivers) ~$62 (all-in-one)
Best For Budget builds, learning GRBL basics Production builds, standalone operation

10. Protection Features & Maintenance

Built-in Protections

Maintenance Checklist

A4988 current limit: Imax = Vref / (8 × Rsense)
Rsense = 0.068 Ω (standard A4988) → Imax = Vref / 0.544
For I = 1.5A → Vref = 1.5 × 0.544 = 0.816 V

📚 Further Learning Resources

Back to Materials