Build Your Own Cnc Machine




Introduction: Build Your Own Cnc Machine

in this tutorial i'm going to show you how to make your own CNC machine. For this you can buy all the materials in local dealers, and electronic shops.

CNC is a computer controled machine,and can cut, engrave and carve, in all kind of materials.

Step 1: Materials for the Estructure

we need a lot of materials for this proyect, then i only put here all you need for the estructure, in the other steps i tell you what materials you need. Im going to tell the expenses here in spain, but think maybe the materials in your countri has diferent prices.

1. Wood for the estructure, i use DM playwood.

2. 3 stepper motors. 1,5 gr/cm

3. Rotative tool like dremel

4. Threaded rod

5. Nuts and bolts.

6. Tools.

Step 2: Stepper Motor.

The stepper motor is a device that converts a series of electrical impulses in angular displacements , which means that it is able to advance a number of degrees (steps ) depending on the order that you'll be . The stepper motor is a highly accurate motor as its shaft rotates from 1.8º to 1.8º which means that for 360 to give 200 steps. This gives them incredible precision , which transferred to the CNC provide an ability to make very small and delicate parts , but also can make big pieces.

Step 3: Chip A4988

chips A4988

The Pololu A4988 chip are some electronic drivers that are used to control stepper motors, to decide the rotation direction and speed of these . The engines will be connected to Arduino, I guess , you know perfectly well that is, if not in Ikkaro can find information about this board. Do not need to know much more about these chips, but if you want to deepen can inform you all in the manufacturer's website , and this other link you can download the datasheet of the A4988 .

Step 4: Costs


Well as I guess it's a question all you will be doing here I leave the list price .

3 Chips A4988 - 45 € (15 € each)

Arduino UNO - € 26 (now the Leonardo goes for 20 € )

3 Stepper Motors - 36 € 3 per ebay

1 PCB - € 5

Wood DM - 30 €

Milling - € 50 (mine is brand but there are 20 € )

Threaded rods and nuts - € 0.50 ATX - 20 € / 50 € ( I kick an old computer )

Total - € 200 approx.

Step 5: The Main Drawer

First, let's cut the boards that form the main drawer of the machine within which the electronics are placed and this , the router will work materials .

The measures of this drawer are fully customizable and each of you can choose based measures , depending on the size of the pieces that want to mold . Note that what we measure the drawer is the maximum area on which the machine can work . All dimensions of the machine are customizable and can use this tutorial as a guide but the size of your CNC is up to you .

Once we have built the base of the machine, we will give a " rails " ( can be seen in the photo above ) for the main spindle to roll forward and backward. These guides are just two strips of wood are glued to the two opposite sides of the drawer. Finally it should be something like this :

About the guides we just put it rolls the main section of the machine, which moves in the direction of the axis X , and on this head that moves in direction of the axis Y and Z will meet But we will see a little below.

Step 6: The Goal

Now with two wooden planks we build a kind of structure in the form of goal , as shown in the picture, but considering that on the table is horizontal to do with slots to run the wheels of the main spindle. This is the image of the structure:

Below , the head structure , carries a strip which connects the two walls for stability and allows the threaded rod to pass through it to move . ( Do not be alarmed by the wiring already 'll explain in the next article and see that easy)

Step 7: The Head

With what we have so far the machine should have already taken shape . Focus on the head then that is where the router , which goes up and down . This is the trickiest part of the whole process and this piece must be perfect to prevent movement or pitching machine when running.

We take three planks and unite to form a box of three walls , within which the router is placed. This box shall bear two covers , top and bottom , with the top, with a hole for the motor shaft to pass through it and the bottom , with a hole to fit threaded rod and stick to its axis of rotation . Within this table and in the vertical direction must be three guide rods as the image , so that the central piece is moved along the Z axis , but recommend two router tables to hold two parts and not to pitch , because when work will put pressure on the tip of the router and this could be diverted .

Step 8: Place the Stepper Motors.

Once the entire structure is built proceed to place the stepper motors.

The placement of the motors must be done carefully to avoid pitching of these . First make a hole in each of the tables in a suitable measure to pass the motor shaft . We introduce the shafts into the holes and threaded rods connected to them. The connection of the threaded rod I leave to your imagination , but my system was put on the shaft a metal taco, of those used for hanging ceiling lamps, they have a threaded inlet and smooth , as meteis the shaft in the smooth rod in the thread. These items be sold in hardware stores. Here I leave a detail of the joint rod engine :

The threaded rods for the X axis will cut measure that has as main drawer depth to the Y axis, the cut of the measurement between the two side boards that hold the head and the Z axis is short compared to the height of your head .

Step 9: The Conexions

In this part we will see how to install the hardware environment necessary to control the machine.
• 3 Chips A4988 Pololu Robotics
• 1 Arduino UNO
• 1 Power Supply ATX
• 1 Fan (optional)
• 1 PCB
• 3 stepper motors (elegid the model to suit you)
• Welder
• Tin
• Flux

As I explained in the first part of the tutorial Pololu A4988 chips are some drivers stepper motors, which means the signals sent by Arduino controlled engines.

The first thing we have to do is ask and we will design the PCB, I bought this in and she soldered components.

All electronics should look like in the pictures

Leave a picture of the PCB without fan (I decided on wires instead of tracks, sorry)

I leave a picture of how they should go all connections

The source that we use is an ATX (source computer) with which we can feed from the chips to the engines and the router. I chose an ATX as it is the cheapest and also the you can draw from an old computer. To operate NEED jumper on, there are several videos on youtube that explain the process.

The source has different voltage outputs to connect all the electronics to the same ATX and so only use a socket on the wall.

The voltages of different power outputs shown is the following image:

I leave a description of chip voltages and utility of each pin:
• VDD - Power input chip 3.3 V / 5 V cables or orange red ATX. (You can choose between the two voltages even recommend 3.3 V)
• GND - Tierra del A4988. It connects to the land of the ATX, ATX black cables.
• VMOT - Power input for stepper motors. 7 V / 36 V (voltage depends on the motor and must match the engine, as it is this voltage which will be passed to the engine to make it move.)
• GND - is the engine ground. This must be connected to the land of the A4988 !!!.
• RESET - Resets the chip to return to initial conditions. And switching between Stand-bye and Enable modes.

In this connection are:

IMPORTANT: To prevent malfunction of the machine all the lands must be connected, ie the land of the A4988 must be connected to the stepper motors and the land of Arduino. No problem that the voltages are different, although the chip is 5 V and 12 V motor can be interconnected lands together. Yes, this works if the source is an ATX, have not tested if it is dangerous to other sources so if usais an ATX, do not conectéis anything together and Try before. Although for me the best option is an ATX as it is the most economical and powerful I found.

Once all the A4988 are plugged in to the power and motors are connected to the A4988, can proceed to connect the cables Arduino pulse.

Step 10: Control the Arduino

Control of A4988 by Arduino

Arduino control chips using digital output pins. Each chip, we use 3 digital inputs (STEP, DIR and RESET), and therefore will require, 3 digital outputs Arduino. When arduino STEP send a pulse to the motor advance one step. If DIR receiving a signal, the motor will rotate in a clockwise, if received, to the contrary. The RESET pin is used to reset the chip.

The pins that we will use our Arduino are:
• Pins 2, 4 and 7 for STEP pins for A4988
• Pines 3, 5, and 6 for the DIR pin chips
• Pines 9, 10, 11 for the RESET pin of our A4988

Then I leave a scheme chip connections:

As can be seen using the DIR pin Arduino PWM outputs, and others simply use normal outlets, so it is not mandatory to follow this scheme but simply connect the PWM DIR and others where you want.

Optionally we can put a fan or heatsink to chips because if the engine is more than 1 Amp the A4988 chip gets hot and can burn. For engines less than 1 Amp this is not necessary.

Step 11: Software and Operation

First I will explain the operation of this.

We make a 2D drawing or a 3D object using a software design, vector in the case of 2D drawings, as Inkscape or 3D such as Blender.

Once we have what we want the machine to machine, we had another program from the drawing creates a code called G Code, which has all the instructions for the machine moves to the right coordinates to create the figure or taxed or PCB or whatever you to be modeled.

The third step is to send the code to the machine, ie send from your computer to Arduino, which interprets thanks to the Firmware that carries within and moves engines properly. To do a program called Txapu CNC and explain its operation is used.

Lets start with the tutorial explaining how to create the G code through a .svg file previously created in Inkscape (.svg file creation is irrelevant in this tutorial youtube but there are thousands of examples of how to draw with Inkscape) as you can make drawing with Corel Draw or Adobe Flash or any program that allows the vector design.

The program that we use is PyCam, free and available for Windows and Linux. This software allows us to spend all our 2D drawings and 3D models G code Very intuitive and simple and also has a 3D viewer for real-time simulations of our models.

Let's make a brief introduction of how to use it:

Pycam Download Link: (For beginners download and run only the first file)

To open .svg files must be installed two programs, Inkscape and Pstoedit

Link Inkscape:

Link to Pstoedit:

The first is to open a new file:

Then select the Task tab and select the desired options, in my case I want to tax in a table the text shown on the screen so I select "Gravure"

Now chop "Generate Toolpaths" and hope to finish.
When everything is ready go to the "Toolpaths" tab and there "Export all" and keep the G code generated where we want to save it.

Now we open the file with Txapu CNC G code.

Now to send the code you just created our CNC.

To do Txapu CNC'll use a program that is only available for Linux, so as I said earlier you ought to install it, I recommend Ubuntu as it is the distribution of Linux easier to use and more followers. Install Ubuntu is simple and again on Youtube there are thousands of tutorials.

Link to download Txapu CNC

Once you send the file Txapu CNC CNC start working with him.

Step 12: Program Arduino

In this final section we will see how to program Arduino, so that interpret the G code that sends the computer and move the stepper motors.

Arduino must carry within it a Firmware, which as I mentioned, acts as an interpreter of G. Code This firmware can be downloaded from this link

and now we will see how to program to suit the needs of our machine such as speed, measures acceleration ...

Proceed to see how to program the microcontroller:

Well, once downloaded the firmware that I have left on the link, you ought to open it with the Arduino, which is downloaded from here

if what ye have not already installed.

To open the downloaded firmware, open from Arduino IDE file with this name: "reprap_new_firmware" All other files automatically open when you open this.

As you will see the files are distributed each in a tab.

We only modify data in two of them, one tab "rsteppercontroller" in which we modify the Bitrate. In the picture we see the yellow which is the part that must change, and if the value is different from 19200 to 19200 you must change it.

Now for the INIT tab and it will speed changes, steps per revolution and output Arduino digital pins.

Setting steps per millimeter

What does this mean ?, they are the necessary amount of steps you should take the step by step so that the threaded rod engine speed 1 mm. This is characteristic of each rod and hence you must measure. Do turn the rod and gives METER few laps to move 1 mm. The part of the image you see yellow is what must change. The value to be set is the number of turns of the rod multiplied by 200 that are the steps the engine around.

Note: 2 values, one for steps per inch and the other for millimeter steps are observed. Inches can leave them as is, because they will not influence the code.


Now let's look at feedrates, ie, the "speed" with which the A4988 alimetarán engines. This is adjusted depending on the engine, motors and engines need 100 need 1000, in my case, the engines need between 90 and 250, depending on the speed at which the motors rotate QUEREIS.

How to check which one is right Feedrate for your engine?

With CNC Txapu you test to spin the motors using the manual control, varying slowly Feedrate in TxapuCNC, if the engine makes a noise like a jet airplane, you are going through a lot with the Feedrate, I bajadlo !!!. If the engine sounds like a ratchet, is not enough, I upload it !!!.


In this part of the programming of the chip, we will assign Arduino digital pins to the pins of the A4988. All this is as simple as writing the Arduino pin number you want to assign to the pin of the chip.

For example, X_STEP_PIN is pin A4988 Chip STEP controlling the motor axis X, then assign the Arduino pin number corresponding to this pin, for example 4, but can assign you want, keeping in mind that PWD pins are for DIR pins of the A4988.

Extruders pins

In these last lines of code, assign contacts to an extruder, if we use one, since this tutorial is geared to using a milling machine, but also the user can decide whether to place an extruder instead of a router and So this is part of the code, so definais the pins corresponding to the extruder. (As I said before, in case you want to add a).

With all this, and with great sorrow, here, just the tutorial "How to make a homemade CNC milling machine 3 axis"

Tools Contest

Participated in the
Tools Contest

CNC Challenge

Participated in the
CNC Challenge

Be the First to Share


    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge
    • Block Code Contest

      Block Code Contest
    • Baking Contest

      Baking Contest



    5 years ago

    you can just by looking at it the x axis right crooked


    7 years ago on Introduction

    I was wondering it you could a arduino for this project.

    apaar dua
    apaar dua

    7 years ago

    Can you upload a working video of your mode please?