Modeling a Starter CNC machine via parametrics with OpenSCAD.
Designing a do-it-yourself (DIY) CNC machine is an interesting challenge, solved by navigating the thicket of desires, needs, abilities, and, of course, budget to arrive with a machine that presents the best mix of all of the above. By modeling the parameters, you can explore the space of possible configurations that might best match a reasonable course of action.
Generally speaking with machining, the best machine is always the next size larger than what you have. By definition then, the best machine is always slightly out of reach. I cannot hope to solve that problem. However, I expect to create one that will be a sufficiently good test bed to create some good work and gain some experience. This post is about designing an effective machine, not the best machine.
A few years ago, I became interested in robotics, automation, and the practical implementation of intelligence in real-world objects. Having a software background (hedge funds) but lacking experience with the creation of real objects, I had little idea how machines were put together, the forces involved in movement, and how to actually make real things.
So, in the last few years I have learned to machine manually, taking a number of excellent classes on machining and CNC at the local community college. And, I bought and rebuilt an old South Bend lathe from the ground up. My current equipment is fine as far as it goes, but I find that I am still astonished at how long it takes to make a prototype.
Finally, I concluded that it is past time to move to the next step and start using CNC equipment.
The Modeling Process
Using OpenSCAD, one can create each part that would be used. By using a combination of parameters and fairly standardized parts a machine can built in the abstract. By adjusting the thicknesses of the parts, intuitions can be made on the rigidities of the parts given the lengths and materials that selected. For example, a relatively weak but large frame could be built for use with wood, or, a smaller but more effective frame could be built with the same thickness of metal.
By using parameters with modules, a fierce consistency is enforced. If one part becomes large, then all the holes, locations of parts attached to it must be adjusted. If your model lacks consistency, mismatches become quickly apparent. Like all computer applications, it still requires a critical eye when examining the results of your efforts, but it handles about 90% of the issues effortlessly.
Define Commonalities Between Adjacent Parts
Is the thickness of the part consistent with the related parts. Can the dimensions scale automatically with the other parts? Should the holes for screws match up? In any of these cases, it makes sense to determine what dimensions are critical to the success of your machine, define those variables first, then apply those values to the common parts.
Lumpiness in the Sizing of Parts
Are there breaks in scaling as you increase dimensions up or down? For example, if you are purchasing parts, the size of the part would not scale linearly with the other dimensions. Rather, the purchased part might be available in discrete sizes.
With larger dimensions there might also be larger bolts and corresponding hole sizes. There are standards for screws, threads, tapping holes and clearance holes. Scaling might then involve selecting the right bolts for the job.
Are there standards of dimensions that are necessary so that other components will work with your machine. To use a specific example, the size of the slots on the CNC table might correspond to the slots on a Bridgeport milling machine. When purchasing equipment to use on the table meeting such a standard suggests scavenging tooling from Craigslist might be easier.
If a design assumption fails, is there a fallback position that might be more effective? For example, in the context of a CNC machine, suppose that a part is not sufficiently rigid, can an additional layer be attached to it to stiffen it futher? If holes are drilled off center, can an adjustment be made to rectify the problem. By planning ahead for possible failure, your design can adjust as new information becomes available.
Challenges and Constraints
The CNC equipment will be built with my existing equipment where possible with a do-it-yourself approach.
- Create the necessary items with my current equipment
- Avoid lengthy machining
- Have a reasonable basis to believe that the machine will be able to machine light steel (with small depth of cut), as well as aluminum and plastic.
- Be able to adjust the positioning of components to ensure linearity.
- Be able to replace and/or upgrade components easily
- Be upgradeable to 5 axis machining later on
In order for this CNC machine project to be success, there are several critical elements. Those elements are:
- Enforce linearity of movement
- Adjustment of the linear dimensions
- Selecting an appropriate spindle
- Being able to use standard tools with the machine that is created
The current configuration uses a two layer approach for XY positioning with the X on the bottom and Y on the top. Movement in either the X or Y directions stems from sliding on linear rails. There are trade-offs between the distance of travel, the accuracy of the movement, and the locations on a table that the spindle can actually touch.
Because the X dimension (side-to-side motion) is planned to be longer than the Y dimension (forwards/backwards), the X frame is put on the bottom. Then, the Y frame is placed on the rails for the X dimension and moved about. Generally speaking, the attempt was made to make the platform about one-third of the distance that could be traveled for each dimension. That would permit maximum coverage of the table by the spindle.
The Z axis design places the spindle over the central location of movement for both the X and Y frames. As the Y dimension increases, the Z axis must extend further out over the table. There is clearly a trade-off between the stability of the spindle projected over the table and the size of the Y workarea.
The machine must move exactly where the computer tells it to. Now exact is a fairly loaded term, since much like in programming, there can be a world of difference between an integer 2 and a float 2.0.
To that end, the machine is designed to move in 3 dimensions along each axes. So, for each dimensions, the equipment must be constrained to move along only that selected dimension with little (none in a perfect world) in the other two dimensions.
My design uses the same size components for all axes to standardize on any jigs and raw material dimensioning.
For each dimension, a platform will be attached to linear rails. Because my intention is to make as much of the machine as possible, I selected the following approach. Use turned, ground, and polished steel rounds on which a bearing is attached to a platform. The linear rails are secured at each end to a frame.
The picture below illustrates the basic idea without the hindrance of seeing the frame. If the linear rail was simply anchored at the end points the rail could deflect when weight or force is applied. And, the point of the machine is to put some force on it and do something useful. To counteract that deflection, a series of supporting rods are threaded into holes along the bottom. By shortening drastically the unsupported distance, deflection downwards is pretty much eliminated, and sideways forces are at least attenuated. The supports would be first threaded up through the supporting surface below and a tigtening nut, and finally, into the rail. Then, when the height of the linear rail is found to be correct, the tigtening nut is screwed down against the supporting beam.
And, this may be too much detail, but there is a transverse hole through the supporting rod for a screwdriver so that when the nut is tightened, the screwdriver would prevent the support from further turning.
In this scenario, the platform has bearings that grip the rail for most of the circumference, with the remaining portion exposed for the supporting rods. This design uses an acetyl bearing whose adjustment can be made by a couple of set screws on the side. While many CNC router designs use roller bearings, this design does not. The typical machining speed for metal is relatively slow compared to wood or plastic, and with a polished surface, the assumption is that it will not wear all that fast. And, as it does wear, the set screws can adjust it back to tightness. A fallback position would entail simply buying some roller bearings.
Linear motion for each axis is provided by a motor turning a leadscrew, which has a nut threaded onto it. As the leadscrew turns, the nut is moved in either direction, forcing the platform to move with it.
The best approach utilizes a ballscrew with ballnuts. Ballnuts have recirculating ballbearings and have close to zero backlash. However, they are fairly expensive, and I would not attempt to make them on my own without more equipment. Manual machines use Acme leadscrews which have strong, squared off threads, enabling movement even when there is much resistance from cutting forces. However, there is a backlash problem.
There is a middle ground technique, which has surfaced that utilizes a technique where a split acetyl nut is pressed on a heated leadscrew. The heat of the leadscrew causes the acetyl to melt sufficiently to mold itself to the shape of the leadscrew threads.
Then, the acetyl nut is machined into shape, put into a nutholder and has somewhere near zero backlash.
Below is a picture showing the acetyl nut in its holder.
In this picture, the holder is transparent to show more detail. The Acme leadscrew is threaded, but not shown in the picture. The cap on the bottom secures the nut within the holder.
At the top is a pin that connects the platform. And so, the leadscrew turns, forcing the nut to turn, which impels the platform via the pin. And, the direction of travel is enforced by the linear rails.
The drivetrain originates, of course, from the motor. In the image below, the motor is at the far right, where it is anchored to the motor mount. The shaft of the motor is connected to the acme screw via an Oldham coupler. Just on the other side of the coupler is a threaded collar.
The collar works in concert with the bearing which you can see on the other side of the frame. The bearing abuts a shoulder on the acme screw, limiting the movement on the inside. The threading allows the collar to screw onto the leadscrew and therefor shrinks the distance between bearing and collar. When the collar is tightened to the point of no axial movement of the leadscrew is possible, yet the shaft can turn, then the collar is tightened with the compression screw.
The combination of the thickness of the frame, the size and placement of the linear rails and support beams combine to determine how rigid the machine will be under power. I have not yet finalized the thicknesses that I will use.
Below is a picture showing the frame with the linear rails, drive assembly and platform in place.
The table typically is made from cast iron from one piece. Then, because cutting can warp the shape and relieve strain, it might be set aside for a few months and finally ground into shape. I am not going to do that.
Nor am I going to try to cut the slots from a single piece, because with a 3 inch milling vise on a lathe, that is impossible. I also considered cutting it on the machine that I create, which certainly be a possibility. However, that does not avoid the strain relief issues.
I am going to try a method of building up the slots by using two levels of essentially metal planks. The spacing used will mimic Bridgeport slots dimensions to accommodate other tooling that I might get.
Below is a picture of the table in the context of a typical frame.
For the spindle, I am going to initially use a Bosch router at a slow speed. I am uncertain as to the effectiveness of this choice, but I want to think through some of the issues involved before I make a different choice.
The router will be held by two plates that can pinch via a screw on the flange in the front. There is a cut that is bridged by a screw. When that gap is slightly closed, then the spindle will be secured.
On the right, connection between the splindle plates and the Z axis platform is essentially a metal box. Later on, it would make sense to add an ability to rotate that under power, yielding another controllable axis. I am not addressing it at this point, believing there is a sufficient number of unknowns to work with first.
However, it is not much trouble to make the backplate for the connector be a disk that can rotate. There would be four locking tabs that would secure the spindle in whatever rotation is needed.
Adjustment of Linear Dimensions
While it will be much easier to talk about adjustments during the building phase, briefly, in creating something like this, there has to be a great appreciation for what can go wrong. For example, if I drill a hole in a particular location, it will not be exactly at the intended location by some small amount. As the small errors accumulate, the overall positioning becomes worse and worse.
So, what to do.
Basically, you can use a dial indicator that can show slight changes in position. Using the dial from a starting point reference point, you try to insist that all surfaces are either parallel or perpendicular to it. So, for example, suppose I start with one side of the frame on the base. From there, I try to adjust the linear rails and leadscrew so that there is little discernible difference between them. At each end of the linear rails, there are bearings that screw into the frame, holding the linear rail. if the holes for those bearings are slightly oversize, the position of linear rail can be moved just enough to bring it in line. And, the same with the lead screw.
Now, some decisions need to be made as to the actual dimensions and materials of this first project. Also, if some configuration proves to be ineffective, then I will plan a course change to mitigate the problem.
As a working strategy, I am considering building parts of the frame with MDF.
Using cheaper materials, I can experiment with the configuration and assess the problem. In addition, cutting wood is much faster than steel. To combat the rigidity issue, I will use multiple layers of MDF glued together. In addition, painting all the MDF surfaces will be essential to avoid some humidity or moisture issues. Finally, by judiciously adding steel in weak spots I fix some spot structural issues.