Introduction: Arduino Mini CNC Plotter Machine From Dvd Drives

In this project I will show you how to easily build your own low-cost Arduino Mini CNC Plotter!

This project is an update from my previous cnc, with better construction and with more accuracy.

I decided to make this detailed guide to help you make it on a few easy steps.

Small description:

For the X and Y axes we will use two stepper motors and rails from dvd/cd drives and for the Z axis we will use a small servo motor that moves the pen up and down. For the mounting base we will use a small piece of plexiglass.

You can easily attach a pen (or pencil) - irrespective of its thickness - on it. I tried to use an extension of cutting tool (e.g.Dremel) to engrave materials with no success. So this mini cnc can only be used as a small plotter and not as an engraver machine.

The Arduino-based circuit is using the ATmega328 microcontroller, two L293 motor driver ICs and an usb to serial module. You can easily make it with the Arduino uno board and an breadboard.

You can also use an Bluetooth module (e.g. HC-06) to print your texts (or images) wirelessly through your computer Bluetooth connection! Pretty cool huh?

Q & A and updates here: http://www.ardumotive.com/new-cnc-plotter.html

More cool Arduino projects can be found here: www.ardumotive.com

Watch presentation video below and proceed to next step!

Follow us on FB: https://www.facebook.com/ardumotive
Follow us on Twitter: https://twitter.com/ardumotive

YouTube channel

Step 1: What You Will Need

Tip: See the images above.

Visit and buy your hardware from www.gearbest.com

For the circuit you will need:

Part list for beginners:

  • Arduino uno
  • Breadboard
  • 2x L293D ICs Motor driver
  • Mini Servo Motor
  • 2x DVD/CD Drives

Part list for 'pro' :

  • ATmega328p (with Arduino Bootloader)*
  • 28 pin DIP IC Socket
  • 16MHz Crystal Oscillator
  • 2x 22pF and 1x 100nF capacitors
  • 10K resistor
  • USB to Serial adapter**
  • 2x L293D ICs
  • Mini Servo Motor
  • 2x DVD/CD Drives
  • Prototyping PCB Circuit Board Stripboard
  • 4x 2pins Screw Terminal Connector (or 2x 4 pins Screw Terminal Connector)***

*You will also need an Arduino UNO board to program the ATmega328 micro controller.

**USB to Serial adapter will allow the circuit to communicate with the computer through the USB cable, just like Arduino uno does.

***Why to use screw terminal connectors? Because you don't want to solder and desolder cables from stepper motors until you find the correct working combination!

For the mounting base:

  • One piece of plexiglass 20x16 cm (thickness 5mm) (for X axis)
  • Two pieces of plexiglass 14x4 cm (thickness 5mm) (for Y axis)
  • A few nut screws, nuts and shims (~20)
  • A few spacers
  • Four supporting angles (preferably plastic)

Instead of plexiglass you can also use wood, metal or parts from dissasembly cd/dvd drives

Tools:

  • Screwdriver
  • Soldering iron
  • Solder
  • Drill
  • Cutting tool (e.g. Dremel) (Optional for cutting plastic/plexiglass parts)
  • Glue

Step 2: Stepper Motors

First step to start building this cnc machine is to disassemble the dvd/cd drives and take off them the stepper motors. Use the screwdriver to open and take off them the rails (see 1st image above).

Now that we have the two stepper motors we need to solder some cables on them. Proceed with caution, see the 2nd image above. Now we need to find the correct combination to drive and use them correctly, so take a multimeter with alligator clips (3rd image) and put it on "short-circuit" function (4th image). Usually (5th image), the first and second cables are closing the circuit - the led is turned on and a beep sounds - this means that we have found the fist phase-motor of stepper motor. The other two cables, third and forth, uses the second phase-motor of stepper motor.

In my case, one of stepper motors uses the first and third cable for first phase-motor and the second and forth cable for second phase-motor.

Find the correct combination and proceed to next step.

Step 3: Mounting Base, X and Y Axes

Follow the steps below and see the images above:

For X axis:

Place one stepper motor (with rails) on a big plexiglass piece and mark it with a pen in order to open the (4) holes for the screws. Make sure that is perfectly align! (use a triangle ruler). Open the holes and mount the motor with nut screws.

Place on one side of it the four mounting angles and then mark it with a pen in order to open the (8) holes required for the screws. Make sure that the distance between them is 5mm (thickness of plexiglass). The second image above will help you to understand more.

For Y axis:

Place the other stepper motor on two plexiglass pieces and mark them with a pen in order to open the (4) holes for the screws. Again, make sure that the motor is perfectly align (use a triangle ruler).

Place the two pieces of plexiglass on the X axis (big plexiglass piece) and mark them with a pen in order to open the (4) holes required to fit on the mounting angles.

Complete the construction:

Open all holes and complete the construction (see the 3rd and 4th image above). As you can see I placed a metal surface on X axis to fit a note-paper sheet on it. A note-paper sheet usually has dimensions 75mm x 75mm, but remember that printing area is only 40mm x 40mm. Remember, all parts must be perfectly align with others, this is very important!

Step 4: Z Axis

That's the most difficult part of our construction.

You will need something to attach it on Y axis, a flat surface. On that surface you will attach the servo motor (Z axis) and the pen base. Pen (or pencil) must be able to move up and down with the help of servo motor. Watch the above image to understand what you need to do to build Z axis.

Tip: Use your imagination!

Step 5: The Circuit

Now that we have our contraction ready, it's time to build the circuit and test the stepper motors (X and Y axis).

Watch the above image with breadboard circuit schematic.

Steppers motors wiring is something that need patient. On the next step you will find a 'testing' code for x and y axes. If a stepper doesn't work properly you must find the correct working combination by changing the cables between them and the L293D ICs.

Power:

You will need more current than one usb port can give, so you must connect one more usb cable, see the 2nd image above. Connect only power cables (usually red and black) with the primary one. The voltage remains 5V, but you have doubled the current! (from wiki: max. current of USB 2.0: 0.5 A and of USB 3.0 & 3.1: 0.9 A).

Note: If you want to use a different hardware (e.g. motor shield, stepper driver IC) you have to make changes on the above circuit and on the Arduino code. Sorry but I can't help you, search the web to find more info about your hardware. This guide is made for L293D IC motor driver.

Step 6: Testing Stepper Motors - X and Y Axes

Here is the testing code for X and Y axss, embedded using Codebender!

Codebender is an online Arduino IDE - It's the easiest way to program your Arduino board directly from your browser! Just click on the "Run on Arduino" button and that's it! Try it! It's really amazing!

For X axis:

You have to see the X axis motor moves from front to back side (see the image above with black arrow).

For Y axis:

You have to see the Y axis motor moves from left to right side (red arrow).

Step 7: The CNC Code

Here is the main CNC code, embedded using Codebender!

In this part you will see your pen goes up. If don't, change penUp and penDown variables that controlling the servo motor (just click on the "Edit" button).

Press the "Run on Arduino" button to program your Arduino board from your browser!

Step 8: The GCTRL Program

Now we are ready to print our first image! To do this we will use the gctrl.pde processing program. This program sends 'gcode' images to the cnc plotter.

What is gcode? Gcode is a file with X,Y and Z coordinates. Header of this file is set to:

M300 S30.00 (Servo down)

G1 X10.00 Y10.00 F2500.00

G1 X20.00 Y10.00 F2500.00

M300 S50.00 (Servo up)

  • Download the Processing from here, and then download and open the GCTRL.pde application.
  • Click the "play" icon/button to start the program.

------------------------------------------------------------------------------------

Update! You can use gctrl.exe, find files on 'gctrl exe for windows.zip' file.

------------------------------------------------------------------------------------

~Watch the above image~

  • Now press 'p' and select your Arduino serial port.
  • Press 'g' and select the 'TEXT.gcode' or 'gear.gcode' file

(If something goes wrong, press 'x' to stop the plotter and try again)

Step 9: How to Make Your Own Gcode Files

To make gcode files that are compatible with this cnc machine you have to use the Inkscape.

Inkscape is professional quality vector graphics software which runs on Windows, Mac OS X and Linux. It is used by design professionals and hobbyists worldwide, for creating a wide variety of graphics such as illustrations, icons, logos, diagrams, maps and web graphics. Inkscape uses the W3C open standard SVG (Scalable Vector Graphics) as its native format, and is free and open-source software. Download and install Inkscape from here (Important: download 0.48.5 version)

Now you need to install an Add-on that enables the export images to gcode files. This add on can be found here with installation notes.


Setup Inkscape for first use

Open the Inkscape, go to File menu and click "Document Properties". See the 1st image above and make the changes, make sure to change first to "cm". Now close this window. We will use the area within 4 to 8 cm. See the 2nd image above.

How to print texts


Put text, if you want you can change font and size. Now click on cursor icon and center the text like the 3rd image above. Select Path from menu and "Object to Path".

How to print images


This is more difficult than texts. Images must have a transparent background. Drag and drop your image in Inkscape. Click ok to the next window. Now you have to re-size the image to fit the printing area, see the 4th image above. Click Path from menu and "Trace Bitmap". Make changes as the 5th image above. Click ok and close the window. Now, move the gray scale image, and delete the color one behind it. Move the grey image to the correct place again and click from Path menu "Object to path". The 6th image above show how to delete image outline.

Export as gcode file

Final, go to file menu, click save as and select .gcode. Click 'ok' on next window and that's it! Ready to go! Use the gctrl.pde (or .exe) app to print the gcode file on your new Arduino CNC Plotter!

Step 10: Well Done!

You have successfully completed this tutorial and you have your own Arduino mini CNC Plotter!!!

I hope you liked this, let me know in the comments, I would like to see photos of your CNC machines!