Saturday, October 7, 2017

Electronics

I bought electronics for the conversion this summer. But of course other things got in the way. Assuming you have a little experience with Arduino and electronics this is more or less childs' play but even if you are a novice it is not all that hard to learn.

The first thing I had to decide on was how I wanted to talk to the CNC mill once it was built. There are two major ways that I know of. The first is LinuxCNC, which is comprehensive and has lots of features. Essentially it is a layer of software you install on top of your Linux OS. It is built to utilize high end controllers (like PCI/ISA cards, parallel port and ethernet interfaced industrial controllers, etc.) Having direct access to the hardware like this means they can do a lot of cool things, but the price barrier was higher than I liked. Cheap mill, cheap electronics! 

I decided to go with an Arduino based GRBL board. This board is an Arduino shield which interfaces four stepper motors along with end stop switches to the computer via USB. The firmware you compile and upload to the Arduino accepts gcode and then actuates the steppers per the gcode. The paradigm is exactly like that of a 3D printer. Definitely get one with the DRV8825 chip that is rated to a higher voltage/amperage.

For a power supply I picked this one which is variable 0-48v with a built in potentiometer. It also includes a second potentiometer and header so you can use an arbitrary length of wire to mount the pot wherever you like. The integrated display is a neat feature, it lags and is off by a few tenths of a volt but handy nonetheless. Nice thing about a variable supply is you can test at a lower voltage and then when you work with materials increase the voltage as high as you need. 

The steppers I picked up off of eBay are NEMA 23's with dual shaft. Do note that not all NEMA steppers are alike: be sure to look at the torque rating! 2.83 Nm (or in God's Units, 400 oz-in) is plenty but you will find many NEMA 23's rated at a fraction of that value. One of my requirements was to find a way to keep the handles on the mill for small manual jobs. Truth be told after some more thinking I really only needed one of these to be dual shaft (the Y axis) so you can potentially save a few bucks buying one dual shaft and two non-dual shaft. But trust me on the torque.

Eventually you will want end stops. These leaf switches are set up to trigger near end of travel and will cause the GRBL board to stop sending signals which would overdrive your machine. But for initial setup and testing, unnecessary. If you don't have them you will need connectors (0.1" header female) to connect the steppers to the board (I had spares aplenty from my 3d printer). And a computer of course. For testing your laptop is just fine. For the permanent install I will either use a Raspbery Pi with Octoprint (there is a GRBL plugin!) Octoprint is a 3D print server which allows you to upload your gcode over the network and it will stream the code to the device. 

So last night I wired up the stepper. Fortunately the auction had a schematic with wire colors but it isn't impossible to figure it out by trial and error. We are interested in "bipolar series" wiring since we have eight wires but only four connectors. On these steppers there are two pairs of two phases, and you wire them in series. 


Then you need to compile and upload grbl to the arduino. It is not as intimidating as it sounds, the step-by-step instructions are very clear. Once the firmware is uploaded put the shield on, connect power at 12v (lowest operating voltage) and connect the motor. Test wiring complete!

Now we need code to drive the steppers. The one I used is grblPanel. Grab the latest release and double-click the executable. Set the port to the COM port where your Arduino is and if all is well click (+X) and watch your stepper step! 

No comments:

Post a Comment

more successes

Next thing to do was cut something with multiple depths. Eventually I'd like to make some keychains for gifts and myself and family (wel...