Building my own CNC machine has been quite an educational experience. I've got a better idea of what I'm up against now, and have plans for moving forward.
Lessons Learned so Far
First. Hardware is hard. Much harder than software. I expected programming or wiring the electronics to be the difficult part, but thanks to good docs and helpful Arduino libraries I was able to get basic movement going pretty quick. The biggest challenge has been the mechanical construction of machine. I've gone through several iterations of the pen mount, sliders, and lead screw attachments but there is still much more to do. Software is so much easier to modify and test out new ideas. Creating a new slider took several hours to design, build, and test.
I have also learned how much of hardware success is based on component sourcing. Throughout this project I have added to a growing list of good online shops to getting interesting pieces; and how to repurpose unexpected materials like plumbers tape. I also learned that Amazon Prime is your friend. I honestly don't know how Fedex can make any money off of them.
So far I'm happy with the progress I've made on my CNC machine. I can now make a pen move in the X and Y directions with a fair amount of repeatability. The machine is a good test of ideas but not reliable enough to actually use yet. The biggest issue is tightness. Everything in the CNC machine has some slack in it. Each component of slack multiplies to make the pen slide all over the place; and a sliding pen means bad drawings. So that will be the main driver of the next version: making it super tight.
The other night I designed a new slider. It still uses roller skate bearings but applies them to the support beam from three sides instead of two. It also uses more rollers spaced further apart. The new sliders greatly improve stiffness without adding too much friction.
To remove the stickiness of then pen I realized I need a way to press the pen into the paper but still have some slack. This calls for a spring. After reading work that others have done I devised a new holder using two ballpoint pens. They are, interestingly enough, identical pens but with different brands on the side. Most likely from the same swag manufacturer. If you attend conferences you likely have tons of these guys lying around.
By combining two pen barrels and putting a spring at the top I can get the pen to sort of float in the middle but pressed against the bottom end. The spring pushes it against the paper but lets it slide up when needed. It acts sort of like a tiny shock absorber. Good enough for this version.
On the electronics side I finally mounted the various boards on a sheet of plastic. Using my Dremel drill press I set them up on inexpensive spacers from the Robot Shop. I also gave the steppers proper four pin connectors from Adafruit since I'm always plugging and unplugging them. The drivers still have some breadboarding to get rid of, but things are improving. I also added a real power switch for the motor current instead of having to constantly unplug the wall wart.
On the software side I wrote some new Arduino sketches using the excellent open source library AccelStepper. It handles acceleration and multiple steppers with ease. Now the motors sound like engines powering up.
Oh yeah; my teaser from before. The NES Controller.
I found two original NES controllers at our local electronics recycling shop for five bucks each. I love these things. These two are probably over 20 years old and they still work perfectly. Nintendo designed them to be bullet proof. (Sadly their design of the cartridge connector was not so well thought out).
The controllers use a simple serial protocol over their five pins. You can hook them up directly to an Arduino using jumper wires but I found an NES breakout board (Robot Shop) to give it that nice finished look. The software side is easy using the NESpad library. Note that this code is a few years old and won't compile out of the box. I suggest using my fork of the lib which is patched to compile with Arduino 1.0 and higher.
Every good project needs a name. I'm tired of saying "my CNC drawing machine thingy" over and over. Thus I dub thee "Clyde" after the orange ghost of Pacman fame. Apparently his other names are (translated from Japanese) are "stupid", "slow guy", and "pokey". Fortunately Clyde is easier to pronounce than Guzuta and Otoboke. He may be slow but he tries really hard and gets the job done.
I'm going to take a week off from Clyde during my parents' visit. Instead we will play with Jesse and finish up some house projects. When I return I will build a new machine over twice the size of the current one: 40cm x 60cm x 10cm. This is big enough to do some real work while still able to fit on my desktop. My latest extrusion order from OpenBeam is enough to build the new machine with plenty left over for reinforcement and experimentation. Have a good weekend!
posted Fri Aug 31 2012
I've been wanting to get into electronics and building physical things for a while. I have a lot to learn though. My only exposure to micro-controllers was when I played with an Arduino for a day about two years ago. The last time I picked up a soldering iron or drew a schematic was my lone electrical engineering class in college nearly twenty years ago. My degree is in computer science with a focus on graphic and AI giving me a decidedly software-only career. This makes picking up electronics both challenging and fun.
To start off I decided not to go the easy route; which would be to buy a prefab micro controller and then program it. While I have an Arduino sitting on the shelf, that would be too comfortable for a software guy. Instead I decided to approach this from two directions. First, I bought some kits put together entirely by hand with soldering, no programing at all. This should beef up my skills and introduce to me to the various physical components available (resistors, capacitors, switches, etc.)
Second, I've came up with a project too challenging for someone with my skill level to build: a CNC machine. While I will likely fail during my first attempt, doing something so far out of my areas of expertise will force me to learn a lot of new things.
Learning to Solder
To kick things off I picked up a Larson Scanner kit from the Evil Mad Science store. This kit is quite easy to build; a great starter project for beginners. The micro-controller is pre-programmed and it comes with a PCB (Printed Circuit Board) so you just need to solder in some resistors and LEDs. It even comes with comic book style instructions.
To learn how to solder read this short comic on MightyOhm.com. I was wrong in my initial assumptions. You aren't melting the solder with the iron. Instead you are heading up component and metal pad on the board, which the solder then melts on to. Once I figured that out my joints started to look a whole lot better.
As you can see my soldering skills improved from the beginning to the end of the scanner kit.
Oh, and remember that the battery pack has a switch on it. The first time I put in the batteries nothing happened because I forgot to turn it on. :)
A soldering iron can be had for very cheap, but since I plan to do this for a while I invested in a good one. Spark Fun sold me this soldering station of their own design, which has plenty of power and temperature control, for a very good price ($40).
Now, on to the CNC machine. A Computer Numerical Control machine, or CNC, is sort of like a plotter. It moves a head in X and Y directions over a surface. However, instead of moving a pen or printer head it uses a drill or other cutting tool. Advanced versions also have a Z axis. This lets you cut many kinds of materials from wood and styrofoam all the way to thin aluminum and sheet metal. And of course it's only a few steps away from having a full 3D printer. All of these features make it a good project for me: something that I can improve over time and has real world uses.
Since I know absolutely nothing about these machines I have a lot to learn. What I've discovered so far is that it's best to start small and build up from there once you have something that works. To that end I created my first prototype of a single axis. It just moves a little carriage up and down a rail using a stepper motor turning a long screw.
The stepper motor and driver came from Spark Fun. Interestingly, the stepper driver is actually an open source design called the EasyDriver designed by Brian Schmalz. You could of course build your own from components for less than what SparkFun charges, but I prefer to get the nice polished version rather than saving a few bucks. (And I do mean only a few. SF's is pretty well priced). For power I'm using a 9 volt battery, but will to upgrade to a larger supply once I'm done testing.
The driver is controlled by an older Arduino I already had. The EasyDriver is quite easy to use. You simply toggle one pin for each step and set the direction with a second pin, high or low. Beyond that there is an open source AccelStepper library that can handle multiple motors at once and use acceleration.
I created the metal carriage by hand using aluminum extrusion and brackets from OpenBeam, an open source hardware company based in Seattle. I'll have a lot more on OpenBeam in a future blog soon. OpenBeam uses standard M3 hex nuts so I have a mixture of sliver ones from OpenBeam and black ones from Amazon.
The Big Challenge
Making a CNC machine is not actually my challenge. My real challenge is to create one for under 200$. After pricing out components I really think this should be possible. By reducing costs, Arduino has greatly reduced the barrier to entry for learning about electronics and micro controllers. If we can build a 200$ CNC I think it will kick off a revolution in home construction. Even if I fail to meet the sub-200 price tag I will learn a whole lot in the process.
Hopefully it goes without saying that I will document everything on this blog and open source the plans and schematics. No matter how smart one brain is, a team of brains can do more. I would love your help on this project.
If you don't already please subscribe to my RSS feed or follow me on Twitter. Exciting things are in the works.
posted Mon Aug 13 2012
I've been posting little teasers of the CNC machine I'm working on. It's time to reveal a bit more.
In my spare time I have been working on a tiny two axis CNC machine that will be powerful enough to move a pen around like a plotter. Future versions will be larger and handle more powerful tools, but this is a good start to work out the kinks.
So here she is in all her glory:
She's a two axis CNC. The X axis is the lower level and the Y axis is the upper, set at 90 degrees. A future version will have a Z axis as well. The structure is made of aluminum extrusion from Open Beam. This version uses about 4 meters. You can see the nice ABS brackets on the corners, also from OpenBeam.
Each axis consists of a structure sitting on sliders created from roller skater bearings. For movement I'm using standard stepper motors from Spark Fun powered by EasyDriver boards. The steppers convert rotation into linear motion through the long threadscrews. While you can spend a great deal on threadscrews, these are just standard steel all thread from the hardware store (~3 USD). Everything is bolted together with Open Beam screws, which are standard M3 6mm screws and matching nuts.
Stepper motors have to be powered and controlled by a driver board. I'm using the open source EasyDriver from SparkFun. There are more powerful motors and boards available, but these will suffice for version 1. They are cheap, effective, and very simple to wire up as you can see in this photo:
Each stepper motor has it's own driver board. The four wires go into the four motor pins of the board, labeled A1, A2, B1, and B2. These aren't actually labeled on the motors themselves so I had to test and label them by hand. Each board also has power and ground. They receive more than 5V since the motors usually need more. In my case I've connected them directly to a 9V battery. This would never be enough power in production, but it's okay for testing and very portable. I'll dive more into the EasyDriver's later, but for now just know that they can take almost any power you can throw at them and convert it safely to run your motors.
Finally the drivers have
direction pins connected to the Arduino, which you can see in this photo:
The Arduino code toggles the two step pins over and over, occasionally changing the direction. That's all there is to the electronics. Arduino and the EasyDriver make it very simple.
Now let's look at the mechanicals:
The beams are aluminum extrusions from Open Beam. In addition to being open hardware (the schematics are available to make your own) it has a few nifty features. Take a look at this end cut:
There is one channel per side. Each channel takes a metric M3 nut or screw. Hex nuts are the perfect size to slide in easily and not rotate. Because these are standard sizes you can buy screws from other vendors, such as these black anodized 16mm screws I got from Amazon.
I've cut most of the extrusion by hand using a hacksaw and plastic miter (the kind used for cutting wood). Eventually I bought a cheap 6" power saw from Harbor Freight that uses cutoff disks. The final cuts are smoother than a hacksaw can produce and are done in a quarter the time. It's good enough for 60 USD but eventually I will probably upgrade to a proper miter saw with a metal cutting blade.
The extrusions are put together using injection molded ABS plastic brackets, also from Open Beam. I mostly use angle brackets with a few Ts thrown in.
The stepper motors are attached with Open Beam stepper brackets. These are designed to accept any NEMA 17 stepper motor and come with matching brackets for the other end.
But here is the genius part: Open Beam sells an adapter which accepts #608 roller skate bearings, which look like this:
These brackets make building a lead screw very easy. I chose a 5/16 inch all thread screw at my local department store (~3 USD). It fits inside of a roller skate bearing perfectly. The blue stuff in the photo is the skate bearing.
Speaking of skate bearings, they are completely awesome. But that will have to wait until tomorrow.
I'll go into the bearings and shaft coupler tomorrow, two of the most critical parts of a CNC machine. Oh, and one more question. What should I name this contraption?
posted Wed Aug 15 2012
This is part 2 of my N part series on building a DIY CNC machine. If you missed it, here is part 1.
One of the trickiest parts of building a CNC machine is the linear sliders. Each axis requires a rail to slide the carriage on. This is called a linear slider. The sliding mechanism must have very low friction but also be strong to support the weight of the other axis and the head (which could be as heavy as a router). The carriage must also grip the slider tightly to ensure it doesn't slip or turn. The accuracy of the final CNC machine is directly related to the quality and tolerances of the slider. Needless to say, professional slider mechanisms aren't cheap.
After researching what others have done I decided to build my linear sliders out of OpenBeam using #608 roller skate bearings. Skate bearings have a few advantages: they are produced in mass quantities so they are pretty cheap for the quality you are getting. They are also usually sealed to keep out road dirt, so they can handle any debris the CNC might produce. And, because they are a standard size, getting parts to fit them is fairly easy. Here's a quick look at two versions of my bearings.
Skate bearings typically start at 1 USD each in sets of eight and go up from there. However, if you can afford to buy a lot at once you can get them as cheap as 50 cents a piece. I purchased my bearings from Amazon as a pack of 100 for 50 USD. A CNC will end up using at least 20 bearings so it's worth going for the large pack.
To attach the bearings to the beam I used long M3 screws from my local hardware store, about 20mm. Of course the inner diameter of the bearings (the bore) is much bigger than the diameter of the screws, so I needed to fill in the space.
After playing around with a variety of spacers, sleeves, and bushings I found a combination that would work, as depicted in this photo:
This works and is what I used in the current version of the CNC machine, but it has a few disadvantages. The nylon parts are longer than the bearing is wide so I had to trim them by hand. Plus there is two of them needed for each bearing, which adds cost and assembly time. I also had to add some washers to prevent the screw head from going through the center and to give more space between the beam and the bearing. Not bad for a first try, but I need something better.
Some searching on Amazon turned up some better pieces:
This bearing assembly uses a slightly shorter screw, 16mm (also in cool anodized black). I also found spacers that the were the perfect length, no trimming required. The interior diameter is perfect for the screws. the outer diameter is a tight fit in the bearings but I can pop them in easily with pliers. Since they fit in with friction I don't need to worry about washers to hold the bearing on. To give more space I used some of my standard M3 nuts. Since I already have to buy tons of them they are cheaper than washers, and adjustable to boot. Score!
I'm learning that creative sourcing and constant redesign is the only way I will reach the 200 USD goal.
The next big challenge for a CNC machine is attaching the lead screw to the stepper motor. I would think this would be easy. I would be wrong.
The lead screw needs to be attached to the stepper motor securely so it won't slip, but it also needs a bit of flexibility to absorb vibrations. The two shafts also must be perfectly concentrically aligned or else the carriage will bounce up and down. Doing all of this for a decent price is very hard. Commercial solutions run 30 USD per shaft coupler.
I found several people online who use rubber tubing with clamps. Unfortunately I found the tube around the stepper shaft was too loose. If I tightened it with the clamp then the shaft would never be concentric with the lead screw.
My next attempt is what you see in this photo:
I used two pieces of tubing, one nested inside the other. The smaller tube is shorter and only goes around the stepper shaft. The larger tube contains the smaller tube as well as the leadscrew. The small tube is tight enough that it doesn't need a clamp, so that reduces the complexity a bit. The larger tube still slips, so the clamp must remain.
The two shafts are now more concentric but still not perfect. It's a good start though. For my next attempt I will switch to aluminum tubing from a hobby store.
I can't turn my CNC machine into a plotter without a pen of course. I started with a Sharpie rubber banded onto a piece of extrusion.
It almost works but not quite. The pen has no give. It is either pressing very hard against the paper or doesn't touch at all. When it presses hard it prevents the carriage from moving smoothly, so I get lots of skips and jumps. I'm still looking for a better solution that will add some spring.
That's it for now. Next time I'll show some of the improvements I'm making to the electronics side for V3.
posted Fri Aug 17 2012