I bought a SuperPID2 to control the spindle on my ShapeOko v1.
I’m using a Makita RT0700C which supports spindle speeds from 10,000 – 30,000 RPM. I want to use speeds under 10,000 and thought SuperPID would be a good option. I’ll describe the conversion in a later post.
SuperPID is a closed loop router speed controller which can be set the speed with a variable resister, 0V-5V variable control voltage, or PWM inputs. The supplied documentation describes generic PC control and integration to Mach3. As an added bonus it’s made in Australia.
I want to control SuperPID from grbl.
The latest build of grbl v0.9i supports configuration features which allow it to be configured to control SuperPID. The only downside is that you need to customize the build. This isn’t a big deal and I won’t describe to process of downloading the source, modifying code, compiling and uploading via the Arduino IDE. I will talk about the changes required to control SuperPID.
The first step is to supply power from the Arduino to SuperPID. SuperPID requires a regulated 5V power supply. Luckily Arduino has one of these. 5V on the Arduino is connected to 5V on SuperPID and GND on the Arduino is connected to GND on SuperPID. This will power up SuperPID when Arduino is powered up and also reset SuperPID when Arduino is reset.
The next step is to set the min and max RPM for your spindle. My spindle has a max RPM of 30,000. The min needs to be set to 0 RPM. SuperPID will read any speed below 5,000 RPM and set the spindle to 5,000 RPM. Setting the min to 0 RPM allows grbl and SuperPID to agree on the spindle speed.
1 2 |
#define SPINDLE_MAX_RPM 30000.0 // Max spindle RPM. This value is equal to 100% duty cycle on the PWM. #define SPINDLE_MIN_RPM 0.0 // Min spindle RPM. This value is equal to (1/256) duty cycle on the PWM. |
Pin 11 of the Arduino connects to the PWM input of SuperPID.
Finally, we also want grbl to control the start and stop of the spindle. The RUN input of SuperPID is logic low. 0V to stop the spindle and 5V to start the spindle. By default grbl uses PIN 13 to control the direction of the spindle. This pin can be configured to be a spindle enable output. Both of these can be configured in grbl v0.9i.
1 2 |
#define USE_SPINDLE_DIR_AS_ENABLE_PIN // Default disabled. Uncomment to enable. #define INVERT_SPINDLE_ENABLE_PIN // Default disabled. Uncomment to enable. |
Pin 13 of the Arduino connects to the RUN input of SuperPID.
Add these changes into config.h, compile and load. Now M3 will start the spindle. M5 will stop the spindle. S commands will set the spindle speed.
Time to test and have some super awesome fun!
Howdy! I’m in Texas. Rolled across your page *after* I read all the comments in the config.h concerning those two lines of code (especially the part about inverting the pins) and came to the same conclusions. Haven’t tested it yet, but I do have SuperPID running and it’s nice. So thanks! Sort of!
My experience was similar. Sometimes I still need to remind myself to just RTFM! I’m sure the SuperPID will work great for you.
I was really glad to see your post. I thought all those items you mentioned were what I wanted but it’s nice to see confirmation. Now here’s the rub for me. I set my max speed to 27,000. And my speeds work just great.
But M3 and M5 have Zero effect. I’ve confirmed my settings are right or at least match yours. . I’ve made sure my wiring is correct and that I get a tone when I do a continuity test from Pin13 to Run on the SPID. But the spindle just starts up and power on and runs continuously. I can change the speed. But not turn it off.
I even went back in and disabled the “invert” expecting that to at least turn it off, but it didn’t.
Any ideas on what to check next? Probably really stupid and everyone is going to immediately see the problem. But after 3 hours I’m at my end.
I’ve never seen this happen. And I’ve used Arduinos for years. But when I tested for continuity between pin 13 and the SuperPID I was actually testing from the shield. Turns out the Arduino Pin 13 was dead. Maybe a bad trace. Maybe bad solder. Who knows. Replaced with another Uno and away I went.
Robert,
Glad to hear that you solved the mystery. Sorry I didn’t see your original comment until just now.
Happy milling.
Darcy
I bought a SuperPID last year, but after a wiring issue with my limit switches, I put my CNC machine down for about 6 months. I picked it back up made the mistake of wiring up my PID at 4 in the morning….brain malfunction led me to connect my 24V line to the device (it should be 5V). It fried the logic chip but appeared to leave the stock components alone…been trying to contact SuperPID about buying just the chip to avoid the turnaround time on a full board but am not getting any responses.
I don’t feel so bad about having to buy another one; it’s just that I don’t want to wait 3-4 weeks on a replacement.
Keith,
Sorry to hear that. I think we’ve all done things like that when we haven’t been thinking at our best.
I hope you get a good response from SuperPID soon.
Darcy
Keith-
Hope you were able to get in touch with Val at SuperPID. I know they had some email/website issues a little while back, but they’ve otherwise been very responsive for me. I had a similar issue and ended up ordering a replacement. I haven’t taken them up on the offer yet (I intend to), but they will repair the board free of charge, (you pay cost of parts and shipping).
Yeah, I was able to arrange for a repair, the estimate of which is much cheaper than expected ($40 total), given there’s at least 3 ruined components on the board. I also bought a(nother) SuperPID as a backup, so I’m waiting on that to ship…should go out any day. It’s actually the third one I’ve ordered (my brother has my other one), but the wait always kills me.
“I won’t describe to process of downloading the source, modifying code, compiling and uploading via the Arduino IDE.”
Any chance you can point me to the source? I’ve spent hours trying to get this figured out and I think this is my last hurdle. I would appreciate it.
I have the Arduino IDE set up and connecting to my Shapeoko 3, I just can’t find the above files or the source.
Thanks,
Sam
Thank You for the insight into SuperPID and grbl updates. You lead me in the right direction for my Shapeoko 3 with grbl 1.1. Check it out here… https://github.com/Artistan/grbl/tree/shapeoko-spindle-control