I'm rebuilding a laser CNC machine and using LaserWeb4 as the control interface and GRBL 1.1 as the low-level interface to the stepper motors, limit switches and the laser. I have all the motion sorted out and am working on the laser control.
Figure 1. The GRBL 1.1 pinout. Pin 11 is used for spindle (cutter) speed on a milling machine or laser power control on a laser cutter.
The machine is using a Synrad 48 Series laser module which requires a 5 kHz PWM frequency (page 45 - 46).
The GRBL 1.1 sketch can be configured for a variety of PWM frequencies. See cpu_map.h.
// Prescaled, 8-bit Fast PWM mode.
#define SPINDLE_TCCRA_INIT_MASK ((1<<WGM20) | (1<<WGM21)) // Configures fast PWM mode.
// #define SPINDLE_TCCRB_INIT_MASK (1<<CS20) // Disable prescaler -> 62.5kHz
// #define SPINDLE_TCCRB_INIT_MASK (1<<CS21) // 1/8 prescaler -> 7.8kHz (Used in v0.9)
// #define SPINDLE_TCCRB_INIT_MASK ((1<<CS21) | (1<<CS20)) // 1/32 prescaler -> 1.96kHz
#define SPINDLE_TCCRB_INIT_MASK (1<<CS22) // 1/64 prescaler -> 0.98kHz (J-tech laser)
// NOTE: On the 328p, these must be the same as the SPINDLE_ENABLE settings.
#define SPINDLE_PWM_DDR DDRB
#define SPINDLE_PWM_PORT PORTB
#define SPINDLE_PWM_BIT 3 // Uno Digital Pin 11
It seems that my options are 62.5 kHz, 7.8 kHz, 1.96 kHz or 0.98 kHz.
Why does it matter? Two excerpts from the Synrad manual:
Tickle frequencies [a 'keep-awake' signal at zero power] lower than 4.5 kHz may compromise laser performance, ..., and stress the RF [radio frequency] electronics thereby reducing long term reliability while tickle frequencies greater than 5 kHz may cause unintended lasing.
Because laser output follows PWM input with a rise and fall time constant of ~100 µs, the laser cannot precisely follow Command signal frequencies over t kHz with duty cycles greater than 50%.
Can anyone see a workaround for this within the constraints of the GRBL configuration?
I can only think of a hardware solution to filter the PWM out and run it through another device to convert the analog signal to a 5 kHz PWM.
Many thanks.