
Building a hobby CNC machine

The picture above shows the NEMA 17 stepper motor mounted on the side gantry.
Can you build your own CNC machine?
Absolutely yes you can, I have and if I can anyone can. There are lots of examples of CNC machines that people have built at home starting with simple machines built of wood to impressive aluminium extrusion constructions, and that leads on to the question of.
How hard is it to make a CNC machine?
Well, this is a difficult question and I think it comes down to a couple of things how accurate you want it to be and how long it takes. If you want to build a CNC machine from scratch and you want it quickly and to be very accurate, it’s going to be hard.

The picture above shows how you move something with a stepper motor. As the motor turns the threaded rod the silver block moves up or down it.
Don’t be afraid of trial and error
If you’re willing to take time and experiment and learn as you go along, eventually replacing parts to make things better, sturdier and more accurate then it’s not that hard if you take it in steps. For instance you can build it quickly out of wood and you’ll realise some bits would have been better being longer, shorter, thicker or thinner, you can then start to replace the wood with the excellent aluminium extrusion parts when your more sure of the sizes and where you want them. You can get them from my page on getting parts for your CNC project here.
You just won’t know exactly what you need when you start is the point I’m trying to make.
So you’ve decided that you are going to build a CNC machine, for me building a CNC machine was the best thing I’ve built for years, the more I got into it the more excited I got, I was like a child again. Then as each bit worked and it all started to come together the more excited I got about the possibilities of what I could do with it.

This is the first type of linear guide that I used although they seem very strong once you have built your machine you realise you can bend them and flex them.
I’ve always built stuff as a kid now I could see I was about to make something that could make parts and things far more accurately than I’ve ever been able to and to do it repeatedly. One of the things that I found almost amusing was that once you’ve got a basic machine you can make parts using your machine to replace the first ones you made. This can significantly increase strength and accuracy, two of the things that will make your machine better.
How do you start to build a CNC machine?
The first thing you need to do is make a few rough plans I wouldn’t spend too long and worry too much about getting everything right because you won’t. You’ll chop and change as you learn what works, what doesn’t and how you can make stuff better, that’s half the fun but you will need a few plans or diagrams of how it’s going to go together at least to start building.
Once you start putting things together you’ll realise things you didn’t visualise when you started.
For instance when I put together my first CNC machine I choose 300mm linear guides for the X axis thinking 300mm would be wide enough for my machine to cut however once you put it together you realise that a 300mm width linear guide won’t give your spindle 300mm of movement because it sits in the middle so it’s 300mm minus the size of the Z axis assembly which is nowhere near 300mm.
Don’t worry if you don’t understand that straight away, I didn’t until I started to put it all together. That’s the thing about plans, you need some idea to start but you’ll have to change it around plenty of times.
Look at other peoples designs for ideas
You’ll probably do what I did and look at a few of the different designs on the internet and then come up with what you think will be right for you. That’s what I did and I decided that I would build something like the 3018 CNC that you can get from Amazon.
I was going to build it all out of wood and screw it together and get the other parts from Amazon. I’d got lots of scraps of wood and screws so once I’d got the Amazon bits I wouldn’t be waiting for stuff. There’s nothing worse than having an idea and not being able to get on with it because you are waiting for a part.

The design was like the 3018 CNCs with a frame for the bottom, a fixed goal post like gantry for the Y-axis to move along and a moving baseboard for the X-axis. The Z-axis would move and down on the fixed Y-axis gantry.

What do I need to build a CNC MACHINE?
I’ve made a list of the parts that you’re going to need here so you can see what you’ve planned with what I needed.
I’ll show you the order of things I did and why.
First I got the electronics together. It would make me feel better if I could plug a board into the laptop and get the software working and get the motors turning. I was planning to do this on a table top. The software and electronics I considered to be my strong points and I was pretty confident I could get all that going. That would be the technical stuff done then getting the motors moving with what would be my wooden Meccano would be fun!
Arduino Uno
So the board I got was the Arduino Uno and you can read about that further here. The drivers for the stepper motors are plugged into the shield board which is plugged on top of the Arduino Uno board you can read more of that here and the stepper motors I choose. They are plugged into the shield board and the power supply connects up to the Arduino shield for the motors, then with the software on the laptop and some G Code loaded you should then be able to get the motors moving. If you put bits of electrical tape on the shafts you can see them move better as sometimes they only make small difficult-to-see movements.
Once I’d got that all working it was quite a boost to be honest all I had to do now was to build the machine to convert the motor movements into linear machine movements and then I would have a CNC machine
The next stage was to build a framework for the base. This was a square I built by screwing together 4 chipboard lengths that were just cut-down shelves. I mounted the Y-axis motor at the back outside the frame similar to the 3018 CNC and drilled a hole for the screw thread and coupling to go through.
The linear guides fitted to the frame and the moving bearing blocks slide along them. The four bearing blocks were then bolted to the moving table and the “nut” was bolted to the middle of it underneath and the threaded rod then slid inside the nut now by moving the Y-axis motor the table would move backwards and forwards. Result!
Things I discovered as I built my first CNC
What is an anti-backlash nut and why do you need one (or two)
First, you need to know what backlash is, put a nut on a screw thread and then push it without turning it you will find it will move slightly and then you can’t move it if you now pull it you will find it will move slightly and then stop. So if you push and pull it you will feel it push against one thread and pull against another. There is a slight movement because the nut is slightly smaller than the screw thread. It has to be so you can turn it. It’s more noticeable with metal nuts and screw threads.
This movement is called “backlash”. On a CNC machine, it can cause problems because the actual position when the motor drives the nut on the thread can vary by however much the backlash is. This can cause problems, even machines like the basic 3018 CNC machine are very precise. Look at how fine they can engrave when doing small PCBs.
Minimising backlash
So how can you get rid of backlash while still allowing the nut to move on the thread? There are a few ways of doing this. One of the most popular and cost-effective ways is to make the “nut” part out of some other material, Delrin is a popular choice it’s a type of greasy plastic and it can be quite tight but still move on a thread. Another method is to have a spring to hold the nut to one of its extremes when it stops so it will always end up at the same end of its backlash.
These are what are called anti-backlash nuts so you’ll probably need one on the X-axis and one on the Y-axis. I haven’t used one on the Z axis because of the weight and gravity act as an anti-backlash nut. If you’ve ever wondered what the spring for is on the nut on a CNC 3018, it is to make it act as an anti-backlash nut.
Getting the Z axis working
The next bit I wanted to do was to get the spindle to move up and down, the Z axis, this would have an effect on the side-to-side X axis so once I’d got that together it would be easier to visualise the rest. I made a small board and made a wooden half-circle arrangement to clamp the Dremel tool to the backboard. This board would then be driven up and down much like the baseboard in the first step.
This Z-axis assembly would then be driven side to side by the X-axis motor and linear guide.
I quickly cut bits and screwed them together to get a working system. It was pretty easy with a table saw and drill to get something working quickly. My idea was just to get it working and then replace bits as and when it was needed and basically as I learned along the way.
Things I discovered as I built my first CNC
The linear guides that looked absolutely solid on a table could easily be flexed when everything was assembled together.
The leads that plug into the motors only plug into the motor one way round but the other connector can plug into the Arduino shield board either way round. This is good because if you try to move the Z axis up and it moves down you need the motor to go the other way you just unplug it and turn the connector around. This can also be done in the GRBL settings which you can read about in the article about GRBL settings here.
So now I’ve got the first sort of working CNC in front of me. It’s on the kitchen table with the Arduino board also on the table as far away from the actual CNC as the lead and power supply will allow that’s also on the table along with the laptop running the CNC software. Now I’ve gone on the internet and downloaded some of the demonstration G CODE files that come packaged with the Amazon 3018 CNC machine. You can download all the manuals and software and stuff for those machines and that’s worth doing for the assembly instructions to get a few ideas from.
Things you’ll also need
A selection of M3, M4 and M5 machine screws of assorted lengths with washers and nuts to fix the motors, linear rails and stuff.
The G CODE file that I loaded into the CNC software is just the word “hello world” I put an engraving bit into the Dremel and moved it as high as I could to keep it away from the work surface as I was unsure how far it would go down. I started the G CODE running and the spindle lowered a bit then moved to the side and then the table moved and it all started going left and right and forward and backwards. I could actually visualise it engraving the word “hello world” although it wasn’t because:-
A. The Dremel wasn’t switched on and
B. The bit wasn’t near the surface, however, it was all tremendously exciting for me, I know I should get out more, but there you go.
Next was to keep lowering the Z axis bit by bit and setting a new zero. Don’t forget when you get nearer the surface to turn the Dremel on, lowering the z-axis .5mm at a time until it engraves. Well to cut a long story short eventually it started to engrave. It engraved the words “hello world” as I had hoped, well almost, the further it moved right the less it engraved and was hardly scratching the surface so some tweaking was in order. I was already excited when it looked like it moved correctly so you can imagine how I was after this.
My CNC machine is only moving half the distance it should
The words “hello world” were small they were a lot smaller than I had thought and on manually moving the spindle 10 mm by the machine I measured it and it only moved about 5mm. If this is something you find don’t worry it just means you have to make a few alterations to the GRBL settings and you can read about it here.
My Dremel tool slightly twisted as my CNC machine worked because of the forces so the clamping method needed beefing up a bit.
Even if you measure everything as accurately as possible it’s very difficult to make a CNC machine out of just wood and screw it together, don’t get me wrong you can make a very good machine that will work to tolerances that you couldn’t manage manually measuring yourself.
Once I had got my machine running I wanted to replace bits to make it more accurate. I’ll mention some of the problems that I didn’t foresee when I started but also just how accurate you can expect to be.
The first thing that I think you’ll notice is how your machine isn’t flat when it comes to cutting and particularly engraving and you’ll see why.
When you’ve got a working CNC machine you’ll pretty quickly be lowering the Z axis by .1mm when you come to engraving. You can quite easily engrave to depths of .2 or .3 mm if you want to engrave fine text. It’s quite easy to do the maths and see how you’re going to get problems. As an example let’s say your side or X-axis is only 30 cm long and one of your sides is 1mm higher on one side than the other.
If you engrave to a depth of .2mm and then move 10cm left it can be .333mm out so it could engrave at nearly .5mm depth or be .1mm too high and not touching the surface or engraving at all. Then there’s the front-to-back variation. If you want to make prototype PCB’s you’re not going to get very far.
Flattening your table
There is a technique you can use to flatten your machine bed that you can read here but that’s really for finishing off small errors and not for this sort of variation. Don’t worry though there are things you can do. These first experiments were to get a working machine, see what it could do and basically learn. After a very short time, I had learnt a huge amount from building my first CNC machine and the best bit is you can use it to make bits to swap out and make it better!
I can’t really measure to 1mm and drill a hole as accurately as that. Try to measure and drill a row of 10 holes all on a straight line and 10mm apart then get your micrometre and measure just how far your best and worst efforts are!
Another thing I found out was after making a plastic case using my CNC machine to cut the pieces was that the panels I cut weren’t square, they were all off by about 1 degree. Not surprisingly when I checked how square my CNC machine was, it was about 1 degree off. Again not too bad but it would be much better if it was square.
I managed to square up the frame by bracing it with some extra pieces of wood and the flatness issue was sorted to some extent by tweaking some of the holes and adjusting stuff. I just wanted to basically bodge it to work as accurately as I good to get finishing a couple of projects I had wanted to get finished and also to make some new pieces for my second CNC machine.
CNC table movement
I found the backwards and forwards or Y-axis movement to be quite confusing as when you move the spindle forward it doesn’t actually move forward. The table just moves backwards so although that’s correct when I wanted the table to move forward I pressed the forward button which actually moves it back. That’s exactly the same as with the 3018 CNC and indeed every CNC that has a moving table it’s just something you have to get used to.
My second CNC machine
When you build your first CNC machine you don’t realise how accurate you need to be. For example, the base that I have move backwards and forwards for the Y-axis moment has 4 bearing blocks mounted on the bottom of it for the two linear rails with the nut for the screw thread in the middle like the design of the 3018 CNC.

The bearing blocks are threaded so you have to mark and drill the holes. I found it quite hard once the 4 holes had been drilled to get all of them to line up to the 4 holes in the bearing block. I had to enlarge the holes and do a bit of jiggling.
There are 2 bearing blocks on one linear guide and if the first part of having 4 perfectly aligned holes to mount a bearing block wasn’t hard enough, the second lot has to be perfectly aligned with the first lot. If they aren’t they won’t run along the guide properly.
I found that once I had tightened all 8 bolts on the bearing block it would hardly move up the linear guide. Loosen the bolts and it was better so it was a case of enlarging the holes even more. Also, the holes have to be almost perfectly at 90 degrees to the surface as the thicker the board the more deviation there will be.
It gets even harder as when you put the second linear guide on it has to be at exactly 90 to the first else it will get stuck as you slide it along once it’s fixed to the board.
This is the same with any of the linear guides you use and a problem I hadn’t foreseen at all when I was planning it. I just looked at the bearing block and thought yeah just drill 4 holes and bolt it where you want.
The good news is that once my first CNC once squared and calibrated, it was more than capable of cutting holes perfectly aligned to make pieces for to replace my hand-drilled parts. If you haven’t calibrated your CNC machine I have an article here for you to read.
The first part I replaced was the Z axis which needed a new plate with 4 bearing blocks for the 2 linear guides with 4 holes in each bearing block so that’s 16 holes. I made a simple design and let the CNC machine drill the 16 holes.
I fitted the 4 bearing blocks onto it and was amazed at how it effortlessly slid up and down the linear guides without any adjusting. It just goes to show the difference between manually measuring and drilling and having a CNC machine do it for you.

The picture above shows the Z axis, you can see two of the four large holes, these are for the clamps as the router fits on the back of this assembly. The four blocks and the central one attached to the motor bolt onto the X-axis assembly.

In the picture above you can see the rails for the X-axis. the four blocks are bolted onto the MDF board. The holes in the middle section are for the blocks on the Z-axis. The X-axis rails then bolt to the Y gantry assembly.

Another view of the X-axis assembly.

The assembly with the threaded rod and nut attached.

The same thing but viewed from the back.

Same thing but a side view.

The picture above shows the Z-axis board and the X-axis fixed together. The shown NEMA 17 stepper motor moves the board up and down with the router fixed on the front.

Another view of the assembly. The rails will be bolted onto the Y gantry.

The whole assembly with the rails bolted onto the Y gantry.
That’s not to say the first machine was no good or useless far from it. I learned so much that I never could from just reading. There’s no better way to learn than by actually doing and my first CNC was going to make a lot of the parts way more accurately than I ever could and lots of the parts were going to just be reused like all the electronics and motors and some of the linear guides.
The biggest improvement I was going to make would be the Y axis of front-to-back movement. I’d modelled my design on the 3018 table movement and this was always a problem of trying to keep it level. My second cinch machine was going to be a different design where the table or base is fixed. The linear rails run down each side of the base and the whole X axis with the Z axis mounted on top moves backwards and forwards on these linear rails. This meant that all of the electronics could be fitted under the base.

Also once you’ve got the X-axis and Z-axis running the linear Y rails can be any length you want without changing the X-axis and Z-axis assembly. So I was going to build the machine with the 40mm linear guides that I used in my first construction but make the machine long enough that I could just replace the linear guides on the side and used a longer threaded rod. This would then increase the machines cutting size quite significantly.
Something I learned from building my second CNC machine
My idea for moving the upper X and Z-axis assembly on the side rails was to use the original Y-axis motor and threaded rod going down the middle under the table, however, although it did work the movement was a little jerky. I knew there were plenty of designs that use 2 Y-axis motors on either side instead of the one down the middle and that’s the alteration I decided to do and it certainly made it a whole lot better.
Mr second CNC machine also had a spindle upgrade. You can read about my experience with spindles here. The router spindle also proved to be easier to mount as the body was a metal cylinder so I was able to get mountings that proved to be amazing with zero side-to-side movements. You can find them in my parts guide.

Using side rails and a solid non-moving base also solved most of my problems with the varying height especially once I had used the levelling technique that you can read here.
When you use this arrangement with side rails you need 2 side panels. The idea was to use plywood eventually but just to try the design out I cut the side using an old 18mm melamine shelf. I still haven’t gotten around to replacing them yet. Next, I designed the shape and the holes using the free xx software and made a mirror image for the other side and used my first CNC machine to cut and drill the side panels.
I then used some of the 2030 aluminium extrusion that is made for the construction of CNC machines and 3d printers. You can get it pre-cut to various useful lengths and it’s slotted for nuts and it makes it easy to build something square and lined up. There’s more about this and other aluminium extrusions here in my parts guide

Using the 2030 aluminium extrusion on the bottom to link the 2 sides together made it a lot easier to line everything up and link together and it’s all square.
Apart from the different design of the fixed base, the other thing I changed was the linear guide. The metal rod guides did flex quite a lot under strain. You can test this yourself if you push the spindle tip and it flexes the rails. So I decided to use these ones instead they cut down on the amount of bending quite a lot doing the same test when trying to push the spindle.