For those of you who are following this series, this article goes through the electrical system design for the mill conversion. If you missed the first part, which covers the mechanical conversion, you can find that here.
So at this point, we have a machine that could go back and forth, side to side, and up and down automatically, if only we had something to tell the motors what to do. For those unfamiliar, the 3 axes we are talking about are usually as shown in the following image:
For 3 axes of motion, we need 3 motors, and 3 motor drivers. Enter the Geckodrive G540 stepper motor driver. Geckodrive make various motor controls, and the G540 is a particularly nice little unit as it is very compact but still has some powerful capability. It is actually 4 G250 drivers in 1 package, which simplifies wiring by requiring only 1 power feed for all 3 motors. I’m not using the 4th output at this stage, but if I installed a 4th rotary axis for indexing, then it could be used for that. I had used a G540 a few years before, in a 3-axis router conversion that I did, and so decided to select one for the mill conversion as it was familiar and easy to use. Here’s a really bad photo of it:
So what does this gadget do exactly, you ask? Basically, it takes information from the machine controller (in this case a PC running LinuxCNC) in the form of step and direction signals, and uses that information to determine the magnitude and direction of current flow that it should provide to the motor windings to get them to move in the correct way. On the front panel, you can see 4 smaller connectors, and one large one. The large on is used to connect the unit to the PC, and the 4 smaller ones are connected to up to 4 stepper motors. On the back of the unit, there are various connectors for power, and input signals from things like limit switches which are used for homing the machine for a consistent 0,0,0 position.
The G540 needs a power supply which is capable of running all 3 or 4 motors. For converting AC-DC, switch mode digital conversion is a lot more efficient than the old coil type transformers. This type of technology has come down in price a huge amount over recent times, and so selecting a suitable supply was a pretty easy task. I found an Australian supplier who sells a lot of DIY CNC components and he had some reasonable pricing on Meanwell power supplies. I went with the 7.3A 48V DC unit here. I also got a few other miscellaneous items like a power socket with integrated fuse holder, and some switches.
Now that I had all the bits, it was time to work out how to package them up. Of course, I went straight to my indispensable 3D Digital Prototyping Swiss-Army Knife…… Autodesk Inventor. I started by placing models of the electronic components in 3D space, roughly where I wanted, then designing a sheetmetal enclosure to suit. I used Inventor’s wiring tools to create a simple loom and work out where I wanted to run the wiring. Trev from Hitech Sheetmetals then got to work, and produced a beautiful enclosure that exactly matched my digital model. A quick test fit of the components was followed by a spray of some wrinkle-finish paint, and the enclosure was ready to be fitted up. You can see the process in pictures in the slideshow below.
With the electronics system now finished, I performed some testing to make sure that I hadn’t made any mistakes with the connections, and then took it out to the garage to connect it to the rest of the system.
An old PC I had lying around was to take the roll of the Machine Controller. For newbies to CNC, the controller is what takes the G-Code produce by your CAM software and turns it into step and direction signals to turn the motors that drive the machine. They usually also have feedback displays so you can see what the machine is doing, and where it is in the program. For any “real” CNC machinists reading this article, the PC takes the place of your Fanuc or Heidenhain, or whatever other controller you may have hanging off the side of your machine. A commercial machine controller like that can be worth tens of thousands of dollars, a budget that I simply did not have. Luckily, through clever open source development, a very functional and sophisticated software controller can be had for a much nicer price of FREE. LinuxCNC was my weapon of choice. I weighed it up against Mach3, it’s direct competitor, and decided to give the open source option a go, before trying the commercial Mach3 product.
Having used LinuxCNC in the past, the configuration and calibration was relatively quick and painless. Within an hour or so, the motors were happily singing away. I moved on to started cutting some air in the shape of the LinuxCNC logo, which is the default G-Code program that it comes with, for testing.
After spending quite a bit of time tuning and calibrating the various aspects of the system, I started machining a few test components. I quickly discovered that with longer programs, sometimes the accuracy would not be very good, and the symptoms of “missed steps” were starting to show. Missed steps can be caused by latency in the software step generator. Interruptions to the timing inside the computer means that sometimes the stepper driver might not receive all of the step information that it was supposed to. This leads to the machine ending up in a slightly different place to where the computer thinks it is. I was getting some latency errors in LinuxCNC and after a lot of messing around, decided that the PC was just not up to software step generation.
After a lot of googling, and a lot of reading, I decided that a hardware step generator would solve my issues. I found a company called MESA in California, and ordered one of their MESA 6i25 motion control cards. After a week of bashing my head against the wall trying to configure it, I received an answer from their tech support department asking me to check the positions of the jumpers on the card. Sure enough, one was in the wrong position, and I promptly fixed that. As soon as I ran the machine, I could see that the performance had improved dramatically. The machine can now run reliably at least 3 times faster than it did with software step generation. It sounds smoother, and the accuracy is a lot better too.
With the mill now running really nicely, I set to work cutting some 3D surfaces to not only test the capability of the machine, but also to try out the new Autodesk InventorHSM CAM software that had recently become available to me. I will cover this in a lot more detail in a future post, but as a teaser, here is a picture of the first 3D surface that I milled with a 5mm diameter ballnose cutter:
In the next post, I’ll talk more about the CAM software for creating the G-Code, and also the LinuxCNC software which is used to control the machine.