Way back in January 2010, I ordered a book – Build Your Own CNC Machine – that began my journey in learning how to build a CNC router. This journey led me to build not one, but two CNC machines.
I read the book eagerly. While not exactly a step-by-step guide, it describes their design in great detail and even provides links to download a set of plans and BOM. Their goal was to develop a CNC router whose construction was within the reach of a typical woodworker and that mainly used materials available at the local hardware store/lumberyard. The construction is mainly 3/4″ MDF – a material that is very easily cut and milled, but not easily joined. They recommend using cross dowels for the construction. For the rails and bearings they use commonly available aluminum extrusions and essentially roller-blade bearings. The X, Y and Z axes are moved via home-built lead screws made with 1/2″ square nuts on 13 tpi threaded rod (normally used for hanging electrical fixtures) connected to stepper motors. The CNC “spindle” is a hand-held router (I used a Bosch Colt). The book also goes into detail about how to wire the steppers to the stepper drivers and to the parallel port breakout to attach to your PC. Finally, they cover the configuration and usage of Mach3 to control the CNC machine.
I’m not sure exactly when I began work on the machine. Many life events – both good and bad – intervened that slowed my progress. It sat ignored, collecting dust, in my workshop for at least one year after I started construction. Eventually, though, I picked up where I had left off and had the mechanical bits done by March 2014 (as well as a custom plywood stand for it):
During the build, I had to decide on what steppers and electronics to use. For the steppers and stepper drivers, I went with the setup recommended by the book: three Nema 23 425oz-in 2.8A steppers, three KL-4030 40VDC/3A stepper drivers, and a 36V switching power supply – all sold by Automation Technologies. I was leery of using a standard PC to drive it – especially one running Windows. I had already decided on using of version of LinuxCNC for control software. I wasn’t thrilled about using an archaic parallel port and breakout board to connect the computer to the stepper drivers. I also didn’t have a fan-less desktop PC (just try to find a laptop with a parallel port). LinuxCNC uses a real-time kernel and requires a parallel port to allow precise timing of the step/direction control signals to the steppers.
As I looked for alternatives, I discovered someone had ported LinuxCNC to a BeagleBone Black. I bumped into this link that described his approach. This port was called MachineKit and the beauty of it is that it uses the PRUs on the BBB ARM chip to generate the timing pulses and the big core on the ARM to run Linux and a GUI. Essentially all of the timing-critical operations are offloaded to an on-chip microcontroller.
So I bought a BeagleBone Black and loaded MachineKit to it’s SD card. Now I had to connect the BBB to the stepper drivers. Several people had designed BB “capes” to connect to 3D printers but there were two problems with this: First, most of the capes usually had on-board stepper drivers that didn’t have the power to drive 2.8A steppers. Second, these capes were really hard to get. I decided to build my own custom cape using a BB Proto Cape from Adafruit along with a plastic case. Since I didn’t want to invest in the time developing my own MachineKit configuration for my custom board, I remained pin compatible with an existing cape that MachineKit already supported: the BeBoPr-Bridge which is basically a bridge for a BeBoPr cape that allows use of the on-board video (the BeBoPr was originally designed for a non-Black BB). On this board I needed to provide the following outputs:
- X Step
- X Direction
- Y Step
- Y Direction
- Z Step
- Z Direction
- Enable for all axes
The stepper drivers I was using required 5V open-collector inputs to drive internal opto-isolators:
I also wanted the following inputs:
- X Max limit switch
- X Min limit switch
- Y Max limit switch
- Y Min limit switch
- Z Max limit switch
- Z Min limit switch
One of the challenges is the that BBB outputs are 3.3V and have rather anemic drive strengths. I used an octal transceiver to convert the 3.3V BBB outputs to 5V signals for the stepper drivers. Note that since I was using a single octal part I couldn’t have separate enables for each stepper – it was going to be all or nothing. I used a simple transistor circuit to implement the pull-down with sufficient drive strength required for the stepper enables.
For the inputs, I added pull-ups to 3.3V and would wire the limit switches to conditionally ground the inputs. The final cape was messy but functional:
While the configuration of ports for my Cape was essentially the same as the BeBoPr-Br, the configuration of the PRU and kinematics (pulse timing, inches/step, max velocity, max acceleration, limits) needed to be completely reworked. When I first connected a stepper and driver to the BBB and cape on my workbench, I was able to control the stepper – sort of. I could get the stepper to move slowly, but when I tried to run it faster it just made a high pitched whining noise and sat there. It took a bit of tweaking to the pulse timing and acceleration to get it to move. Apparently the stepper I chose is fairly different from the Nema 17 steppers usually used for 3D printers. It has a lot more mass and needs to accelerate more slowly. After I finally got reliable control of the steppers, I began the process of attaching the steppers and electronics to the CNC machine.
I now turned to the mechanical connection of the stepper to the lead screws. The book was of limited help, only suggesting the use of couplers. The problem was that, as far as I could tell, no-one made a coupler that connected a 1/4″ flat shaft to a 1/2″ 13 tpi threaded rod. I went through several iterations finally settling on a 1/4″ to 12mm coupler that I tapped to receive the threaded rod. Even with this, I went through more iterations before I realized I needed to use non-flexible couplers to prevent the coupler from distorting – or being pulled apart – under load. This should have been my first hint that the design of this CNC machine was sub-optimal. The design really needed “thrust” bearings that prevented any axial strain or stress on the couplers.
I made my own stepper cables by twisting together four separate pieces of 18 gauge stranded wire. I loosely ran these cables along the machine and connected them to my stepper drivers. The stepper drivers I connected to the Proto Cape. It looked pretty close to this:
Finally, I attached a wireless keyboard and small flat panel display to the BBB.
I was now ready to try my CNC router out. I quickly discovered that the maximum velocity and acceleration values were still too high once I connected the steppers to the lead screws. There was a lot of additional mass to accelerate with this design. Eventually I was ready for my first “hello world” test:
The test was only moderately successful. My velocity settings were still too aggressive – it was dropping steps occasionally. This was a problem that would continue to plague this machine. There was also quite a bit of flex in the machine. This revealed a second shortcoming of the design: there was no easy way to adjust the tightness of the bearings. Either the MDF pieces were cut to the right length or they weren’t. I tried adding shims to a loose set of bearings but it was only partially successful. I also convinced myself that the 36V supply I was using wasn’t driving the stepper motors hard enough. I then took a month-long detour to design and build a 80V toriodal (non-switching, non-regulated) power supply. The only outcome of this detour was to blow up my KL-4030 drivers immediately prior to realizing they were not 80V tolerant. I bought more expensive drivers to replace them, but ultimately the increased voltage didn’t help.
I set aside trying to improve the machine for now. It was time to actually build something. I’m an avid board gamer and that includes “dexterity” games. One of my favorite dexterity games is Crokinole which partly consists of a large wooden disk with a circular ring of pegs near the middle. I had solid cherry stock laying around from a previous woodworking project and wanted to build a Crokinole board out of it. My design called for milling 16 sectors of cherry to be glued together to form a 26″ circular board. Interestingly, the CNC machine wasn’t big enough to mill the outside edges of the board once it was glued together – it had less than 24″ of travel in the Y-axis. But it could easily fit the 13″ long sectors. I created the design using a combination of Inkscape and HeeksCAM. I began the process of making 16 of these sectors:
I made several attempts and all were disappointing. It was obvious that the CNC router was still dropping steps – even after slowing the speed down to 10″/minute and only cutting 1/10″ per pass. In addition, the X-axis coupling came loose in the middle of one run with disastrous results. The net result of these attempts was that I destroyed several board-feet of really nice cherry.
I now became convinced that this CNC design was beyond salvage. Fortunately I had already been thinking about what “Mark 2” of my CNC machine would look like. This iteration (now the “Mark 1”), had only one more job to do: help build the Mark 2.
To be continued.