Enclosure for CNC Machine Controller

Hey Everybody, Happy New Year!  One of the goals I had had for the break was to finally enclose all of the controllers and drivers for the CNC machine.  I also really wanted to automate the spindle.  I was able to take care of both of these goals in one long day in the garage on the break.

I started with automating the spindle.  When I first received the spindle I noticed that there was a small jumper wire on the power supply that is simply labeled on/off.  I was too interested in trying everything out to take the time to get it integrated with the GCODE.  At that point i didn’t even really know whether or not this idea would even work.  Now that I feel sufficiently comfortable with everything working I finally made time for the 30 minutes it took me to do it.  I started with confirming that opening the jumper wire would turn the motor off regardless of the speed governor.  It acted just as it was supposed to.

After this I added a relay module and connected it to the MKS 1.4 controller board.  I controlled it in the same way that I’m controlling the lights and the fans in the laser controller.  I am toggling the pin from the GCODE via the M42 command and am using pin 49.  I still think its weird and worth noting that the S reference is still 0-255 not false/true, 0/1.  So M42 P49 S255 turns the spinde on and M42 P49 S0 turns the spindle off.  I just find it strange given that digital pin 49 is not a PWM pin on the Arduino Mega which is what the MKS 1.4 is built off of.  The relay module is able to be set up for either normal open and normal close; I set it up such that the pin has to be actively engaged for the spindle to be on.  This makes for a little bit safer of a set up.  I tested this out by manually entering the commands into the Terminal of my OctoPrint server that is controlling the CNC machine.  After this confirmation I easily added these two commands to the beginning script and the ending script within Simplify3D, which is what I’m using to create the GCODE for my CNC engravings.

After this was taken care of and tested, I built a simple box to put all of the controller boards in.  There’s a surprising number of boards for the CNC machine.  I didn’t spend too much time on dimensions.  I just used the available space I had left on my board.  I had a thin piece of plywood laying around that I used to build the box out of.  It happened to be a piece that I used to experiment with when I was first testing the 5.5 W laser cutting through things.  For reasons I never fully figured out I never got it to cut all the way through this plywood but it left me a pretty cool and pretty large Batman symbol that I left visible on the box for fun.

Another thing I thought to do was make an emergency switch for the two power supplies/rectifiers.  This way if there is ever a problem I can flip the switch and have everything stop safely and easily.  I did this a little different than typical though.  I paralleled the AC wiring for the power supplies but I also paralleled another line that bypasses the switch and continues on for an outlet that powers the raspberry pi that hosts the OctoPrint server.  I didn’t like the idea of just pulling the plug on the raspberry pi for fear of corrupting the SD card.  I did all of the paralleling inside the box for the closest to code compliant that I was willing to do.  Here’s a picture of the switch and a panoramic picture of all of the boards that are now inside the enclosure and finally not susceptible to dust contamination.

Hope you like it.  Let me know if you have any comments or suggestions.

Leave a Reply