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

For X and Y axis we will use stepper motors and rails from two dvd/cd roms! Printing area will be max 4x4cm.

Step 1: The Video in Youtube :

Step 2: Parts

For this project you will need:

- Part list for beginners:

- Arduino uno ( or Mega ) Breadboard

- Shield driver motor L293D adafruit v1

- Mini Servo motor 9g

- 2x DVD/CD Drives

Librairy For Adafruit Shield Driver Motors v1 :

Step 3: X Y Axe

In first image above you will see the Y axis of our CNC machine. Attach it on your surface, in this part you will need some screws and nuts.

In second image you will see the X and Y axis. The X axis is attached to two plastic parts that I took from remaining 'garbage' stuff. I cut it to fit the construction. This is an easy procedure. Just make sure to put the Y axis straight to CNC base and the X axis vertically in this (90 degrees)

Step 4: The Z Axis

That's the most difficult part of our construction.

You will need something to attach it on X 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 duild Z axis. Tip! Use your imagination ;)

Step 5: the Circuit

Step 6: Uploading 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. Press the "Run on Arduino" button and program your board from your browser!

Step 7: 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 : https://inkscape.org/en/download/windows/

(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, change font to Times New Roman and size to 22. 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 the arduino logo image (download it from files) in Inkscape. Click ok to the next window. Now you have to re-size the image to fit our 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 Final, go to file menu, click save as and select .gcode. Click ok on next window. That's it! Ready to go! Use the gctrl.pde app to print the gcode file on your new Arduino CNC Plotter! I will make a video on next days about this procedure because it's little complicated. It took me a lot of time to understand how it's working...

Step 8: The GCTRL Program

Now we are ready to print our first image! To do this we will use the gctrl . 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)

Click the "play" icon/button to start the program.

Download gctrl for Windows :


Click First time to " p " to select Port number for Arduino

and click to " g " to select Gcode file ...

hello, my problem i:<br><br>Arduino:1.6.11 (Windows 10), Tarjeta:&quot;Arduino/Genuino Uno&quot;<br><br>C:\Users\Kriivo\AppData\Local\Temp\ccdbL8gd.ltrans0.ltrans.o: In function `loop':<br><br>ccdbL8gd.ltrans0.o:(.text+0xcb4): undefined reference to `AF_Stepper::onestep(unsigned char, unsigned char)'<br><br>ccdbL8gd.ltrans0.o:(.text+0xce2): undefined reference to `AF_Stepper::onestep(unsigned char, unsigned char)'<br><br>ccdbL8gd.ltrans0.o:(.text+0xd28): undefined reference to `AF_Stepper::onestep(unsigned char, unsigned char)'<br><br>ccdbL8gd.ltrans0.o:(.text+0xd56): undefined reference to `AF_Stepper::onestep(unsigned char, unsigned char)'<br><br>C:\Users\Kriivo\AppData\Local\Temp\ccdbL8gd.ltrans0.ltrans.o: In function `global constructors keyed to 65535_0_FKZY7W9IN4TTHPJ.ino.cpp.o.1877':<br><br>ccdbL8gd.ltrans0.o:(.text.startup+0xc4): undefined reference to `AF_Stepper::AF_Stepper(unsigned int, unsigned char)'<br><br>ccdbL8gd.ltrans0.o:(.text.startup+0xd2): undefined reference to `AF_Stepper::AF_Stepper(unsigned int, unsigned char)'<br><br>C:\Users\Kriivo\AppData\Local\Temp\ccdbL8gd.ltrans0.ltrans.o: In function `main':<br><br>ccdbL8gd.ltrans0.o:(.text.startup+0x2f6): undefined reference to `AF_Stepper::setSpeed(unsigned int)'<br><br>ccdbL8gd.ltrans0.o:(.text.startup+0x302): undefined reference to `AF_Stepper::setSpeed(unsigned int)'<br><br>collect2.exe: error: ld returned 1 exit status<br><br>exit status 1<br>Error compilaci&oacute;n en tarjeta Arduino/Genuino Uno.<br><br>Este reporte podr&iacute;a tener m&aacute;s informaci&oacute;n con<br>&quot;Mostrar salida detallada durante la compilaci&oacute;n&quot;<br>opci&oacute;n habilitada en Archivo -&gt; Preferencias.<br>
<p>hello sir my cnc not drow properly it can drow only a square it's urjent plz sir</p>
<p>my cnc not drow properly it can drow only square</p>
Hello sir...Thank u so much for this post...I have been working on this project from last one week..I have followed each and every step mentioned by u.. I have used Ur code and even followed Ur circuit diagram.. but still I m not getting a desired output... I mean I'm getting a distorted output... I think I'm facing the problem in wiring.. I'm sending u one picture with all the wiring configuration I have used.. if the wiring is not correct plz correct it by commenting the correct combination (like A1 A2 B2 B1 )... It's urgent sir plz help me out<br>
<p>have you fixed it ? i m having same issue</p>
<p>hi O'Donovan I am also having same issue </p><p>My output is distorted and all jumbled up</p><p>So i request you .Please help sir its urgent</p>
I am also having same issue<br>Please help anyone
<p>Hi</p><p>In step 5 you're told to connect y Axe to M3 M4. This did not work for me, I connected my Y Axe to M1 M2.</p><p>If printed text is back to front switch a1a2 b1 b2 in reverse order eg a1 becomes b2, a2 becomes b1 and so on.</p><p>If only one axe moves and the other stays still then you may have a wire lose on the axe that is not moving or you need to switch only one pair of wires 1 and 2 to become 2 and 1.</p><p>If your image is printing in what looks like one corner then your start point in software may be incorrect. </p><p>My software settings are different for some images Inkskape images start in the centre:</p><p>Arduino settings (1) X -18 +18 - Y-18 +18 start plotting in the centre of page. Arduino settings (2) max X36 max Y36 starts closest to me to the right.</p><p>I hope this helps in some way.</p><p>It took me a while to figure this out.</p><p>K</p>
<p>X Y Min Max</p>
<p>hello , i am having same issue and output is distorted . how to change the starting point in software</p>
<p>Hi SarojR</p><p>The starting point is where you start your pen or start plotting. Put the pen down on the paper and outline the edges of the paper. this is the Min max that your plotter can do, you will end up with a square.</p><p>Draw a line from one corner to the other to form a cross in the square already made, the center of this cross is where Inkskape starts the plotting.</p><p>In the program you download to the Arduino change the values for the X and Y from 36 to read -18 +18 and upload to the Arduino again.</p><p>K</p>
<p>Thanks fro your good work. I made it but my cnc is based in an old printer and scanner. I print the test images directly on the glass of the scanner, the white paper below is just to highlight the drawing. I searched for a cnc with the adafruit stepper driver V1, so I found just what I needed. Thanks again.</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>I made a bigger version using your code to make a large cnc router <br>(40cmx30cm) and it is nicely printing small images that you shared. <br>Unfortunately it is printing images within a 5cm x5cm zone only. I tried<br> increasing the Xmax, Ymax beyond 50 but anything beyond 5 cm in printed<br> at a different place. your cd rom lead screw has high pitch but my lead<br> screw has 1.25 mm pitch. After calibration, I ended up at <br>StepsPerMillimeterY=1250, StepsPerMillimeterX=650</p><p> I also checked <br>the stepper motor example in adafruit library and it also draws line of 5<br> cm only (motor.step(4000, FORWARD, MICROSTEP); I tried with number <br>larger than 4000. Is it a limitation of the hardware? Can you please <br>help? I am a mechanical engineer but new to arduinio.</p>
<p>Fixed the problem. It was happening because of the low pitch of the screw the value of x1 was exceeding the range of int. I Just changed it to long and its solved the problem but at a cost of higher memory.</p>
<p>all im getting from the z- axis servo is jitters, any help?</p>
<p>I have heat problem. Both of motors and l293d are overheated in 30-40 second. can anyone give me some advice.</p>
<p>thank youu of All :) </p><p>that other instructables to how make this project step by step : </p><p>https://www.instructables.com/id/How-to-Make-Mini-CNC-Router-Drawing-by-Arduino-and/</p>
<p>Super nice project !</p><p>My project its up and running.</p><p>Now i have som ? about it.</p><p>Can`i change the motorer on X and Y from DVD step motorer to eks. 28BYJ-48 5 volt.</p>
<p>Fantastic, Thanks a million for this.</p><p>I have it up and running.</p><p>You're a STAR. </p>
<p>can you send me your circuit connection between stepper and shield .. every thing is perfect but my output is distorted</p>
I've made it but it isn't working after uploading the code please any one help me
<p>Hello, I Hav Made It But I Hav A Major Issue With Power Supply. Ones I Hav Supplied 19v 1.5Amp Then 1 Cap. Of 16v 100uf Blew Up I Hav Repaired It Will Any One Will Suggest Me Wat To Supply Power To L293D Motor Sheild</p>
<p>Remove the jumper from the motor driver board L293D and supply 5V to the board this worked for me</p>
<p>hola a todos; eh estado trabajando en este proyecto y podrian modificar ciertas cosa del codigo para mejorar el rendimiento de nuestro mini cnc y evitar da&ntilde;os en nuestra shield motor. ademas reducir el ruido de los motores y el calor que esto producen al trabajar. </p><p>entonces la parte del codigo que hay que modificar seria esta:</p><p>void setup() { // Setup</p><p> Serial.begin( 9600 );</p><p>TCCR2B = TCCR2B &amp; B11111000 | B00000001;</p><p>TCCR0B = TCCR0B &amp; B11111000 | B00000001; </p><p> penServo.attach(penServoPin);</p><p> penServo.write(penZUp);</p><p> delay(100);</p><p> // Decrease if necessary</p><p> myStepperX.setSpeed(500);</p><p> myStepperY.setSpeed(500);</p><p>}</p><p> que sea de su agrado!!!!! </p>
<p>great thanks</p>
What is the main code to upload on arduino?<br>Plz tell me any one,...
If we change pcb drill with pen so it will work or not<br>
<p>hello. I made this one and its working properly. thanks for sharing. Now I am trying to increase the size of plot. here it plots only 4cm/4cm. I want to increase it by 20 cm by 20 cm . i have all the mechanical set up but when i upload the gcode it plots only the 4cm by 4cm area what can i do? please help.</p>
<p>Hi insructAbdo, can you show me how to decrease speed of X and Y axis, i change the number in the line &quot;myStepperX.setSpeed ()&quot; from 500 to 100 but nothing happen, it still run the same speed.</p>
<p>hola vu nguyen minh , como te fue con el problema ? lo solucionaste? me pasa lo mismo a mi y no se que hacer para poder bajar la velocidad del eje x e y :( ....</p><p>saludos </p>
i make it bro but no working . bro i dont't know adafruit motor shild libary and accelstepe master install from arduino bord uplode now please help me how to install this driver arduino bord ?
<p>very good</p>
<p>If i am using the adafruit motor shield V2, can I use change the library without changing others code?</p>
<p>hey, it's a great project. I've made this yesterday, can you tell me where is the zero point located (0,0)?</p>
<p>wow, great build. can i use a salvage part from printer instead a dvd drive (i have 3 x A3 canon printer (ix6560,ix5000,ix4000))???? can you explain to me how it works??? thank you. you ROCKs!!!</p>
<p>I made one myself back in 2014 based on the Laserengraver. I discovered that there are microswitches on the board where the stepper for the disk spindle resides. There is a flat cable coming from it. I use these the calibrate and home the pen before and after printing/plotting.</p><p>I adjusted the code in Inkscape to use it. I am not finished, yet, but here is a part of the code.</p><p>It is done on my Mac. On Linux or windows you have to find the right path to the extensions folder.</p><p>'/Applications/Inkscape/Contents/Resources/extentions/share/Inkscape/unicorn/context.py'</p><p>in self.reamble:</p><p>self.preamble = [</p><p> &quot;(Scribbled version of %s @ %.2f)&quot; % (self.file, self.xy_feedrate),</p><p> &quot;( %s )&quot; % &quot; &quot;.join(sys.argv),</p><p> &quot;G21 (metric ftw)&quot;,</p><p> &quot;G28 X%.2f Y%.2f Z%.2f (Home X Y Z)&quot; % (self.x_home, self.y_home, self.z_height),</p><p> &quot;G90 (absolute mode)&quot;,</p><p> &quot;G92 X%.2f Y%.2f Z%.2f (you are here)&quot; % (self.x_home, self.y_home, self.z_height),</p><p> &quot;&quot;</p><p> ]</p><p>and n in self.postscript:</p><p>self.postscript = [</p><p> &quot;&quot;,</p><p>&quot;(end of print job)&quot;,</p><p>&quot;M300 S%0.2F (pen up)&quot; % self.pen_up_angle,</p><p>&quot;G4 P%d (wait %dms)&quot; % (self.stop_delay, self.stop_delay),</p><p>&quot;M300 S255 (turn off servo)&quot;,</p><p>&quot;G1 X0 Y0 F%0.2F&quot; % self.xy_feedrate,</p><p>&quot;G1 Z%0.2F F%0.2F (go up to finished level)&quot; % (self.finished_height, self.z_feedrate),</p><p>&quot;G1 X%0.2F Y%0.2F F%0.2F (go home)&quot; % (self.x_home, self.y_home, self.xy_feedrate),</p><p> &quot;G28 X%.2f Y%.2f Z%.2f (Home X Y Z)&quot; % (self.x_home, self.y_home, self.z_height),</p><p>&quot;M18 (drives off)&quot;,</p><p>] </p><p>Now I am working on the Mini_CNC_Arduino_Plotter.ino to read out the state of the switches. If they are open, the motors have to move until the switches are closed. Then home must be set (X=0.00, Y=0.00). This comes from G28 X Y Z.</p><p>I've tested it with this switch_test.no:</p><p>//------------------------------------------------------------------------------</p><p>// Draw robot - switch test</p><p>// dan@marginallycelver.com 2012 may 06</p><p>//------------------------------------------------------------------------------</p><p>// Copyright at end of file.</p><p>// please see <a href="http://www.github.com/MarginallyClever/Makelangelo" rel="nofollow"> http://www.github.com/MarginallyClever/Makelangel...</a> for more information.</p><p>//------------------------------------------------------------------------------</p><p>// CONSTANTS</p><p>//------------------------------------------------------------------------------</p><p>#define CUTOFF (512)</p><p>//------------------------------------------------------------------------------</p><p>// VARIABLES</p><p>//------------------------------------------------------------------------------</p><p>char a,b,a1,b1;</p><p>long c=0;</p><p>//------------------------------------------------------------------------------</p><p>// METHODS</p><p>//------------------------------------------------------------------------------</p><p>void readSwitches(char a1, char b1) {</p><p> // get the current switch state</p><p> a1=analogRead(3) &lt; CUTOFF;</p><p> b1=analogRead(5) &lt; CUTOFF;</p><p>}</p><p>//------------------------------------------------------------------------------</p><p>// print the state of each button</p><p>void ps() {</p><p> Serial.print(c++);</p><p> Serial.print(&quot;\t&quot;);</p><p> Serial.print(a==0?&quot;Off&quot;:&quot;On&quot;);</p><p> Serial.print(&quot;\t&quot;);</p><p> Serial.println(b==0?&quot;Off&quot;:&quot;On&quot;);</p><p>}</p><p>//------------------------------------------------------------------------------</p><p>void setup() {</p><p> Serial.begin(9600);</p><p> // Serial.begin(57600);</p><p> digitalWrite(A0,HIGH);</p><p> digitalWrite(A1,HIGH);</p><p> digitalWrite(A2,HIGH);</p><p> digitalWrite(A3,HIGH);</p><p> digitalWrite(A4,HIGH);</p><p> digitalWrite(A5,HIGH); </p><p> Serial.print(&quot;T&quot;);</p><p> Serial.print(&quot;\t&quot;);</p><p> Serial.print(&quot;L&quot;);</p><p> Serial.print(&quot;\t&quot;);</p><p> Serial.println(&quot;R&quot;);</p><p> a=analogRead(3) &lt; CUTOFF;</p><p> b=analogRead(5) &lt; CUTOFF;</p><p> ps();</p><p>}</p><p>//------------------------------------------------------------------------------</p><p>void loop() {</p><p> a1=analogRead(3) &lt; CUTOFF;</p><p> b1=analogRead(5) &lt; CUTOFF;</p><p> readSwitches(a1,b1);</p><p> if(a1!=a){</p><p> a=a1;</p><p> ps();</p><p> }</p><p> if(b1!=b) {</p><p> b=b1;</p><p> ps();</p><p> }</p><p> delay(2);</p><p>}</p><p>/**</p><p> * This file is part of DrawbotGUI.</p><p> *</p><p> * DrawbotGUI is free software: you can redistribute it and/or modify</p><p> * it under the terms of the GNU General Public License as published by</p><p> * the Free Software Foundation, either version 3 of the License, or</p><p> * (at your option) any later version.</p><p> * </p><p> * DrawbotGUI is distributed in the hope that it will be useful,</p><p> * but WITHOUT ANY WARRANTY; without even the implied warranty of</p><p> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</p><p> * GNU General Public License for more details.</p><p> * </p><p> * You should have received a copy of the GNU General Public License</p><p> * along with Foobar. If not, see &lt;http://www.gnu.org/licenses/&gt;.</p><p> */</p><p>Output:</p><p>T L R</p><p>0 Off Off</p><p>1 On Off</p><p>2 On On</p>
<p>Thanks for this Instructable! Finally I can point makerblog.at-Users asking for an english version of my tutorial to this page :)</p>
<p>very nice project and great job, i wish some people would see the learning that you have made by building it. to some a printer is the answer, live must be very easy, to me your project ROCKS!</p>
<p>is there any way to increase the printing area using these things?</p>
<p>Very good project I love it !</p>
<p>Sorry, but can made this whit a normal printer in some seconds...</p>
<br>prestorecords Reply<br>Hi! May you explain how? Thanks! (Sorry, English isn't my native idiom)
Just print screen...
Hi! May you explain how? Thanks! (Sorry, English isn't my native idiom)
<p>Is it possible to add a drill tool to this setup? I look for something to automate my PCB drilling. Simple and dirt cheap :) Thanks</p>
<p>What about using it with a &quot;Resist&quot; pen to draw your own boards??</p>
For me sounds like a nice to have around: your own &quot;PCB&quot; CNC maker! :) Able to draw and to drill your PCB. I think only that a &quot;Resist&quot; pen will require some issues to be solved:<br>-the tip can risk to dry out during drawing<br>-the drawing will have a consistent trace width (or if you can switch pens, you can get multiple widths)<br>-I am not sure if CNC can be setup, but the movement need to stop first and only after to rise the pen (Z axis) other wise the PCB will have issues.<br>Anyway, I started to dream to a PCB CNC maker for home :), thanks for the idea<br>

About This Instructable




Bio: My name is Abderrahim Aabida , 23 years , living in Morocco - Safi , holds a diploma in basic physics and electronics at the Faculty of Sciences in ... More »
More by insructAbdo:How to Make Mini CNC Router Drawing by Arduino and Shield L293D Drawing instructables robot by Mini CNC - Arduino - L293D Shield Mini CNC machine Arduino Based & Adafruit Driver Motor L293D v1 & 2*Mini Stepper CD/DVD player #1  
Add instructable to: