Gcode for 3018

I have upgraded my original 3018 motor to a 20,000 rpm which work fine but i cant turn on full power inone go i have to gradually increase the spindle speed from 1000 to 2000, 3000, 4000, 5000 etc
with a 0.5 sec dwell time in between each increase, but i cant get the gcode to work it just goes to the final speed without ramping uo and pausing in between, i can do this manually with s1000, s2000 etc, but i am trying to edit the gcode i have 2 versions and neither seem to work, it does pause but the motor does not turn on until it reaches the final speed 5000rpm.
I would appreciate any help, i am assuming its GRBL

Manufactures suggestion

M03 S1000
G4 P0.5
M03 S2000
G4 P0.5
M03 S3000
G4 P0.5
M03 S4000
G4 P0.5
M03 S5000

another version i have tried is
S1000M3
G4 P0.5
S2000M3
G4 P0.5
S3000M3
G4 P0.5
S4000M3
G4 P0.5
S5000M3

but it just starts at 5000rpm and the cnc dies and i have to reboot it becuase it cant handle 5000rpm at startup, i need to run at 1000rpm then wait 0.5 sec then 2000 rpm etc,
Using a Mysweety 3018 CNC Pro i think with Marlin and GRBL, again would like to confirm this too.

Thanks for any help guys

Well according to this, G4 is not supported by GRBL, so any line with it would be ignored I think.

Grbl v1.1 Commands · gnea/grbl Wiki · GitHub

Did you mean this:

Spindle State M3, M4, M5

This discusses it:

G-Code Cheat Sheet + MDI: Your CNC Secret Weapon (cnccookbook.com)

I don’t use a spindle so I’m not experienced but it sounds like the M codes start it and the S code is the rate of rpms and the P is the time period I think.

Sure it is. It’s a pause it dwell command.

@PaulMcgiven Those examples you have should both work. Can you post your grbl settings?

Right again…Neil…I read it backwards…:slight_smile:
Supported Non-Modal Commands
G4, G10 L2, G10 L20, G28, G30, G28.1, G30.1, G53, G92, G92.1

$0 = 10 (Step pulse time, microseconds)
$1 = 25 (Step idle delay, milliseconds)
$2 = 0 (Step pulse invert, mask)
$3 = 5 (Step direction invert, mask)
$4 = 0 (Invert step enable pin, boolean)
$5 = 0 (Invert limit pins, boolean)
$6 = 0 (Invert probe pin, boolean)
$10 = 115 (Status report options, mask)
$11 = 0.010 (Junction deviation, millimeters)
$12 = 0.002 (Arc tolerance, millimeters)
$13 = 0 (Report in inches, boolean)
$20 = 0 (Soft limits enable, boolean)
$21 = 1 (Hard limits enable, boolean)
$22 = 0 (Homing cycle enable, boolean)
$23 = 0 (Homing direction invert, mask)
$24 = 25.000 (Homing locate feed rate, mm/min)
$25 = 500.000 (Homing search seek rate, mm/min)
$26 = 250 (Homing switch debounce delay, milliseconds)
$27 = 5.000 (Homing switch pull-off distance, millimeters)
$30 = 10000 (Maximum spindle speed, RPM)
$31 = 0 (Minimum spindle speed, RPM)
$32 = 1 (Laser-mode enable, boolean)
$100 = 1600.000 (X-axis travel resolution, step/mm)
$101 = 1600.000 (Y-axis travel resolution, step/mm)
$102 = 1600.000 (Z-axis travel resolution, step/mm)
$110 = 1000.000 (X-axis maximum rate, mm/min)
$111 = 1000.000 (Y-axis maximum rate, mm/min)
$112 = 800.000 (Z-axis maximum rate, mm/min)
$120 = 250.000 (X-axis acceleration, mm/sec^2)
$121 = 250.000 (Y-axis acceleration, mm/sec^2)
$122 = 30.000 (Z-axis acceleration, mm/sec^2)
$130 = 300.000 (X-axis maximum travel, millimeters)
$131 = 180.000 (Y-axis maximum travel, millimeters)
$132 = 5.000 (Z-axis maximum travel, millimeters)

Is laser mode ($32) on intentionally?

Yes it is i sometimes swap the spindle for my laser

Do you leave ladder mode enabled when running your spindle?
Can you send $I and paste the response?

$1 = 25 (Step idle delay, milliseconds)

Fixed it, changed $1 to 1000, did not work, changed it back to $1=25, now working , go figure ?