The purpose of this project was to make a 3-axis pen plotter as cheaply as I possibly could.  Assuming you already have an Arduino it ended up costing me $30 to build.  Please understand that the stepper motors that are inside CD-ROMS are not strong.  If the pen comes down too far it will stop the motors from moving.  This will not harm the motors but I thought it would be worth mentioning.  But if you are looking for a cheap way to experiment with 3-axis's this might be for you. 

The program reads binary 0's & 1s stored in a word array in row/column fashion & then controls the motors accordingly.  You can change what it prints by changing the data in the "image" array.  It's pretty basic & shouldn't be too hard to understand or change to fit your wants better.

I included the schematic I followed for wiring the H-Bridge Motor Drivers (SN754410NE).  I apologize for not having a complete schematic I have not found an easy way to make them.  I used an LM317 5V regulator for each H-bridge, but honestly since I used a computer power supply to give me 5V you shouldn't even need the LM317's.  You could just take the 5v from the power supply & wire it to each H-Bridge.  In my case I built the control board before choosing a power supply.

Part List                                                              Quantity     Cost        Total
H-Bridge Motor Driver 1A (SN754410NE)                3              $2.35       $29.25
Voltage Regulator (LM317)                                      3            ~$1.95
10uF/25V Capacitor                                                  3             ~$0.45
Used CD-ROM                                                           3             ~$5.00

Arduino Duemilanove/UNO   (This indestructible assumes that you already have one) ;)     
If you don't already have an Arduino the total cost will be closer to $60.00.
In case you don't want to download the zip file, the code is below:


#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 200

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepperX(STEPS, 6, 7, 8, 9);     //x (top) platform
Stepper stepperY(STEPS, 2, 3, 4, 5);     //y (bottom) platform
Stepper stepperZ(STEPS, 10, 11, 12, 13); //z pen

int x_inc = 0;
int y_inc = 0;
int z_pos = 0;

word image[16] = {

void setup()
  // set the speed of the motors to 60 RPMs
  stepperX.setSpeed(60); //bottom (60rpm)
  stepperY.setSpeed(60); //top (60rpm)
  stepperZ.setSpeed(60); //Pen (60rpm);

void loop()
    for(int row = 0; row < 16; row++) {

      x_inc = 0; 

      for(int column = 0; column < 16; column++){
        boolean pixel = bitRead(image[row],column);
        if(pixel == 1){

          //move X-Axis forward 5 steps for each bit in the array
          x_inc = x_inc + 10;

          //move X-Axis forward 5 steps for each bit in the array
          x_inc = x_inc + 10;


      //Position Y-Axis for next row
      y_inc = y_inc + 10;

  //Return X/Y-Axis back to home position
  //Endless Loop

void penDown()
  //if the pen is raised
  if (z_pos == 0){
    //move the pen to the paper
    z_pos = 83;

void penUp()
  //if the pen against the paper
  if(z_pos == 83){
    //move pen away from paper
    z_pos = 0;

<p><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/Gl5vjMKXH9c" width="500"></iframe><br>here is my version :D </p>
<p>what is the code the you use</p>
<p>How can i use gcode ...u dont mansion this</p>
<p>For this project I did not use Gcode to create the image; instead program draws from binary data.</p><p>There are pen plotter on instructables that do use gcode though, you can search their site for &quot;gcode + plotter&quot; and will find lots of examples. Have fun &amp; good luck.</p>
<p>I'm currently trying to build your project, but I don't have 3 stepmotors. I've therefore been trying to use a servomotor in the z-axis, but it doesn't seem to work..<br><br>I have replaced the stepperZ with 'Servo servoZ;' and set the position to 0 and defined it as 'servoZ.attach(8);' in the void setup.</p><p>During the loop, I have edited the Pen Up and down to the following:</p><p>void penDown()</p><p>{</p><p> //if the pen is raised</p><p> if (z_pos == 0){</p><p> //move the pen to the paper</p><p> servo.write(20); </p><p> delay(15);</p><p> z_pos = 20;</p><p> }</p><p>}</p><p>void penUp()</p><p>{</p><p> //if the pen against the paper</p><p> if(z_pos == 20){</p><p> //move pen away from paper</p><p> servo.write(-20);</p><p> delay(15);</p><p> z_pos = 0;</p><p> }</p><p>}</p><p>Do you know what I've been doing wrong?</p>
<p>The first thing that comes to mind is the pin you connected the servo to. From my understanding you will need to connect the servo to a &quot;PWM&quot; (pulse-width-modulation) capable pin. On a Arduino UNO those pins are, 3,5,6,9,10,11.</p><p>With that in mind, you could modify the following line: 'servoZ.attach(8);' to</p><p>'servoZ.attach(9);' and connect your servo to Pin 9. Good luck.</p>
<p>Is it possible to use this for 3d printing?</p>
<p>Maybe; I would think the hardest part would be the software. On the hardware side of things you could replace the pen with a glue gun heat element. I can't imagine that the prints will be all that good; but it might be fun to play with regardless. Have fun and good luck.</p>
<p>I'll try and post the results.</p>
<p>Great project, I am just a little confused on how your capacitors are connected in the circuit. I am actually building it right now and I have found that the caps are necessary for the motors to run properly. If you could give a guy a hand and explain how you they go into the circuit that would be awesome?</p>
<p>from where can i download the steps sorry im new in this site :)</p>
<p>Here my version:</p><p>https://www.facebook.com/video.php?v=10152419138433225&amp;l=4664614081476599468</p>
<p>Ol&aacute;, como fa&ccedil;o para criar outros c&oacute;digos para gerar outras imagens, algum programa que converta imagens em c&oacute;digos bin&aacute;rios, ou algo do tipo, Obrigado...</p>
<p>No c&oacute;digo de exemplo, eu inseridos manualmente os dados bin&aacute;rios para fazer a imagem . Voc&ecirc; pode fazer o mesmo se quiser, eu n&atilde;o olhei para ver se o seu &eacute; um programa para automatizar a tarefa ; pode valer a pena uma pesquisa. Boa sorte e se divertir.</p>
<p>Hi, cool project! One thing that confuses me is whether or not the power supply has to be very high current as well? I found two little phone charger type things, both 5v, and one is around 500mA and the other was 1200mA, but I know that computer power supplies produce a much higher current. If each motor requires around 400mA, will the 1200mA work? Thanks</p>
<p>Thanks, I appreciate it : ) I would think you could get away with using the 1200mA 5V supply. You should check the power supply every once and a while to make sure it is staying cool; warm to the touch is okay but hot is not. </p>
<p>Here is mine! Thanks for sharing!</p><p>http://youtu.be/70jekaZHsSQ</p>
That's really cool; thanks for sharing also : )
<p>Next Step GCode.. rsrsrs!.. </p>
<p>Hello, I really like this project, and I think I'll try to replicate it. One thing though: how do I change the design? I believe the part &quot;word image&quot; in the code defines motor's movements, but how do I get them drawing something else? Would this project work with GRBL?</p><p>Thanks a lot!</p>
<p>The &quot;word image&quot; is where the drawing is stored. The program will read the word image data and will lower the pen it reads a &quot;1&quot; and raise the pen if it reads &quot;0&quot;. So to change what the program draws you only need to change the 0's &amp; 1's in the word image to make a picture. The motors move as the program reads each row and increments the column after each row. The commands responsible for moving the motors are as follows, stepperX.step(10), stepperY.step(10) &amp; stepperZ.step(83). I hope that makes sense, let me know if you need anything explained in more detail.</p>
<p>i was wondering if there is any software that can handle any given image(say,bmp or jpg) to the code that arduino can work with?</p><p>thanks</p>
<p>Ok, now it's clear how the drawing is programmed. If I'm not mistaken &quot;stepperX.step(10), stepperY.step(10)&quot; means that X and Y make 10 steps, and basically decide how long a dash the pen has to draw, right?</p><p>I was thinking about building such a machine to learn more on CNC's and eventually build a bigger one someday, but I'd also like to use it to print some little pcb's. Do you think I could run GRBL on this set-up? That way it'd be possible to print more complex designs. Would it work, or could there be any incompatibilities with the driver chips?</p><p>Thank you very much!</p>
<p>You are exactly right. </p><p>I would imagine that you could have it interpret GRBL; my only concern is the final output would look better with a more traditional setup. But if that doesn't deter you I found a blog that you should take a look at: </p><p><a href="http://jamesgregson.blogspot.com/2012/08/3-axis-cnc-controller.html" rel="nofollow">http://jamesgregson.blogspot.com/2012/08/3-axis-cn...</a></p><p>He provides code that interrupts GRBL and shows you his control setup; Have fun.</p>
Hello!<br><br>I'm trying to build a pen plotter and yours look great. You mention a zip file we can download, but unfortnately I cannot find in this page. You could you please tell me where it is?<br><br>Sorry and thanks!
<p>hello<br>I built my own one :) ,, thanks for your efforts </p><p><br>but how can I make the picture larger than 16 bit ??<br><br>can you write to me a quote of a Code ???<br>which type of data should be used ? <br>thanks </p>
Nice work! I am missing how to build the third axis, it seems you used just 2 motors, but instructables says &quot;3 axis&quot;. Thank you!
<p>From the picture I included it is hard to see but there are three motors total. There are two on the bottom plate and one for the vertical axis.</p><p>For the bottom plate, one motor moves the CD-tray forward. The other motor &amp; assembly are mounted sideways on the top of the CD-tray. I then mounted the square piece of acrylic to the sideways mounted motor, hot glue was used to hold everything in place.</p><p>I have already disassembled this project otherwise I would have provided additional pictures in my explanation. If/When I have time I would like to rebuild this project because I could have added additional details that would make this instructable better.</p><p>I tend to always have 3-4 projects going at any one time; and time is always in short supply. Have fun with your project.</p>
<p>I understand now, thank you :)</p>
<p>For circuit diagrams, try </p><p><a href="https://www.circuitlab.com/" rel="nofollow">https://www.circuitlab.com/</a></p><p>online, has simulation, and for free! Also has a pretty good selection of public circuit designs.</p>
Thanks for your answer. I have the full part list now but i cannot do the project correct. Please upload better plans. The cd rom stepper motor 4 pins how is ordered ?? <br>I am looking forward for full electrical plans <br>thanks !!!
in first pic you have 3 Capacitors but in electrical plan you use 6 (2 for each Voltage Regulator (LM317) ) <br>Witch one is correct ?? <br>thanks
Thanks for bringing that to my attention; 3 will work just fine, 6 is a little bit overkill.
Ol&aacute; Davidhend! Eu estou tentando fazer o carregamento e aperas se este recado:Este recurso est&aacute; dispon&iacute;vel apenas com a Pro ades&atilde;o.se este recado, Torne-se um membro do Pro hoje! mas j&aacute; sou membro porque lhe envia a minha d&uacute;vida eu fui obrigado a me tornar membro do Pro, eu baixei em WinRar mas e quando estou descompactando n&atilde;o existe nada na pasta, talvez eu esteja descompactando de forma errada, eu lhe pe&ccedil;o mais essa ajudinha por favor me ajude, porque eu sou muito grato por voc&ecirc; ter me respondido na minha primeira d&uacute;vida e agora eu conto com a sua ajuda outra v&ecirc;s, espero n&atilde;o estar te incomodando porque eu poderei precisar de sua ajuda outras vezes e sei que voc&ecirc; n&atilde;o vai negar. Abra&ccedil;os
Sinto muito que voc&ecirc; est&aacute; tendo esse problema, eu postei o c&oacute;digo no tutorial agora. Se voc&ecirc; re-visitar o tutotial voc&ecirc; pode simplesmente copiar e colar o programa. Deixe-me saber se voc&ecirc; tem mais problmes e se divertir. mais tarde
Ol&aacute;! Eu pretendo baixar mas a minha d&uacute;vida &eacute;: se eu baixar vem todos os desenhos el&eacute;tricos de liga&ccedil;&otilde;es completos os que tem nesta p&aacute;gina e com o programa j&aacute; feito com o arduino? Por favor me tire essas d&uacute;vidas p mim poder baixar, eu fico muito agradecido &aacute; voc&ecirc; meu amigo. Abra&ccedil;os
Se bem entendi o programa arduino &eacute; completa, voc&ecirc; pode fazer o upload do esbo&ccedil;o ao arduino sem modifica&ccedil;&atilde;o. Ele vai chamar um homem segurando as m&atilde;os. &Eacute; poss&iacute;vel alterar o que chama a chaning os dados bin&aacute;rios no topo do programa.
how can i test the motors from the cdrom? like step motor or i need something more
If you make the control board in this instructables; you could use alligator clips to connect the circuit to the motor. I wish there was an easier way but stepper motors need more than just positive and negative like dc motors.
Hello! I really love the idea, it's so cheap and a good starter &quot;CNC&quot; machine. Could you please make a tutorial from scratch building this thing? I got most of the stuff you listed that you need, but my building skills are terrible, so a video would be really appreciated. <br>Please let me know!
I have disassembled this project already; if you give me a week or two I will try to re-build the project and re-do this instructable. Have fun.
can i change the SN754410NE for another drive? i have one l293
I don't see that being a problem; I believe the 293 operates in a similar enough way that the code should work as is; but don't quote me on that. The wiring will differ slightly but that shouldn't be a big problem. <br> <br>Have fun - David
yes, i know it like this http://www.arduino.cc/en/Reference/StepperTwoPins <br>will have 2 pin out . but the problem is the program. the GRBL is limid max for 3 axis only. that's my problem, im looking for the project who using 4 axis. <br>the only one what im think is make paralel the stepper motor to 1 driver, so 2 stepper in 1 driver to arduino Or 2 stepper 2 driver but connect paralel to arduino. :D
heii. is the uno can controlled 4 axis?
If I understand correctly; the arduino uno can control 4-axis's or even more.
Hey can any one write more algorithms to try it on. It be very helpful.
dear davidhend <br>great job! i'm a newbie in c programming , where i can find some explanation about the code you used? especially the part of the row/column scanning <br>thank you
It's actually quite easy to do row/column scanning. It consists of two nested for loops, what that means is this: <br> <br>// x-axis (row's) <br>for(int x = 0; x &gt; 10; x++){ <br> // y-axis (columns) <br> for(int y = 0; y &gt; 10; y++){ <br> <br> } <br>} <br> <br>x starts at zero; y also starts at zero and then y will increment until it reaches 10. Afterwards x becomes one and then y starts to increment again. This process continues until x has reached 10 and y reaches 10 for the final time. You can also swap x &amp; y around so that you do a full column and then increment the row. <br> <br>I hope this helps you &amp; good luck. <br> <br>Thanks - David

About This Instructable




More by davidhend:Car Coolant Temperature Alarm Arduino Mega Hexapod Teensy Ambilight 
Add instructable to: