Cheap Arduino Controlled 3-Axis Pen Plotter

87K16766

Intro: 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     CostTotal
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:

//Beginning

#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] = {
  0b0000001110000000,
  0b0010011111000100,
  0b0010001110000100,
  0b0010000100000100,
  0b0011111111111100,
  0b0000011111000000,
  0b0000011111000000,
  0b0000001110000000,
  0b0000011111000000,
  0b0000011111000000,
  0b0000110001100000,
  0b0001100000110000,
  0b0001100000110000,
  0b0011100000111000,
  0b0011100000111000,
  0b1111111111111111
};


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);
  delay(2000);
}

void loop()
{

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

      penUp();

      stepperX.step(-x_inc);
      x_inc = 0; 

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

          penDown();

          //move X-Axis forward 5 steps for each bit in the array
          stepperX.step(10);
          x_inc = x_inc + 10;
          delay(15);
        }
        else{

          penUp();

          //move X-Axis forward 5 steps for each bit in the array
          stepperX.step(10);
          x_inc = x_inc + 10;
          delay(15);

        }
      }

      penUp();

      //Position Y-Axis for next row
      stepperY.step(10);
      y_inc = y_inc + 10;
      delay(15);
    }

  penUp();

  //Return X/Y-Axis back to home position
  stepperX.step(-x_inc);
  stepperY.step(-y_inc);

  //Endless Loop
  while(1){
  }

}


void penDown()
{
  //if the pen is raised
  if (z_pos == 0){
    //move the pen to the paper
    stepperZ.step(83); 
    delay(15);
    z_pos = 83;
  }
}

void penUp()
{
  //if the pen against the paper
  if(z_pos == 83){
    //move pen away from paper
    stepperZ.step(-83);
    delay(15);
    z_pos = 0;
  }
}

//END

66 Comments

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

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.

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

servo.write(20);

delay(15);

z_pos = 20;

}

}

void penUp()

{

//if the pen against the paper

if(z_pos == 20){

//move pen away from paper

servo.write(-20);

delay(15);

z_pos = 0;

}

}

Do you know what I've been doing wrong?

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.

Is it possible to use this for 3d printing?

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.

I'll try and post the results.

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?

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

Here my version:

https://www.facebook.com/video.php?v=10152419138433225&l=4664614081476599468

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

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.

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

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.

Here is mine! Thanks for sharing!

http://youtu.be/70jekaZHsSQ

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

Next Step GCode.. rsrsrs!..

More Comments