Introduction: Cheap Arduino Controlled 3-Axis Pen Plotter

Picture of Cheap Arduino Controlled 3-Axis Pen Plotter

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;



mohammad-arar (author)2014-05-12

here is my version :D

what is the code the you use

mkarim5 (author)2017-01-05

How can i use gcode ...u dont mansion this

davidhend (author)mkarim52017-01-09

For this project I did not use Gcode to create the image; instead program draws from binary data.

There are pen plotter on instructables that do use gcode though, you can search their site for "gcode + plotter" and will find lots of examples. Have fun & good luck.

BenjaminM71 (author)2016-02-09

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

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.

During the loop, I have edited the Pen Up and down to the following:

void penDown()


//if the pen is raised

if (z_pos == 0){

//move the pen to the paper



z_pos = 20;



void penUp()


//if the pen against the paper

if(z_pos == 20){

//move pen away from paper



z_pos = 0;



Do you know what I've been doing wrong?

davidhend (author)BenjaminM712016-02-11

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 "PWM" (pulse-width-modulation) capable pin. On a Arduino UNO those pins are, 3,5,6,9,10,11.

With that in mind, you could modify the following line: 'servoZ.attach(8);' to

'servoZ.attach(9);' and connect your servo to Pin 9. Good luck.

RenatoS5 (author)2015-02-09

Is it possible to use this for 3d printing?

davidhend (author)RenatoS52015-02-17

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.

RenatoS5 (author)davidhend2015-02-19

I'll try and post the results.

JacobK1 (author)2014-10-23

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?

INVENTORMOHAMED (author)2014-10-21

from where can i download the steps sorry im new in this site :)

larocca (author)2014-10-21

Here my version:

amorgan18 (author)2014-09-11

Olá, como faço para criar outros códigos para gerar outras imagens, algum programa que converta imagens em códigos binários, ou algo do tipo, Obrigado...

davidhend (author)amorgan182014-09-11

No código de exemplo, eu inseridos manualmente os dados binários para fazer a imagem . Você pode fazer o mesmo se quiser, eu não olhei para ver se o seu é um programa para automatizar a tarefa ; pode valer a pena uma pesquisa. Boa sorte e se divertir.

agentjenks (author)2014-08-01

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

davidhend (author)agentjenks2014-08-04

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.

agentjenks (author)davidhend2014-08-05


zextron (author)2014-07-10

Here is mine! Thanks for sharing!

davidhend (author)zextron2014-07-10

That's really cool; thanks for sharing also : )

gmoenik (author)2014-05-26

Next Step GCode.. rsrsrs!..

ade angelis (author)2014-04-15

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 "word image" in the code defines motor's movements, but how do I get them drawing something else? Would this project work with GRBL?

Thanks a lot!

davidhend (author)ade angelis2014-04-16

The "word image" is where the drawing is stored. The program will read the word image data and will lower the pen it reads a "1" and raise the pen if it reads "0". So to change what the program draws you only need to change the 0's & 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) & stepperZ.step(83). I hope that makes sense, let me know if you need anything explained in more detail.

asygoogle (author)davidhend2014-05-05

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?


ade angelis (author)davidhend2014-04-16

Ok, now it's clear how the drawing is programmed. If I'm not mistaken "stepperX.step(10), stepperY.step(10)" means that X and Y make 10 steps, and basically decide how long a dash the pen has to draw, right?

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?

Thank you very much!

davidhend (author)ade angelis2014-04-17

You are exactly right.

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:

He provides code that interrupts GRBL and shows you his control setup; Have fun.

Sara Pires (author)2014-03-03


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?

Sorry and thanks!

mohammad-arar (author)2014-03-01

I built my own one :) ,, thanks for your efforts

but how can I make the picture larger than 16 bit ??

can you write to me a quote of a Code ???
which type of data should be used ?

Mailok (author)2014-01-24

Nice work! I am missing how to build the third axis, it seems you used just 2 motors, but instructables says "3 axis". Thank you!

davidhend (author)Mailok2014-01-24

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.

For the bottom plate, one motor moves the CD-tray forward. The other motor & 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.

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.

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.

Mailok (author)davidhend2014-01-24

I understand now, thank you :)

cwhiseant (author)2014-01-14

For circuit diagrams, try

online, has simulation, and for free! Also has a pretty good selection of public circuit designs.

ggraikousis (author)2013-12-10

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 ??
I am looking forward for full electrical plans
thanks !!!

ggraikousis (author)2013-12-10

in first pic you have 3 Capacitors but in electrical plan you use 6 (2 for each Voltage Regulator (LM317) )
Witch one is correct ??

davidhend (author)ggraikousis2013-12-10

Thanks for bringing that to my attention; 3 will work just fine, 6 is a little bit overkill.

Eduardo Mello da Silva (author)2013-10-12

Olá Davidhend! Eu estou tentando fazer o carregamento e aperas se este recado:Este recurso está disponível apenas com a Pro adesã este recado, Torne-se um membro do Pro hoje! mas já sou membro porque lhe envia a minha dúvida eu fui obrigado a me tornar membro do Pro, eu baixei em WinRar mas e quando estou descompactando não existe nada na pasta, talvez eu esteja descompactando de forma errada, eu lhe peço mais essa ajudinha por favor me ajude, porque eu sou muito grato por você ter me respondido na minha primeira dúvida e agora eu conto com a sua ajuda outra vês, espero não estar te incomodando porque eu poderei precisar de sua ajuda outras vezes e sei que você não vai negar. Abraços

Sinto muito que você está tendo esse problema, eu postei o código no tutorial agora. Se você re-visitar o tutotial você pode simplesmente copiar e colar o programa. Deixe-me saber se você tem mais problmes e se divertir. mais tarde

Eduardo Mello da Silva (author)2013-10-09

Olá! Eu pretendo baixar mas a minha dúvida é: se eu baixar vem todos os desenhos elétricos de ligações completos os que tem nesta página e com o programa já feito com o arduino? Por favor me tire essas dúvidas p mim poder baixar, eu fico muito agradecido á você meu amigo. Abraços

Se bem entendi o programa arduino é completa, você pode fazer o upload do esboço ao arduino sem modificação. Ele vai chamar um homem segurando as mãos. É possível alterar o que chama a chaning os dados binários no topo do programa.

rcardoso5 (author)2013-09-13

how can i test the motors from the cdrom? like step motor or i need something more

davidhend (author)rcardoso52013-09-14

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.

Tony32 (author)2013-09-11

Hello! I really love the idea, it's so cheap and a good starter "CNC" 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.
Please let me know!

davidhend (author)Tony322013-09-14

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.

rcardoso5 (author)2013-08-11

can i change the SN754410NE for another drive? i have one l293

davidhend (author)rcardoso52013-08-12

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.

Have fun - David

alihureiby (author)2013-07-09

yes, i know it like this
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.
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

alihureiby (author)2013-07-08

heii. is the uno can controlled 4 axis?

davidhend (author)alihureiby2013-07-09

If I understand correctly; the arduino uno can control 4-axis's or even more.

HEFEX (author)2013-05-19

Hey can any one write more algorithms to try it on. It be very helpful.

bengusx (author)2013-04-13

dear davidhend
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
thank you

davidhend (author)bengusx2013-04-13

It's actually quite easy to do row/column scanning. It consists of two nested for loops, what that means is this:

// x-axis (row's)
for(int x = 0; x > 10; x++){
// y-axis (columns)
for(int y = 0; y > 10; y++){


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 & y around so that you do a full column and then increment the row.

I hope this helps you & good luck.

Thanks - David

About This Instructable




More by davidhend:Car Coolant Temperature AlarmArduino Mega HexapodTeensy Ambilight
Add instructable to: