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


  • 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.


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!

<p>Hi,</p><p>My servo motor (Z axis) runs but DVD stepper motors (X and Y axis) don't run. what i need to do?</p>
<p>Thank's to this explain </p>
<p>Hi</p><p>Is gctrl compatible with Windows 10, I did run it a couple of times, cannot do any selections, pressing &quot;p&quot; or &quot;g&quot; button does not work. Your help is much appreciated.</p>
<p>Hello everyone!</p><p>First, big thank you to an author of this tutorial. I can't believe I completed it, but on the other hand, I am proud of myself. I came across a lot of problems, but every time I solved one, I learned new things. I also learned how do CNC machines work and I got into the robotics. After completing this project I will be probably trying to make a CNC laser cutting machine. My version of the machine, shown in pictures, works pretty nice. I wasn't expecting that, but it is pretty accurate (but less than the author's one, judging by attached video). Some things could be done in better way, but I am still happy with what I have :)</p><p>BIG, BIG and once again BIG THANK YOU to the author and sorry for mistakes in language :)</p>
<p>Got the steppers up and running with gcode but the servo for the z-axis doesn't move, only makes different noises when penUp or penDown reads. Any suggestions?</p>
<p>power your circuit from external source. USB terminal not provides enough current that may drive 3 motors together.</p>
<p>i have a problem</p>
Hi,<br>Can i use an adruino nano instead of adruino uno???
<p>Hi,</p><p>Can you please tell me how to connect Bluetooth module hc-06 and the codes also</p><p>Thanks.</p>
<p>I Don't Where i solder This Item </p><ul><br><li>16MHz Crystal Oscillator<li>2x 22pF and 1x 100nF capacitors<li>10K resistor<br><br>Please Give a Clear Circuit Diagram please ....i stack in this point .<br><br>I Purchased all the Component But Don't Understand where to Solder. and the Full Circuit.. someone please help. For Pro Version.</ul>
<p>Check this. Is this you ask?</p>
<p>Exactly I asked for this one ... Do u have the Full Breadboard Diagram of Pro Version ... like Full ...Connection with two L293D ICs Motor driver ..? <br>I need Complete diagram ...Please Help.</p>
<p>I couldn't get one exactly you asked. But this might give you an idea. Compare the ATmega328p's pin outs with arduino uno's pin outs. <br>Then you got what you want.</p><p>Hope this would help. :)</p>
Hello I made machine ........But after uploading the code it isn't working but the servo motor is giving slight motion.. Please any one help me
<p>How you power up the system? Did the stepper motors work in the test part of this instructable?</p>
Hey its ok now and I have a small problem,inkscape isn't saving the gcode at last it is showing some errors please help me.
<p>Thanks for the awesome tutorial. Here is my version of the machine. I have created a test run video, you can see here: <iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/cs25xPXIVqc" width="500"></iframe><br></p>
My cnc is not drawing correctly it draws what ever it wants please help
<p>did you use arduino nano instead of UNO?</p>
<p>Actually I used Arduino Mini...</p>
<p>I use old floppy disk cover for bottom part.By doing like this we can plot any where, even on your body.Thanks for the genius brain behind this tutorial</p>
<p>Hello All, </p><p>Mine moves but stays heavily in one corner, doesn't use the whole 40x40 and prints garbage. I tried to find the Testing stepper motors - X and Y axes as per Step 6 to calibrate as per sketch ie: comments at lines 53 to 55 in the main sketch, but could not find it. Anyone know where the test code is and has anyone had a similar printing issue they have solved.</p><p>Cheers</p><p>ray</p>
<p>i got this problem too, have you solved? plz help </p>
<p>Hello.</p><p>I changed pen to laser, so it is mini engraver. it's very good.~ ^^ thanks....</p><p>I </p>
<p>Hi,</p><p>could you write what kind of laser do you use? Thank you.</p>
How did you connect the laser?
<p>I use 500mW laser, It is easy to connect to Arduino, but it needs regulator, 3.5 V to 5V or 7.5V.</p><p>also you should change the source code, penUp() / penDown() to laserOn(), laserOff().</p><p>Then it will be working well. ^^</p>
<p>Hey hw can i increase the printing area like fOr (A4)</p><p>what are the changes i need to make in the coed.......</p><p>Please help</p><p>Thank you</p>
<p>u will need bigger X and Y axes. </p>
I too made it.. but iam having problem. My cnc plotter prints the mirror image of what ever I input to inkscape (text,drawing,images etc)<br>Can u hlp me to solve this. Plz
<p>This is a good project. I am working through it but I can't seem to make the GCODE P150 work, there is no pause. Can you help?</p>
please send a circuit diagram o 2d mini CNC ploter.<br>
<p>On time : the new version of inkscape have a bug with the g-code plugin , always download the version <strong><em>0.48.5 , or you will not sucessfull export the g-code.</em></strong></p><p><strong><br></strong></p><p><strong><br></strong></p><p><strong><em>thanks.<br></em></strong></p>
<p>Hello after using this old version 0.48.5 , is need to add-on or plug-in extension zip file from this?</p><p><a href="https://github.com/martymcguire/inkscape-unicorn." rel="nofollow">https://github.com/martymcguire/inkscape-unicorn.</a></p><p>and please guide to me about how to copy the contents of src/.</p><p>Copy the contents of src/ to your Inkscape extensions/ folder.</p><p>I don't understand how to copy to under extension folder.</p><p>Thank </p>
<p>(br) Obrigado pelo tutorial. Eu tamb&eacute;m fiz a minha. Para a conex&atilde;o com o computador eu utilizei um modulo bluetooth.</p><p>(en) Thanks for the tutorial. I also did mine. For the connection to the computer I used a bluetooth module.</p>
<p>i've also started making this but using floppy drive motor instead of dc for pen up and down . Struggling while coding with some problems .It would be nice if u help me out to sort these.Here's the code i wrote ..</p><p>#include &lt;Stepper.h&gt;</p><p>#define LINE_BUFFER_LENGTH 512</p><p>// Should be right for DVD steppers, but is not too important here</p><p>const int stepsPerRevolution = 20;</p><p>// create servo object to control a servo</p><p>// Initialize steppers for X- and Y-axis using this Arduino pins for the L293D H-bridge</p><p>Stepper myStepperY(stepsPerRevolution, 2,3,4,5);</p><p>Stepper myStepperX(stepsPerRevolution, 6,7,8,9);</p><p>Stepper myStepperZ(stepsPerRevolution, 10,11,12,13);</p><p>/* Structures, global variables */</p><p>struct point {</p><p>float x;</p><p>float y;</p><p>float z;</p><p>};</p><p>// Current position of plothead</p><p>struct point actuatorPos;</p><p>// Drawing settings, should be OK</p><p>float StepInc = 1;</p><p>int StepDelay = 0;</p><p>int LineDelay = 50;</p><p>int penDelay = 50;</p><p>// Motor steps to go 1 millimeter.</p><p>// Use test sketch to go 100 steps. Measure the length of line.</p><p>// Calculate steps per mm. Enter here.</p><p>float StepsPerMillimeterX = 6;</p><p>float StepsPerMillimeterY = 6;</p><p>// Drawing robot limits, in mm</p><p>// OK to start with. Could go up to 50 mm if calibrated well.</p><p>float Xmin = 0;</p><p>float Xmax = 40;</p><p>float Ymin = 0;</p><p>float Ymax = 40;</p><p>float Zmin = 0;</p><p>float Zmax = 30;</p><p>float Xpos = Xmin;</p><p>float Ypos = Ymin;</p><p>float Zpos = Zmax;</p><p>// Set to true to get debug output.</p><p>boolean verbose = false;</p><p>// Needs to interpret</p><p>// G1 for moving</p><p>// G4 P300 (wait 150ms)</p><p>// M300 S30 (pen down)</p><p>// M300 S50 (pen up)</p><p>// Discard anything with a (</p><p>// Discard any other command!</p><p>/**********************</p><p>* void setup() - Initialisations</p><p>***********************/</p><p>void setup() {</p><p>// Setup</p><p>Serial.begin( 9600 );</p><p>// Decrease if necessary</p><p>myStepperX.setSpeed(60);</p><p>myStepperY.setSpeed(60);</p><p>myStepperZ.setSpeed(50);</p><p>// Set &amp; move to initial default position</p><p>// TBD</p><p>// Notifications!!!</p><p>Serial.println(&quot;Mini CNC Plotter alive and kicking!&quot;);</p><p>Serial.print(&quot;X range is from &quot;);</p><p>Serial.print(Xmin);</p><p>Serial.print(&quot; to &quot;);</p><p>Serial.print(Xmax);</p><p>Serial.println(&quot; mm.&quot;);</p><p>Serial.print(&quot;Y range is from &quot;);</p><p>Serial.print(Ymin);</p><p>Serial.print(&quot; to &quot;);</p><p>Serial.print(Ymax);</p><p>Serial.println(&quot; mm.&quot;);</p><p>}</p><p>/**********************</p><p>* void loop() - Main loop</p><p>***********************/</p><p>void loop()</p><p>{</p><p>delay(200);</p><p>char line[ LINE_BUFFER_LENGTH ];</p><p>char c;</p><p>int lineIndex;</p><p>bool lineIsComment, lineSemiColon;</p><p>lineIndex = 0;</p><p>lineSemiColon = false;</p><p>lineIsComment = false;</p><p>while (1) {</p><p>// Serial reception - Mostly from Grbl, added semicolon support</p><p>while ( Serial.available()&gt;0 ) {</p><p>c = Serial.read();</p><p>if (( c == '\n') || (c == '\r') ) { // End of line reached</p><p>if ( lineIndex &gt; 0 ) { // Line is complete. Then execute!</p><p>line[ lineIndex ] = '\0'; // Terminate string</p><p>if (verbose) {</p><p>Serial.print( &quot;Received : &quot;);</p><p>Serial.println( line );</p><p>}</p><p>processIncomingLine( line, lineIndex );</p><p>lineIndex = 0;</p><p>}</p><p>else {</p><p>// Empty or comment line. Skip block.</p><p>}</p><p>lineIsComment = false;</p><p>lineSemiColon = false;</p><p>Serial.println(&quot;ok&quot;);</p><p>}</p><p>else {</p><p>if ( (lineIsComment) || (lineSemiColon) ) { // Throw away all comment characters</p><p>if ( c == ')' ) lineIsComment = false; // End of comment. Resume line.</p><p>}</p><p>else {</p><p>if ( c &lt;= ' ' ) { // Throw away whitepace and control characters</p><p>}</p><p>else if ( c == '/' ) { // Block delete not supported. Ignore character.</p><p>}</p><p>else if ( c == '(' ) { // Enable comments flag and ignore all characters until ')' or EOL.</p><p>lineIsComment = true;</p><p>}</p><p>else if ( c == ';' ) {</p><p>lineSemiColon = true;</p><p>}</p><p>else if ( lineIndex &gt;= LINE_BUFFER_LENGTH-1 ) {</p><p>Serial.println( &quot;ERROR - lineBuffer overflow&quot; );</p><p>lineIsComment = false;</p><p>lineSemiColon = false;</p><p>}</p><p>else if ( c &gt;= 'a' &amp;&amp; c &lt;= 'z' ) { // Upcase lowercase</p><p>line[ lineIndex++ ] = c-'a'+'A';</p><p>}</p><p>else {</p><p>line[ lineIndex++ ] = c;</p><p>}</p><p>}</p><p>}</p><p>}</p><p>}</p><p>}</p><p>void processIncomingLine( char* line, int charNB ) {</p><p>int currentIndex = 0;</p><p>char buffer[ 64 ]; // Hope that 64 is enough for 1 parameter</p><p>struct point newPos;</p><p>newPos.x = 0.0;</p><p>newPos.y = 0.0;</p><p>// Needs to interpret</p><p>// G1 for moving</p><p>// G4 P300 (wait 150ms)</p><p>// G1 X60 Y30</p><p>// G1 X30 Y50</p><p>// M300 S30 (pen down)</p><p>// M300 S50 (pen up)</p><p>// Discard anything with a (</p><p>// Discard any other command!</p><p>while( currentIndex &lt; charNB ) {</p><p>switch ( line[ currentIndex++ ] ) { // Select command, if any</p><p>case 'U':</p><p>penUp();</p><p>break;</p><p>case 'D':</p><p>penDown();</p><p>break;</p><p>case 'G':</p><p>buffer[0] = line[ currentIndex++ ]; // /!\ Dirty - Only works with 2 digit commands</p><p>// buffer[1] = line[ currentIndex++ ];</p><p>// buffer[2] = '\0';</p><p>buffer[1] = '\0';</p><p>switch ( atoi( buffer ) ){ // Select G command</p><p>case 0: // G00 &amp; G01 - Movement or fast movement. Same here</p><p>case 1:</p><p>// /!\ Dirty - Suppose that X is before Y</p><p>char* indexX = strchr( line+currentIndex, 'X' ); // Get X/Y position in the string (if any)</p><p>char* indexY = strchr( line+currentIndex, 'Y' );</p><p>if ( indexY &lt;= 0 ) {</p><p>newPos.x = atof( indexX + 1);</p><p>newPos.y = actuatorPos.y;</p><p>}</p><p>else if ( indexX &lt;= 0 ) {</p><p>newPos.y = atof( indexY + 1);</p><p>newPos.x = actuatorPos.x;</p><p>}</p><p>else {</p><p>newPos.y = atof( indexY + 1);</p><p>indexY = '\0';</p><p>newPos.x = atof( indexX + 1);</p><p>}</p><p>drawLine(newPos.x, newPos.y );</p><p>// Serial.println(&quot;ok&quot;);</p><p>actuatorPos.x = newPos.x;</p><p>actuatorPos.y = newPos.y;</p><p>break;</p><p>}</p><p>break;</p><p>case 'M':</p><p>buffer[0] = line[ currentIndex++ ]; // /!\ Dirty - Only works with 3 digit commands</p><p>buffer[1] = line[ currentIndex++ ];</p><p>buffer[2] = line[ currentIndex++ ];</p><p>buffer[3] = '\0';</p><p>switch ( atoi( buffer ) ){</p><p>case 300:</p><p>{</p><p>char* indexS = strchr( line+currentIndex, 'S' );</p><p>float Spos = atof( indexS + 1);</p><p>// Serial.println(&quot;ok&quot;);</p><p>if (Spos == 30) {</p><p>penDown();</p><p>}</p><p>if (Spos == 50) {</p><p>penUp();</p><p>}</p><p>break;</p><p>}</p><p>case 114: // M114 - Repport position</p><p>Serial.print( &quot;Absolute position : X = &quot; );</p><p>Serial.print( actuatorPos.x );</p><p>Serial.print( &quot; - Y = &quot; );</p><p>Serial.println( actuatorPos.y );</p><p>break;</p><p>default:</p><p>Serial.print( &quot;Command not recognized : M&quot;);</p><p>Serial.println( buffer );</p><p>}</p><p>}</p><p>}</p><p>}</p><p>/*********************************</p><p>* Draw a line from (x0;y0) to (x1;y1).</p><p>* Bresenham algo from https://www.marginallyclever.com/blog/2013/08/how-to-build-an-2-axis-arduino-cnc-gcode-interpreter/</p><p>* int (x1;y1) : Starting coordinates</p><p>* int (x2;y2) : Ending coordinates</p><p>**********************************/</p><p>void drawLine(float x1, float y1) {</p><p>if (verbose)</p><p>{</p><p>Serial.print(&quot;fx1, fy1: &quot;);</p><p>Serial.print(x1);</p><p>Serial.print(&quot;,&quot;);</p><p>Serial.print(y1);</p><p>Serial.println(&quot;&quot;);</p><p>}</p><p>// Bring instructions within limits</p><p>if (x1 &gt;= Xmax) {</p><p>x1 = Xmax;</p><p>}</p><p>if (x1 &lt;= Xmin) {</p><p>x1 = Xmin;</p><p>}</p><p>if (y1 &gt;= Ymax) {</p><p>y1 = Ymax;</p><p>}</p><p>if (y1 &lt;= Ymin) {</p><p>y1 = Ymin;</p><p>}</p><p>if (verbose)</p><p>{</p><p>Serial.print(&quot;Xpos, Ypos: &quot;);</p><p>Serial.print(Xpos);</p><p>Serial.print(&quot;,&quot;);</p><p>Serial.print(Ypos);</p><p>Serial.println(&quot;&quot;);</p><p>}</p><p>if (verbose)</p><p>{</p><p>Serial.print(&quot;x1, y1: &quot;);</p><p>Serial.print(x1);</p><p>Serial.print(&quot;,&quot;);</p><p>Serial.print(y1);</p><p>Serial.println(&quot;&quot;);</p><p>}</p><p>// Convert coordinates to steps</p><p>x1 = (int)(x1*StepsPerMillimeterX);</p><p>y1 = (int)(y1*StepsPerMillimeterY);</p><p>float x0 = Xpos;</p><p>float y0 = Ypos;</p><p>// Let's find out the change for the coordinates</p><p>long dx = abs(x1-x0);</p><p>long dy = abs(y1-y0);</p><p>int sx = x0&lt;x1 ? StepInc : -StepInc;</p><p>int sy = y0&lt;y1 ? StepInc : -StepInc;</p><p>long i;</p><p>long over = 0;</p><p>if (dx &gt; dy) {</p><p>for (i=0; i&lt;dx; ++i) {</p><p>myStepperX.step(sx);</p><p>over+=dy;</p><p>if (over&gt;=dx) {</p><p>over-=dx;</p><p>myStepperY.step(sy);</p><p>}</p><p>delay(StepDelay);</p><p>}</p><p>}</p><p>else {</p><p>for (i=0; i&lt;dy; ++i) {</p><p>myStepperY.step(sy);</p><p>over+=dx;</p><p>if (over&gt;=dy) {</p><p>over-=dy;</p><p>myStepperX.step(sx);</p><p>}</p><p>delay(StepDelay);</p><p>}</p><p>}</p><p>if (verbose)</p><p>{</p><p>Serial.print(&quot;dx, dy:&quot;);</p><p>Serial.print(dx);</p><p>Serial.print(&quot;,&quot;);</p><p>Serial.print(dy);</p><p>Serial.println(&quot;&quot;);</p><p>}</p><p>if (verbose)</p><p>{</p><p>Serial.print(&quot;Going to (&quot;);</p><p>Serial.print(x0);</p><p>Serial.print(&quot;,&quot;);</p><p>Serial.print(y0);</p><p>Serial.println(&quot;)&quot;);</p><p>}</p><p>// Delay before any next lines are submitted</p><p>delay(LineDelay);</p><p>// Update the positions</p><p>Xpos = x1;</p><p>Ypos = y1;</p><p>}</p><p>// Raises pen</p><p>void penUp() {</p><p>myStepperZ.step(stepsPerRevolution);</p><p>Zpos=Zmax;</p><p>if (verbose) {</p><p>Serial.println(&quot;Pen up!&quot;);</p><p>}</p><p>}</p><p>// Lowers pen</p><p>void penDown() {</p><p>myStepperZ.step(-stepsPerRevolution);</p><p>Zpos=Zmin;</p><p>if (verbose) {</p><p>Serial.println(&quot;Pen down.&quot;);</p><p>}</p><p>}</p>
<p>It's done, very good tutorial. Congratulations.</p><p><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/JQojgWp5Dkw" width="500"></iframe></p><p><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/fVMQNToplHc" width="500"></iframe></p>
<p>what version of inkscape are you using? I keep getting errors with the plugin that i'm using.</p><p>Traceback (most recent call last):<br>File &quot;unicorn.py&quot;, line 108, in &lt;module&gt;<br>e.affect()<br>File &quot;C:\Program Files\Inkscape\share\extensions\inkex.py&quot;, line 268, in affect<br>self.effect()<br>File &quot;unicorn.py&quot;, line 102, in effect<br>parser.parse()<br>File &quot;C:\Program Files\Inkscape\share\extensions\unicorn\svg_parser.py&quot;, line 230, in parse<br>self.svgWidth = self.getLength('width', 354) * 0.28222<br>TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'</p><p>This error is telling me that there is never a return of data. Which means that it's on inkscape's side. the NoneType error tells us this.</p><p style="margin-left: 20.0px;">Thus, i'd like to know what version of inkscape you are using so that i can reduce environment error if this is the case</p>
<p style="margin-left: 20.0px;">After doing some research, I've figured out the issue</p><p>[Update 04/02/2015: At present, the Unicorn plugin seems not to be compatible with the current Inkscape version. Alternatively, you can either have an older version of Inkscape (with 0.48.5 it still works) install or use another plug-in, such as the Laser Engraver Thanks to Andreas K.)]</p>
<p>I made it...but still need enchancement on Z-axis. Thanks for tutorial, waiting for another arduino project..</p>
<p>I made such that the power with arduino. but only one stepper motor work , just stepper y and x is not, but if stepper x in the test he works. did its current less? or how solution?</p>
<p>You should to described about the Z-axis (how to interface) clearly.... and also i need a guideline from you..<br>~thanks in advance</p>
<p>I'm trying to do the same but with an Arduino Nano V3. And I wanted to see feeding another source such as a transformer, and by USB you can charge only what I'm going to print. What type of source it would have to be used to power motors and L293D?</p>
<p>hello, can i use laptop CD drives for this project?</p>
<p>it was FUN making this,.........and really satisfying watching it working</p>
<p>its really fun making this......and pretty satisfying watching it working</p>
<p>its really fun making this......and pretty satisfying watching it working</p>
<p>its really fun making this......and pretty satisfying watching it working</p>
<p>would any one plz upload z axis that is mounting servo with x axis </p>
I made my own but the x stepper doesn't work correctly and doesn't move till I move it handly

About This Instructable




More by Ardumotive_com:Arduino 3D Printed Compass Arduino Bluetooth Car With Custom PCB DIY Arduino LED Matrix Display - 80x8 Px 
Add instructable to: