Technical Guide · Diode Laser · LaserBase

PWM Frequency Guide

Physical limits of the hardware chain and the role of firmware — v8
Contents
  1. What is PWM and why does it matter?
  2. Carrier vs. image modulation
  3. Rise/fall time — the physical limit
  4. TTL PWM vs. analog modulation
  5. Firmware architectures
  6. Platform comparison
  7. Calculations: f_img and overscan
  8. Quick reference table
  9. Validated system
  10. TB6600 and stepper driver limits
  11. Glossary

1 · What is PWM and why does it matter?

PWM (Pulse Width Modulation) is the signal type the controller uses to regulate the laser module's power. The controller continuously switches the signal on/off at a given frequency — the laser's average power depends on the proportion of time it's ON. This proportion is called the duty cycle.

Average power = P_max × duty_cycle [%] / 100
Example: P_max=10W, duty=60% → average power = 6W

Engraving quality is directly affected by how fast the PWM signal can respond. If the frequency is low — the laser can't render individual pixels precisely, because the signal is still in its previous state by the time it reaches the next pixel in the line.

The PWM frequency determines how often the laser can "switch." If this frequency is lower than what the speed and DPI setting demands, the engraving will be blurred, and individual pixels will bleed into each other.

2 · Carrier frequency vs. image modulation — the key difference

These are two completely different frequencies, and mixing them up is the source of most misunderstandings.

PWM carrier frequency

The frequency at which the firmware generates the PWM signal. This is the hardware timer's frequency. Platform specs (1 kHz, 10 kHz, 50 kHz, etc.) refer to this.

The firmware configures this. It runs at a fixed value, independent of the image.

Image modulation frequency (f_img)

The frequency at which the machine switches from pixel to pixel during engraving. This depends on movement speed and the DPI setting.

The job determines this. It increases with higher speed or higher DPI.

Rule: the carrier frequency needs to be at least 5-10× higher than f_img, so the PWM signal can precisely track the pixel sequence.

3 · Rise/fall time — the physical limit

A diode laser module can't react instantly to a PWM signal's state change. The rise time and fall time are the time it takes for the laser to reach maximum power, or zero power, respectively, following a signal edge.

Typical values: 5–20 µs
// The exact value depends on module type, power supply, and temperature.

Maximum useful frequency ≈ 1 / (2 × rise_time)
Example: rise=10µs → f_max ≈ 50 kHz

If the carrier frequency exceeds the limit set by rise/fall time, the laser can't fully turn on and off within every period — the duty cycle loses its precise meaning.

At high frequency the laser "gets stuck" at a mid-power level. This is most noticeable at 0% and 100% duty — the minimum power can't be zeroed out, the maximum can't be reached.

4 · TTL PWM vs. analog modulation

The two most common control methods differ fundamentally in what the firmware sends to the module.

TTL PWM

The controller sends a digital signal (0V / 5V) to the module's TTL input. The module's internal control electronics interpret the duty cycle and set the diode's current.

Advantage: noise-free, digitally controlled, no need for an RC filter.

Limit: the module's internal PWM processing determines the maximum useful frequency.

Analog modulation

An RC filter converts the PWM signal into a DC voltage (0–5V), which is sent to the module's analog input.

Advantage: smooth control even at an arbitrary PWM frequency.

Limit: requires an RC filter; the filter's time constant limits the switching speed.

LaserBase recommendation: TTL PWM is the preferred method. Most modern diode laser modules (LaserTree, Sculpfun, xTool, etc.) treat the TTL input as the main control channel.

5 · Firmware architectures — GRBL vs. grblHAL

The laser's PWM output is generated by the firmware. The two main firmware lines have fundamentally different PWM capabilities.

GRBL 1.1

The original GRBL implements timer-based PWM generation in software. This approach yields a maximum PWM frequency of roughly ~1 kHz. A higher value can be set, but timer accuracy drops as a result.

Above ~1 kHz, GRBL 1.1's PWM signal becomes unreliable. On AVR-based controllers (Arduino Nano, UNO) this is a hard limit; on ESP32 ~5 kHz is achievable in software, but this requires a firmware modification.

grblHAL

grblHAL accesses hardware timer resources directly — it uses the platform's native timer peripherals. Result: 5–50 kHz stable PWM, depending on platform.

With grblHAL + suitable hardware (Teensy 4.1, STM32), 50 kHz PWM is also achievable, with a stable duty cycle. This is enough even for 254 DPI at 36,000 mm/min engraving.

6 · Platform comparison

Platform Firmware Max PWM freq. Limiting factor Rating
Arduino Nano / UNO
AVR ATmega328
GRBL 1.1 ~1 kHz 8-bit timer, software PWM basic
ESP32
Xtensa LX6, 240 MHz
GRBL 1.1 ~1 kHz Firmware limit, not hardware limited
ESP32
Xtensa LX6, 240 MHz
grblHAL 5–20 kHz Hardware LEDC timer medium
Teensy 4.1
ARM Cortex-M7, 600 MHz
grblHAL 5–50 kHz Rise/fall time is the limit recommended
STM32F4xx
ARM Cortex-M4, 168 MHz
grblHAL 5–50 kHz Rise/fall time is the limit recommended

For Teensy 4.1- and STM32-based systems, the PWM frequency limit is no longer the firmware — it's the laser module's rise/fall time characteristic.

7 · Calculations: f_img and overscan

Image modulation frequency

For a given speed and DPI, the frequency at which the machine has to switch from pixel to pixel:

f_img [Hz] = (v [mm/min] × DPI [dot/inch]) / 1524
// 1524 = 25.4 mm/inch × 60 s/min

Example: v=24,000 mm/min, DPI=254
f_img = (24,000 × 254) / 1524 ≈ 4,000 Hz = 4 kHz

Example: v=36,000 mm/min, DPI=254
f_img = (36,000 × 254) / 1524 ≈ 6,000 Hz = 6 kHz

Overscan — the runup and runout before and after the line

The machine can't stop instantly — at the end of the line, speed drops to zero, then accelerates back up by the start of the next line. This path is the overscan: the laser is already turned off during this stretch, but the motion continues.

overscan [mm] = v² / (2 × a)
// v: speed [mm/s], a: acceleration [mm/s²]

Example: v=400 mm/s (24,000 mm/min), a=4,800 mm/s²
overscan = 400² / (2 × 4800) = 160,000 / 9600 ≈ 16.7 mm

LightBurn calculates and sets the overscan automatically if the "Overscan" option is enabled. The machine's work area shrinks by this much on each side the laser head starts from.

8 · Quick reference — required PWM carrier frequency

The table below shows how much PWM carrier frequency is needed for different speed and DPI combinations. The value shown in the table is f_img. A 5–10× carrier/f_img ratio is the theoretical ideal — the diode laser module's rise/fall time (~5–20 µs) can partially compensate for a lower ratio, but this varies by module and isn't guaranteed.

DPI 500 mm/min 1,000 mm/min 2,000 mm/min 4,000 mm/min 8,000 mm/min 16,000 mm/min 24,000 mm/min
10033 Hz66 Hz131 Hz262 Hz524 Hz1,048 Hz1,573 Hz
20066 Hz131 Hz262 Hz524 Hz1,049 Hz2,097 Hz3,146 Hz
25483 Hz167 Hz333 Hz667 Hz1,334 Hz2,667 Hz4,000 Hz
30098 Hz197 Hz394 Hz787 Hz1,575 Hz3,150 Hz4,724 Hz
500164 Hz328 Hz656 Hz1,312 Hz2,625 Hz5,249 Hz7,874 Hz
750246 Hz492 Hz984 Hz1,969 Hz3,937 Hz7,874 Hz11,811 Hz
1000328 Hz656 Hz1,312 Hz2,625 Hz5,249 Hz10,499 Hz15,748 Hz

Green: GRBL 1.1 is enough · Yellow: grblHAL recommended · Red: grblHAL + a suitable platform only (Teensy/STM32)

Remember: the carrier frequency needs to be 5–10× f_img. E.g. for a 4,000 Hz f_img, a 20–40 kHz carrier is needed for stable engraving.

9 · Validated system — test data

The configuration below was tested on a 50×70 cm dither engraving, stably and reproducibly.

Validated hardware configuration
Laser moduleLaserTree 10W (TTL PWM input)
Controller boardTeensy 4.1 (ARM Cortex-M7, 600 MHz)
FirmwaregrblHAL
Power supply24V
DriveGT2 16T (100 step/mm)
Motor drivers3× TB6600
Guide railHGR20 linear rail
Stable result

Resolution: 254 DPI

Speed: 24,000 mm/min

PWM carrier: 6.5 kHz

Every pixel switch executes precisely.

Usable result

Resolution: 254 DPI

Speed: 36,000 mm/min

PWM carrier: 6.5 kHz

f_img ≈ 6 kHz — carrier/f_img ratio ~1.1×, but the diode's rise time buffers it.

Conclusion: 254 DPI and 24,000 mm/min is the point where the Teensy 4.1 + grblHAL + LaserTree combination gives a reliable, reproducible result. Above 36,000 mm/min, rise/fall time becomes the bottleneck.

10 · TB6600 and stepper driver limits

The TB6600 is a widely used, inexpensive stepper motor driver module. On high-speed systems, you need to watch the maximum frequency of the STEP signal.

The TB6600's STEP input is reliable up to ~200 kHz. At 100 step/mm and 36,000 mm/min: STEP frequency = 100 × 600 mm/s = 60 kHz — this is safely within range. A limit can only appear at extreme speeds (>120,000 mm/min).

The TB6600 is not the ideal stepper driver for linear-rail, high-speed systems — its internal step-loss protection limits dynamic acceleration. TMC2226- or DM556-based drivers give a better result on high-acceleration systems.

Important: the TB6600 can't react to the laser's PWM signal — laser control and motor control are completely separate signals. The PWM frequency problem affects only the laser module, not the TB6600.

11 · Glossary