real time spindle control aka laser mode for grbl

Screenshot-7$X
G20 G90 G64 G40
T0 M6
G17
G1 F500

G0 X0 Y0 Z0
G1 X20

G0 X0 Y5 Z0
G1 X10
G1 X20

G0 X0 Y10 Z0
M3 S64
G1 X10
S196
G1 X20
M5

G0 X0 Y20 Z0
M3
G1 X10 S255
G1 X20 S127
M5 s0

G0 X0 Y25 Z0
M3
G1 X5 S128
G1 X10 S300
G1 X15 S1000
G1 X20 S255
M5

M30

Here are the changes:
Github Link

Compile time option example:
#if defined(LASER_SPINDLE) && defined(USE_LINE_NUMBERS)
void plan_buffer_line(float *target, float feed_rate, uint8_t invert_feed_rate, float rpm, uint8_t direction, int32_t line_number);
#elif defined(LASER_SPINDLE)
void plan_buffer_line(float *target, float feed_rate, uint8_t invert_feed_rate, float rpm, uint8_t direction);
#elif defined(USE_LINE_NUMBERS)
void plan_buffer_line(float *target, float feed_rate, uint8_t invert_feed_rate, int32_t line_number);
#else
void plan_buffer_line(float *target, float feed_rate, uint8_t invert_feed_rate);
#endif

5 thoughts on “real time spindle control aka laser mode for grbl”

  1. What grbl version and mod are you using?
    I can’t get laser / router switch to work in grbl0.9g
    or with
    grbl-9g_mod_nefa20150120

    any suggestions?

    Tnx

  2. PWM works nicely, not sure what can the 2W laser diode do with less than 50%, did you cut any paper or just engrave-burn surfaces?
    are the limit switches working for you? did you also bypass the z limit switch? Somehow I am get Homing fail, I had a modified version of grbl before that bypassed the z axis homing (on config.h file)

    1. Yes, if I remember right the 2W laser is only useful with settings above 50%. I did not play with my laser for a long time, but I do remember I used <1% (1) so I could see the laser without burning something. This was helpful to match the part with the cut or engraving starting point for example.
      My limit switches are working fine with or without the laser. I have my layer mounted so that after homing it is able to focus on the scrap board. Now I just need to measure the height of the item I want to engrave and I set the Z via a manual g code command. My G code file doesn't have any Z so it stays with what I set befor I start it. But I didn't play with my ShapeOko for some time now...

  3. Hello, after I discovered a micropause in spindle speed change in GRBL with my laser, I found your forum and grbl’s branch. I’d tried your version (I didn’t forget to enable laser mode in config before compiling and in $40 cmd), now speed seems not drop as it was in original grbl, but image still looks like prev setup, like still there are some delay at speed change that ‘blur’ speed values and it looks like almost no changes in laser power (but still noticeable in places with large gradient). Am I missing something? Also, arduino ide says hex file takes 97% of memory, but still compile. I use 0.5W violet diode, wood, and speed 1800mm/min, so it wouldn’t overburned.

Leave a Reply to Markus Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.