Can you provide a bit more information? What program is producing the G-code? What is your hardware set-up? Looks like it is happening just after (or before) a rapids movement - G0. G0 immediately turns off the laser in laser mode. Are you sure it is moving BEFORE it turns on, or could it be turning off prematurely at the end of a normal move? Take a look at your G-code and maybe post a few lines that contain both G0 and G1(2 or 3).
motion start before the laser but it was my rookie way of connecting things without reading i think, just ordered the transistor required for the pwm may be that is my problem, my rig is a cnc sphinx with a xpro controller
still having the same isue with the nmosfet motion start before the laser turns on, gcode generated by sketchucam and laserweb (Generated by SketchUcam V1.4c-4ef2001) (Bit diameter: ~ 3.18mm) (Feed rate: 500.00mm/min) (Material Thickness: 0.20mm) (Material length: 300.00mm X width: 300.00mm) (Overhead Gantry: true) (Multipass enabled, Depth = 0.50mm) (Plunge Depth first) (Optimization is ON) (LASER for GRBL PWR) (www.PhlatBoyz.com) G90 G21 G49 G17 F500 M05 (Pass: 1) G00 X7.148 Y7.751 M04 S127 G01 Y8.055 F500 G01 X7.568 G01 X8.174 Y8.171 G01 X8.579 Y8.516 G01 X8.708 Y8.951 G01 X8.751 Y9.732 G01 Y16.924 G01 X8.694 Y17.773 G01 X8.521 Y18.231 G01 X8.122 Y18.502 G01 X7.568 Y18.592 G01 X7.148 G01 Y18.897 G01 X12.195 G01 Y18.592 G01 X11.440 Y18.555 G01 X10.950 Y18.428 G01 X10.461 Y17.992 G01 X10.329 Y16.735 G01 Y9.732 G01 X10.461 Y8.795 G01 X10.765 Y8.540 G01 X12.047 Y8.458 G01 X12.861 G01 X13.952 Y8.505 G01 X14.661 Y8.647 G01 X15.156 Y8.909 G01 X15.606 Y9.317 G01 X16.033 Y9.937 G01 X16.461 Y10.834 G01 X16.732 Y10.776 G01 X15.779 Y7.751 G01 X7.148 M05 (Pass: 1) G00 X22.674 Y16.595 M04 S127 G01 X20.735 Y12.091 F500 M05
what are you settings for $30 and $31 ? There may be a minimum PWM below which the laser does not power on. So, of $31=0 and $30=255 then maybe the laser only actually comes on at 25 thus in G4 mode the head is in motion while the PWM ramps up from 0 to your S setting but between 0 and 25 is is off anyway. In this case you need to set $31=25 so it always turns on from the minimum usable power. Remember M4 mode is ramping up the laser power during the acceleration phase of the motion so it will not be instantly on at the power set by the S word. You would need M3 mode for that. you can easily test this with Gcode like this G21 G90 G0 X0 M4 S0 F500 G1 X10 S5 G1 X20 S10 G1 X30 S15 G1 X40 S20 G1 X50 S25 G1 X60 S30 G1 X70 S35 G1 X80 S40 G1 X90 S45 G1 X100 S50 g0 X0 M5 M30 that will draw a 100mm long line of increasing laser power and you should be able to see where is comes on and relate that to the S setting. PS: turn off multipass mode unless you need it.
I solved this the hard way, if you notice the very first instruction of the code is to turn the laser off then move, so the module it self takes like half off a second to lit, so i took the code in word and replaced all M05 to M03 s10 that way the module is traveling on all the time at low power and leave the last m05 at the end.