GRBL Spindle Speed Issue

Discussion about the arduino based g-code interpreter, grbl
BArnold
Posts: 72
Joined: Tue Feb 17, 2015 9:28 pm
Location: Thomasville, GA

GRBL Spindle Speed Issue

Post by BArnold » Thu Apr 30, 2015 2:07 pm

I've been testing variable spindle speed via grbl and have questions.

Currently, I have the following definitions set:
#define SPINDLE_MAX_RPM 12000.0 // Max spindle RPM. This value is equal to 100% duty cycle on the PWM.
#define SPINDLE_MIN_RPM 4000.0 // Min spindle RPM. This value is equal to (1/256) duty cycle on the PWM.
#define MINIMUM_SPINDLE_PWM 5 // Default disabled. Uncomment to enable.

When I send an M3 command, the spindle comes on at the lowest speed. Sending an Snnnn will ramp up the speed to whatever I set until it reaches the upper end. With the settings above, I can increase the spindle speed to 9750rpm but the spindle turns off if I send S9800.

What am I missing?

In another thread, there was mention of having the ESC "learn" the speed range of a spindle. How is that done?

Thanks!
ShapeOko2 with Custom 660mm Y-axis, 1500mm X-axis, ArduinoUno/gShield/grbl 0.9j
Two NEMA 23 on X-axis, one NEMA 23 on Y-axis, NEMA 23/belt drive on Z-axis
DeWalt DWP611 Router
VCarve Desktop, UGS, SketchUp, PhotoVCarve

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: GRBL Spindle Speed Issue

Post by cvoinescu » Thu Apr 30, 2015 2:22 pm

What speed controller are you using? The one from Inventables works with PWM between 0% and about 75%. Anything over 75% turns the spindle off.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

BArnold
Posts: 72
Joined: Tue Feb 17, 2015 9:28 pm
Location: Thomasville, GA

Re: GRBL Spindle Speed Issue

Post by BArnold » Thu Apr 30, 2015 3:10 pm

Yes, it's the speed controller from Inventables. Is there a way to make it work?
ShapeOko2 with Custom 660mm Y-axis, 1500mm X-axis, ArduinoUno/gShield/grbl 0.9j
Two NEMA 23 on X-axis, one NEMA 23 on Y-axis, NEMA 23/belt drive on Z-axis
DeWalt DWP611 Router
VCarve Desktop, UGS, SketchUp, PhotoVCarve

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: GRBL Spindle Speed Issue

Post by cvoinescu » Thu Apr 30, 2015 5:00 pm

I think these settings should work:
#define SPINDLE_MAX_RPM 16000.0
#define SPINDLE_MIN_RPM 0.0
#define MINIMUM_SPINDLE_PWM 64

You will be able to set the speed from 4000 to 12000. If you set it above 12000, it won't work (the spindle will stop, so don't do that); if you set it below 4000, it will go at 4000 instead.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

BArnold
Posts: 72
Joined: Tue Feb 17, 2015 9:28 pm
Location: Thomasville, GA

Re: GRBL Spindle Speed Issue

Post by BArnold » Thu Apr 30, 2015 5:31 pm

Thanks, cvoinescu.

I tried the settings you gave me. The spindle stayed on up to a command of S11000, then shut off. I raised SPINDLE_MAX_RPM to 20000.0 and it didn't shut off until a command above S14000.
ShapeOko2 with Custom 660mm Y-axis, 1500mm X-axis, ArduinoUno/gShield/grbl 0.9j
Two NEMA 23 on X-axis, one NEMA 23 on Y-axis, NEMA 23/belt drive on Z-axis
DeWalt DWP611 Router
VCarve Desktop, UGS, SketchUp, PhotoVCarve

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: GRBL Spindle Speed Issue

Post by cvoinescu » Thu Apr 30, 2015 6:32 pm

I suspect the cut-off differs from unit to unit. Yours seems around 70%, for other people it was between 75% and 80%.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

Bjrn561
Posts: 8
Joined: Thu Apr 30, 2015 6:28 pm

Re: GRBL Spindle Speed Issue

Post by Bjrn561 » Thu Apr 30, 2015 6:58 pm

Have a look on the inventables website for the speed controller (https://www.inventables.com/technologie ... controller).
In the questions section they figure out to use a MAX_RPM value of 18000.

The controller needs 2/3 of the pulsewidth for full speed. So typing S12000 is 2/3 of 18000 and should work.

BArnold
Posts: 72
Joined: Tue Feb 17, 2015 9:28 pm
Location: Thomasville, GA

Re: GRBL Spindle Speed Issue

Post by BArnold » Thu Apr 30, 2015 8:27 pm

I changed SPINDLE_MAX_RPM to 18000.0 per the information posted by Bjrn561. My spindle works up to S12500, then cuts off; there's no difference in speed between S12000 and S12500. Anything below S4000, the speed stays the same. I don't have a tach to check the speeds, but it's obvious there's a change through the normal range now.

Thanks, guys!
ShapeOko2 with Custom 660mm Y-axis, 1500mm X-axis, ArduinoUno/gShield/grbl 0.9j
Two NEMA 23 on X-axis, one NEMA 23 on Y-axis, NEMA 23/belt drive on Z-axis
DeWalt DWP611 Router
VCarve Desktop, UGS, SketchUp, PhotoVCarve

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: GRBL Spindle Speed Issue

Post by cvoinescu » Thu Apr 30, 2015 9:59 pm

If you want it to go below 4000, simply reduce (or comment out) MINIMUM_SPINDLE_PWM.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

Bjrn561
Posts: 8
Joined: Thu Apr 30, 2015 6:28 pm

Re: GRBL Spindle Speed Issue

Post by Bjrn561 » Fri May 01, 2015 9:23 pm

I think you might do some finetuning. If S12500 works and this should be 12000. And hopefully the inventables blog is right (max=2/3 pulsewidth) then try a MAX_RPM of 18750. Then you might get a maximum of 12000RPM with S12000.

Then you do exacly the same with the minimum settings. Try it out!

I'm not sure if this really is important. I don't think these spindles have exactly 3000RPM as minimum and 12000RPM as maximum value. Perhaps it is better to measure out the pulsewidth and look if the spindle reacts.

If you want to know the speed of the spindle exactly, you need to measure the RPMs.

Post Reply