Introduction: 3D Printed Desktop CNC Mill
Welcome to this project. The CNC UNO is a small desktop CNC Mill that can be used for hobby engraving and routing, PCB milling and education. It is mainly made with 3D Printed ABS plastic parts and plywood. Before starting this project, please observe that this machine is not intended for precision work nor for cutting hard materials like metal. As the machine parts are made of plastic and wood, the machine will flex under heavy load and that is why this project is for fun rather than any serious application. That said, it is a great little machine for hobbyists that want something to play with without having to spend a fortune.
Also, remember that this will not be a 100% exact description of every little detail of the project, although I will try to explain as much as I can. You will probably have to improvise a little here and there. Read through the project before starting and make sure you feel comfortable with the steps described.
Let me know if you want me to add more pictures and steps.
Step 1: What Will You Need?
Here is a list of things you will need to get for the project. I have provided links to where I got the parts.
- Access to a 3D printer and ABS filament
- A sheet of 8.7 mm (11/32 inch) thick plywood
- Lots of small screws and nuts (M2 and M3 or similar)
- 2 Nema 17 Stepper motors (Link)
- 1 JKM 42 Stepper motor (Link)
- A 12V DC motor (Link)
- A chuck (Link)
- 8 mm Linear Rail Rod (Link)
- Set of bearings (Link)
- Brass copper nut JKM 42 (Link)
- Set of L298 stepper motor drivers (Link)
- Timing belts and pulleys (Link)
- An Arduino Mega 2560
- STL Files for the 3D printed parts (Link to Thingiverse)
For the electronics you need:
- Lots of thin cables in different colors
- A soldering iron
- A PC power supply or similar to drive the spindle and the steppers
- A potentiometer (10 K)
- A rotary encoder (Link)
- A Joystick module (Link)
- Some push buttons
- 1 red, 1 green and 1 yellow LED
- 1 Nokia 5110 LCD (Link)
- 3 micro switches
- A diode, an electrolytic 220uF capacitor, a 10nF disk capacitor, some resistors and a 30N06L MOSFET
- Optional: SD Card Module (Link)
- Cooling Fan (Link)
Skills needed for the project:
- Soldering skills
- 3D printing skills
- It will help if you have some basic skills in Arduino programming
- Basic knowledge of electronics
Step 2: Let's Get Started!
This is the model I made in Rhino 3D when planning the project. I wanted a small and light milling machine that I could play with on my desktop.
Mark the pieces on the plywood and cut them out. The drawing is in millimeters.
Step 3: Glue the Pieces
I cut two pieces of the bottom sides of the frame and glued them together for better stiffness.
I also clamped side pieces together and cut them at the same time to make them as similar as possible.
You can also use nails and screws in combination with the glue.
Step 4: Make the Table
Now, cut out the table and the back plate for the Z axis.
Table size is 25.7 x 24.4 mm.
Back plate size is 80 x 140 mm.
Step 5: Print and Assemble the Plastic Parts
Now when you have the frame ready, print out all the plastic parts and put them together. Use the frame as a reference and cut the steel rods for the X and Y and Z axis to the correct length. Be careful not to cut them too short. It is better to cut them long first and then test with the brackets and the frame, and if they are too long, cut them a bit more. On my machine, I got these lengths (more or less): X-axis 350 mm, Y axis 250 mm and Z axis 120 mm.
Also, test out the length of the X and Y axis timing belts. They should be fairly stretched and you can use the spring from a clothes peg as a tensioner.
On the picture, I had mounted the first motor I used. It later turned out to be too weak so it has been replaced with a bigger motor.
Clamp the parts to the frame and mark and drill all the holes for the mounting screws.
Step 6: Paint the Frame
Sand the frame and paint it. Yes, it has to be silver, otherwise the machine will not work ;)
It is probably a good idea to paint it with a protective coat of clear lacquer as well.
Step 7: Mount and Test End Switches
Assemble the machine. Put cables together with zip ties and try to keep things as neat as possible.
Mount the end switches and test that they click as they should when you move the axis to the stops.
Step 8: Make the Controller
The controller is a whole little project by itself. You can decide to use another box, skip the LCD etc. It is up to you. This is what I did:
I printed out the controller case and mounted the rotary encoder, the joystick, the potentiometer, the LCD, some LEDs, and buttons at the faceplate. Inside I mounted the Arduino Mega, the stepper drivers and a little homemade spindle driver.
I used hot glue, superglue, and screws to hold things in place. I also soldered the buttons to a small piece of perfboard and 3D printed some standoffs that I glued to the back side of the panel so the modules could be screwed into place. If you have different sized buttons and knobs, you may want to design your own front panel instead.
Step 9: Electronics
See tables for how I connected the pins to the Arduino.
You will need to solder all ground pins to the ground pin and all Vcc to the +5 Volt pin of the Arduino.
In series with each LED, you will need to solder a current limiting resistor. Other than that, soldering all these pins should be pretty straightforward.
EDIT: Please note that pin 51,53 on the table has changed to pin 27,29. After having some problems with the serial communication while starting the spindle motor I decided to add a SD card reader module. It uses pin 50 to 53. I recommend anyone to add this too. It makes the machine stand-alone and more convenient to use.
Step 10: The Spindle Motor Driver
For the spindle motor driver, I used a 30N06L MOSFET to switch the power. This is how it is connected.
I soldered the MOSFET, the diode and the resistor to a little perfboard and added a small heat sink to protect the MOSFET from overheating.
Directly on the motor connectors, solder the 2 capacitors to filter out noise from the motor.
Step 11: Stepper Drivers
Then connect the 12V from the PC power supply to each +12V connection of the L298N motor driver boards.
On Output A and Output B you connect the leads for each stepper. You have to play around a little with the leads to see which goes where. After some trial and error, the motor will go in the correct direction. Use the joystick on the controller to test the direction of each motor and switch the cables around until it works as it should.
Note! I have noticed that the drivers get pretty hot when running the machine for longer times. I suggest adding a fan to the controller box to keep things cool.
Step 12: Finish the Project
Paint the controller and screw/glue it together. Use screws for the front panel so you can open it to do modifications later.
Connect the Arduino to the PC and program it with the sketch that you can download from here.
Test the entire functionality of the controller and make sure the motors go in the correct direction. Check that all buttons, LEDs and knobs do what they are supposed to do; see the controller manual below.
When testing the machine, use very low feed rates (F100 or lower) and do not go deep! The CNC UNO will work with small mills and drills only and they can easily break. Also, by using low feed rates and shallow depths, you put less strain on the machine, avoiding the occurrence of flexing and bending.
I suggest testing it out with small pieces of plywood or similar soft material.
The firmware is a Beta and it is meant to be improved, by me or by others. It has a very limited set of G- and M-codes and basic functionality only. I see many ways in which this project can be improved. For example, one could use inexpensive 3D printer stepper motor controllers, and use micro stepping of the motors for smoother and quieter operation. The controller would gain from having an SD card reader where one could store CNC programs, just like many 3D printers have (EDIT: it has been added now). The spindle motor output should be PWM (Pulse With Modulation) to be able to control the RPMs. WIFI could be added. The list goes on...
Feel free to improve it and add features, and send it to me so it can be shared with others.
Step 13: Controller Manual
When the controller turns on or when it resets, it automatically homes all axes. Once in a home position, the display will show its X, Y and Z axis positions and the current feed rate. At the bottom of the screen, there is a menu controlled by the three buttons below the LCD. The right-most button browses the menu.
HOME SPNDL >
HOME will home all axes to their end point breaker position.
SPNDL will start and stop the spindle.
ZERO JOGXY >
ZERO will tell the controller that the current position of the tool is the zero point.
JOGXY tells us that the joystick will control the jog motion in the X and Y axis. If you press it once, it will change to JOGXZ, changing the joystick to control the X and Z axis.
After an axis has been jogged with the joystick, the controller will remember it as the lasted jogged axis. Now the axis can be fine-jogged with the rotary encoder dial.
DEMO ABOUT >
DEMO will put the machine in a demonstration loop.
ABOUT will show the About screen and the firmware version number.
RUN PAUSE >
RUN will run the cnc program named RUN.CNC on the SD Card.
PAUSE will put the machine in block step mode.
Step 14: Run Programs
To run a CNC program on the machine, you send it via the serial port. The baud rate is 115200 baud.
You can send it with any terminal program that has the XON/ XOFF handshake protocol. Here I use the CNCSimulator Pro from CNCSimulator.com, as it is where I work when I am not at home building CNC machines :) Another communication setting that is important to use is a 100 ms delay between each block for the machine to be able to catch up.
On the picture, the Char delay is set to zero. I have now found out that a small value of 10 works better. You may have to play around with these values to avoid losing characters when sending from the PC.
Step 15: Software
We have added the CNC UNO machine as a virtual machine in the CNCSimulator software so one can simulate CNC programs before running them, to see that all is OK. This addition will be available when we release version 2.0 later this year.
Step 16: G- and M- Codes
Each line (or block) must have a G-code. In other words,they are not modal. All code letters must be written with capital letters.
G00 is fast transport moving all axis in full speed.
G01 is linear movements with programmed feed rate (F).
G02 is clockwise arc movements with programmed feed rate.
G03 is counter clockwise movements with programmed feed rate.
G04 is dwell.
G28 moves all axis to their maximum position.
G73 drills a hole.
M03 starts the spindle.
M04 also starts the spindle (we have no directional control yet).
M05 stops the spindle.
M01 puts the machine in pause mode.
F feed rate in mm/ minute.
G00 X0 Y0 Z0 (Go fast to X0 Y0 Z0)
G01 Z-10 F400 M03 (Go to Z-10 with a speed of 400 mm/min and start the spindle) G02 X40 Y0 I20 J0 (Do a half circle to X40 Y0 center in X20 Y0) G01 X50 (Go to X50 with programmed feed rate) M01 (Pause) G01 Y50 (Go to Y50) G01 X0 (Go to X0) G04 P1000 (Dwell one second) G00 Z10 (Go up to Z10) G00 X20 Y40 (Go to X20 Y40) G73 Z-10 Q3 F200 (Drill a hole to Z-20 with a step size of 3 mm and feedr. 200 mm/ min) M05 (Spindle stop) G28 (Move all axis to max)
Good luck building your own CNC UNO!
Step 17: A Video of the Machine in Action
This video shows the first version of the machine before I replaced the spindle motor for a much better one.