I am wanting to make my 3D printer a multi use machine but I’m not sure if it will do a function that I want. I am wanting to drill holes in a PCB using the CNC capabilities of the 3D printer but I am wanting to have the G-Code turn the spindle on and off. I am running Marlin on an Arduino Mega 2560 and I’m not sure if Marlin is set up to do that and also where would I hook the spindle motor to? It’s going to be a brush-less RC car motor with an electronic speed control so it can be controlled like a servo. Any help would be greatly appreciated.
this might be helpful https://www.youtube.com/watch?v=Dh5mDaw0ayk
Marlin also has a specific gcode to set a PWM pin, so if your speed controller accepts PWM, you can just jack into a currently unused pin.
I don’t think most printers would do a good job of this. They are designed to have very little force on the carriage. My Prusa i3 would probably wander a bit when it started drilling as the belts stretch.