News    The Project    Technology    RoboSpatium    Contribute    Subject index    Download    Responses    Games    Gadgets    Contact   

<<< CNC v1.0         CNC v2.1 >>>

CNC v2.0

The video about CNC v2.0

Version 2

CNC router V2.0
Figure 1:
Time to overhaul my first CNC machine. Hardware revision number 2 should become more compact, because I never used more than a quarter of the 100cm x 200cm working area of the previous machine. A more simple construction and using simple DC motors instead of the stepper motors were also part of the new specification sheet.
The result is a machine with a base plate of the dimensions 80x80cm with a working area of approximately 50x50cm, that is controlled through an USB interface.
Materials for CNC router V2.0
Figure 2:
Besides other parts I used some ball bearings, threaded bars as well as aluminum and iron bars and tubes to built the machine.
Tools used to build CNC router V2.0
Figure 3:
The main tools used are a drill press, a vice, a metal saw, some file tools, wrenches and a set of 6mm taps.

Parts list

Component Number Remark
Arduino Uno 1 ca. 25,-€
H bridges 4 There are 2 of them on one board using an L298N dual bridge IC. ca. 15,-€ per board.
Geared DC motors 4 ca. 20,-€ per Motor
For more details see pictures below.
Photo sensors
V69435 / TCST 2103
V69735 / TCST 2103
8 Below 2,-€ each
Ball bearings 10mm hole, 30mm in total 20 ca. 30,-€ in total
Ball bearings 6mm hole, 12mm in total 6 ca. 10,-€ in total
Threaded bars 10mm x 1m 5  
Threaded bars 6mm x 1m 4 Drive
Wooden plate 80x80cm 1  
Aluminum angle profile 40x40mmx1000mm, 2mm thickness 1 Upper guide of Y axis
Aluminum angle profile 20x20mmx1000mm, 1mm thickness 2 Linear gudes at the base plate
Iron angle profile 40x40mmx2000mm, 4mm thickness 1  
Iron square tube 25x25mmx1000mm, 1mm thickness 1 Carriages
Iron square tube 20x20mmx1000mm, 1mm thickness 1 Linear guide for Y axis
Round iron tube with 10mm inner diameter, 1m long 1 Guidance Z axis.
Flat iron bar 20x4mmx1000mm 4  
10mm nuts Many  
Sheet iron 50x50cm, 1mm thickness 1 Sensor disc etc.
Small parts like iron angle joints, screws etc. ?  
Total costs approximately 250,-€


Cutting iron square tubes
Figure 4:
You can cut the iron bars by using an angle joint as guide for the saw.
Cooling the sawing blade with some water extends the lifespan of that tool.
Drilling a hole through the edges of a quare tube
Figure 5:
At the construction shown here, some drill holes are done on the edges of the square tubes. In order to make those holes I am using two aluminum angles on a wooden plate as guide for the iron tube. With a second wooden plate the construction is attached to the drill press. The edge of the iron square tube is filed and the place for the drill hole is marked with a center punch.
The drilling is done in three steps, starting with a 3mm drill, than 6mm and finally 10mm.
Cutting a thread with tappers
Figure 6:
The axes are driven through 6mm threaded bars. We need some 10mm bolts with a 6mm thread at one end. To get that, the 10mm bolt has to be filed flat on two opposite sides. Now, a 5mm hole is drilled. Counterbore the hole with a 6mm drill.
The threat is cut next. 3 taps are needed. The first cut is done with the tapper tap, usually marked with one ring at the shaft. Put some lubricant on the tool. Assure that the tap is aligned perpendicularly. After turning the tap clockwise for some degrees, turn it counterclockwise to break the chip formed through the cutting process, thus to prevent the tool from jamming.
The second run is done with the intermediate tap, marked with two rings at the shaft and finally the third run is done with the bottoming tap, usually marked with no ring, sometimes with three rings at the shaft.
Now, a 6mm bolt should easily fit into the hole.
Tip from 'Schnipp':
Take a M10 nut,and screw it on the Bolt where you want the hole. Put it in a vise,so that one of the nut's surface is in a 90°(shows up) position. Then you easyly mark it with a center punch right in the middle of nut's surface and bore right throu both together.You also have to cut the Tap in the same way. After loosen the nut,you have your die exactly in the center of the bolt and nothing to file.
You also can after that bore the oil hole,just turn 90°

Cutting a thread with a drill press
Figure 7:
The alignment of the taps becomes simple when replacing the drill bit by the tap after drilling and counterboring the hole. Unplug the drill press and turn the chuck by hand (e.g. at the pulley) or else your tap will be destroyed in seconds! Don't forget to periodically turn the chuck clockwise and counterclockwise and to put some lubricant on the tool.
This assures right angle threads without relying on my wobbly hands and bad eye for perpendicular work (that's what Fred wrote me - thanks for that tip!).


Base plate of CNC router V2.0
Figure 8:
The base plate with the dimensions 80x80cm is cut from an old table tennis table with two aluminum bars at two edges. At one edge the aluminum angle profile is fastened with the tip pointing to the top while it is fastened with the flat side at the opposite edge of the base plate.
Materials for CNC router V2.0
Figure 9:
Four ball bearings are attached to a 20cm piece of a square tube. The 10mm holes are drilled with a distance of 1.5cm respectively 3.5cm from the ends. The drill hole at the edge of the square tube with the 50cm threaded bar is 5.5cm away from the left end. The 4mm drill hole used to fasten the cross bar is 1.0cm away from the right end.
Ball bearings of CNC router V2.0
Figure 10:
The inner diameter of the ball bearings is 10mm, the outer diameter should be clearly larger - I am using bearings with 30mm in total. The iron square tube has an edge length of 25mm - at least a 10mm nut must fit to the inside. The drill hole for the ball bearings should be close to the lower edge of the tube. Consider that the 10mm nut is used at the inside of the tube, thus the hole should not be too close to the lower edge. The outer diameter of the ball bearings must be clearly below the edge of the iron tube.
Mounting the ball bearings of CNC router V2.0
Figure 11:
There must be an offset between the drill holes at two sides of the tube, because the bolts and nuts used to mount the ball bearings should not get in touch.
Mount ball bearings with space
Figure 12:
Note that the space between the square tube and the ball bearings must be large enough so that the bearings don't touch the screws used to mount the linear guide on the base plate.
X carriage of CNC router V2.0
Figure 13:
The second half of the X carriage.
X carriage of CNC router V2.0
Figure 14:
Both halves are connected through a compound made of a 85cm long angle profile with an edge length of 40mm and a thickness of 4mm and a square tube of the dimensions 20x20cm.
X carriage of CNC router V2.0
Figure 15:

X carriage of CNC router V2.0
Figure 16:
The corner steel bar is touching the first half of the carriage...
X carriage of CNC router V2.0
Figure 17:
...while the height is adjustable at the second half.
Y carriage of CNC router V2.0
Figure 18:
The Y carriage is also based on a 20cm long piece of a square tube with an edge length of 25mm:
The drill holes for the ball bearings are 1.5cm respectively 3.5cm away from the ends.
The drill hole for the 10mm bolt with the 6mm thread used for the drive is at the center of the square tube.
Y carriage of CNC router V2.0
Figure 19:
The main components of that carriage are some 37cm long threaded bars with a diameter of 10mm being connected through flat iron bars.
Y carriage of CNC router V2.0
Figure 19:
Assemble the structural component in such a way that there is a space of 4 to 5cm between the base plate and the lower edge of the Y carriage.
Y carriage of CNC router V2.0
Figure 20:
The iron tubes at the front of the Y carriage (bottom of the photo) must fall in line.
Y carriage of CNC router V2.0
Figure 21:

Y carriage of CNC router V2.0
Figure 22:

Y carriage of CNC router V2.0
Figure 23:
The carriage is guided by an aluminum angle profile with an edge length of 40mm and two more ball bearings at the top of the construction. The movement along the X and Y axis must be smoothly and free from clearance.
Z carriage of CNC router V2.0
Figure 24:
The Z axis is guided by ball bearings running on round tubes. That carriage is based on two pieces of 40x40x2mm aluminum angle profile with a length of 26cm.
Z carriage of CNC router V2.0
Figure 25:
With the slot at one end of the flat iron bars (top of the photo) the width between the ball bearings can be adjusted to minimize the clearance.
Z carriage of CNC router V2.0
Figure 26:

Z carriage of CNC router V2.0
Figure 27:

Z carriage of CNC router V2.0
Figure 28:

Drive of CNC router V2.0
Figure 29:
The 6mm threated bars with a length of 85cm are mounted next.
The diameter of the sensor disc is 7cm.
Drive of CNC router V2.0
Figure 30:
One fastening point consists of two iron angle joints. The treaded bar is mounted using four nuts and two ball bearings with an inner diameter of 6mm.
Drive of CNC router V2.0
Figure 31:
One ball bearing is to the left and one to the right of the joint. Tight the third nut so that both ball bearings are pressed against the angle joint. The higher the torque used to tighten the nut, the more friction, thus it becomes harder to turn the treaded bar. If you have found the right adjustment, lock that nut with nut number four. That end of the threaded bar should be free from clearance.
Drive of CNC router V2.0
Figure 32:
Those ball bearings are attached to an aluminum angle profile at the Y axis.
Drive of CNC router V2.0
Figure 33:
The sensor disk and the drive are at the opposite end of the treaded bar. The geared motor is connected to the threaded bar through a piece of rubber tube (fuel pipe with an inner diameter of 5mm). Thus, that connection is flexible. Threaded bars from the do-it-yourself store are usually not dead straight, thus with the flexible link the drive runs smoothly even with a buckled bar.
Drive of CNC router V2.0
Figure 34:

Antrieb der CNC Maschine V2.0
Figure 35:
Technical data of the brushed DC motors:
Diameter: 37mm
Shaft diameter: 6mm
Operating voltage: 12V
Idle speed: 200U/min
Torque: 60Ncm
Gear ratio: 30:1
Maximum current 2A

Antrieb der CNC Maschine V2.0
Figure 36:

Antrieb der CNC Maschine V2.0
Figure 37:

Drive of CNC router V2.0
Figure 38:
The threaded bar for the drive of the Z axis is only connected with the geared motor. It's gravity that pulls that carriage downwards by what the the clearance of that drive is negligible.
Drive of CNC router V2.0
Figure 39:
The carriages are connected to the drive through the 6mm threads in the 10mm bolts. If that thread is adjusted straightaway, the drive runs smoothly, but there is a noticeable clearance. By turning the 10mm bolt slightly, the friction is increasing, but the clearance is lowered. Adjusting the drive is always a compromise between friction and clearance.
To reduce friction, put some lubricant on the threaded bar.
CNC router V2.0
Figure 40:
Two bars are used to stiffen the construction...
CNC router V2.0
Figure 41: both ends of the X carriage.
CNC machine V2.0
Figure 42:
The machine was built to work as CNC router.
CNC machine V2.0 as plotter
Figure 43:
When attaching a ball pen or a marker at the Z carriage, the machine can also be used as plotter. Caused by the low speed (less than 3mm per second), that machine is not a fast printer...
CNC machine V2.0 as engraving machine
Figure 44:
When adjusting the router in a tilted position with thin, flexible 3mm threaded bars, you can engrave patterns on a glass plate using a diamond milling cutter.
CNC machine V2.0 cutting styrofoam
Figure 45:
With a 1mm copper wire at the tip of a soldering iron you can cut Styrofoam.
Srdjan gave me a tip:
You can add a tiny fan near the tip of the cutting wire that blows away the hot air which makes the cut more consistent.


Accuracy of CNC machine V2.0
Figure 46:
Test plot with a ball pen. Overlay with a foil printed by an inkjet (red dotted lines).
Accuracy of CNC machine V2.0
Figure 47:
Cutting 4mm acrylic plastic in two steps. Pattern at the "hard" end of the X and Y axis...
Accuracy of CNC machine V2.0
Figure 48:
...pattern at the "felxible" end of the X and Y axis.
Accuracy of CNC machine V2.0
Figure 49:
Cutting 0.8mm aluminum plate.
Compressed air can be used to remove the chips and so to clean the CNC machine after usage.
Tip from Matt:
If you don't have a compressed air line, a dry (or paraffin wet) paintbrush works well for cleaning the crud out of threads.


Electronics of CNC machine V2.0
Figure 50:
The gear ratio of the DC motors is 30:1 and the maximum current running through the windings is 1.2A at 12V operating voltage.
Electronics of CNC machine V2.0
Figure 51:
The motors are controlled through 4 H bridges - each of the two boards used here has two bridges using a L298N IC. The control pulses are generated by an Arduino Uno which computes the current position of the motors via the 8 photo sensors. I have demonstrated that principle in detail in the chapter about the Arduino Uno microcontroller.
A relay, controlled though a small signal transistor by the Arduino is used to switch the router.
Electronics of CNC machine V2.0
Figure 52:
After connecting the electronics, you should start the motors by software for the first run carefully (one after the other). If one of the motors starts spinning continuously, you must swap the terminals at the accordant H bridge.


Software for CNC machine V2.0
Figure 53:
The software used to control the machine is written in C and it is running from the command line. With the menu you can choose the test pattern and set some variables.

The supported vector format is "Scalable Vector Graphics (*.svg)" with some special things to note:
No areas are drawn, only their outlines. All paths (also the outlines of an area) must be set to "Polygon". I have tested the functionality with graphics edited and exported as svg by Libre Office Draw:
1.) Draw graphics witth LibreOffice Draw.
2.) Press Strg + 'A' to mark all objects.
3.) Click on "Modify -> Convert -> To Polygon".
4.) Set line attributes to "Continuous" and to black color.
5.) Set Filling to "Invisible".
6.) Export as *.svg
7.) Copy the file to the subdirectory "pictures" in the installation folder of the CNC software.

You can get the source code with some example vector files at the Download section.

Frequently Asked Questions (FAQ)

Question: How can I upload the Arduino sketch?
Answer: Install the Arduino IDE by opening a terminal window (Alt + 'T') and typing the commands:
sudo apt-get update
sudo apt-get install arduino
Now, the Arduino sketch (*.ino) of the download package should open in the IDE automatically if you click on the *.ino file (in Ubuntu 14.04LTS it does). That IDE sometimes also opens the file "commands-CNC.c" in another tab of the window. Close that tab before compilling the software!
In the dropdown menue click on "File -> Upload" to compile and upload the sketch.
Question: How can I find out if the photo sensors are installed correctly?
1.) Disconnect the 12V cable running from the power supply to the H bridges.
2.) Turn on power supply of the CNC and the Arduino (USB).
3.) Turn all sensor discs in such a way that the infrared light is blocked (metal tooth covering BOTH photo sensors).
4.) Use a multimeter to record the voltages between gound (minus) and the sensor pins (10, 11, 12, 13, A2, A3, A4, A5) at the Arduino board. The voltage must be above 3V.
5.) Turn all sensor discs in such a way that the infrared light passes the photo sensor (gap between BOTH sensors).
4.) Record the voltages between ground (minus) and the sensor pins at the Arduino board again. The voltage must be below 0.5V.
5.) If all voltages are correct, turn off the power supply and reconnect the 12V line to the H bridges.

If you can't detect the voltages as described above, you must check all connections of the faulty photor sensors!
Question: How can I check if all motors are running correctly?
Answer: After starting "commands-CNC", you can control the motors with the cursor keys.
Cursor left/right moves the motors of the X axis for one step.
Cursor up/down moves the motor of the Y axis for one step.
Page up/down moves the motor of the Z axis for one step.
You can select a larger number of steps per key press with the 'm' key (from 1 to 1000).
Question: If I try to move a motor for one step with the cursor keys, it starts spinning continuously.
Answer: The direction of rotation may be wrong. Swap the cables running from the H bridge to the faulty motor.
Answer 2: Check if the photo sensor work correctly (see above).
Question: The two motors of the X axis spin in different directions.
Answer: Change the direction of rotation of one motor by swapping the cables running from the H bridge to the motor AND the cables of the photo sensors at that motor.
Question: The plot is mirror inverted.
Answer: You must change the direction of movement along that axis. To do so you have to swap the cables running from the H bridge to the motor AND the cables of the photo sensors at that motor. If the plot is mirror inverted along the X axis, you must change the direction of movement for both motors.
Question: How can I install the software?
Answer: Read "readme.txt" in the download package. The software runs under Linux (tested with Ubuntu 12.04LTS and 14.04LTS).
You should know how to upload a sketch to the Arduino. Instructions are available on the Arduino page
Question: I get the message: "Waiting for 'X' from Arduino (Arduino pluged in?)..." when I start "commands-CNC", but nothing happens.
Answer: You must be a member of the 'dialout' group. Open a terminal window and type:
sudo adduser [your username] dialout
replace [your username] with the name of your accout. Yo can get that name by typing:
Question: I get the message: "Waiting for 'X' from Arduino (Arduino pluged in?)..." when I start "commands-CNC", even after adding my user account to the 'dialout' group.
Answer: The name of the USB interface can be "/dev/ttyUSB0" or "/dev/ttyACM0". To get the name of your Arduino on your computer do the following:
1.) Disconnect your Arduino from the USB port.
2.) Open a terminal window (Alt + 'T') and typr the command
ls /dev
Now, all connected devices are listed (it's usually a long list).
3.) Connect your Arduino to the USB port.
In the terminal window type
ls /dev
again. Now there should appear one more device. That's the name of your Arduino. Find that additional device in the list.
If the name is "/dev/ttyACM0", there is nothing to be done. If the name is "/dev/ttyUSB0", you have to adapt the source code.
Change the two lines in the source code of "commands-CNC" and recompile:
//#define ARDUINOPORT "/dev/ttyUSB0"
#define ARDUINOPORT "/dev/ttyACM0"
Change to:
#define ARDUINOPORT "/dev/ttyUSB0"
//#define ARDUINOPORT "/dev/ttyACM0"
Question: Can I use motors other than described in this documentation?
Answer: Yes. They should have a torque of at least 60Ncm and a revolution speed of 100rpm or more. If you use several types of motors for your build and if they need different operating voltages, you must use separate H bridges for each voltage. The slowest motor rules the total speed of the CNC.
Question: How can I stop the machine quickly in case something goes wrong?
Answer: There is a tiny push button on the Arduino board. That switch resets the microcontroller, thus all motors should stop immediately.
After that you can quit "commands-CNC" by pressing 'Esc' or 'Ctrl + C'.
If your power supply has a power button, you can stop the machine by cutting off the supply line. As soon as you turn the power on again, the machine continues working.
You can also stop the running process by pressing the 'Esc' key. The machine stops, lifts the router and drives back to the point of origin.
Question: What type of photo sensor can I use?
Answer: All transmissive photo sensors (I did not test reflective types). Have a look at the data sheet. If the current of the infrared diode is in the range of 25-50mA, you can use the circuit layout without changes. Otherwise you have to replace the 180Ω resistor to make the circuit fit the current through your infrared diode (remember the voltage is 5V). The resistor at the sensor must be in the range of 2-20kΩ.
Frage: Can I use a Raspberry Pi instead of the Arduino?
Antwort: No! You need a realtime operating system. All programs running on a Raspberry Pi are interrupted whenever there are other tasks to process (e.g. copying files or doing network communication or what ever). During those interruptions the state of the photo sensors at the sensor disc can't be read which is why steps will be skipped.
Question: I still have an unanswered question!
Answer: If your machine doesn't operate as expected, send a mail to including an EXACT description of what goes wrong! Things like "the LED is lighted up" (what LED?!?) or "nothing happens" are totally useless to me! There is always something happening and if you get messages from a program, they are meant to be read!!! Furthermore you should describe what you have tried to solve that problem. Making a photo or a short video and attaching it to the mail is a good idea since I don't stand next to you and can't see what happens. Don't write a novel, but I expect more than four or five sentences!
A good question is half the answer and the quicker I can determine your problem, the quicker I can go back to my work on this project!
Use the comment functionality only for very small problems or suggests for improvements. There is no need to type your mail address in the comment section! If you expect to get an answer by mail, you have to send me a mail first.

<<< CNC v1.0         CNC v2.1 >>>

News    The Project    Technology    RoboSpatium    Contribute    Subject index    Archives    Download    Responses    Games    Links    Gadgets    Contact    Imprint   

Twitter YouTube Hackaday Patreon TPO