Introduction: Dot Matrix Printer From a CD/DVD Reader With Arduino

About: A eletrical engeneering student, video games lover and hardware aficionado. Starting my journey through the world of electronics. Microcontrollers?! I love them!

Hey!

Some time ago while going through the pages here in Instructables, something catch my attention, a printer made of a CD reader, and i was amazed.

I thought: "This is incredible, I have to make one!"

I know that these kind of projects don't always receive a "I made it", because of its degree of difficulty, so I tried to make mine easier.

This project was started more than a year ago, because of the lack of time i could only work in it while on college recess, but this is great because I finish it during the remix contest, that's fit perfectly in this case. If you think that I deserve your votes in the contests don't be shy and hit the button, I really like your support.;)

Update: Thanks to everybody that voted for me in the contests, you're awesome! I will make new instructables with these amazing prizes.

I also wanted to make this a motivation, I don't even dream of putting my hands in a laser cutter or 3D printer for making my projects, so I made this printer only using my dremel to cut the plastic pieces and gluing them together with super glue.

What can I say? It worked.

Step 1: The Motivation and My Ideas

Lets give a look in the Brunoip's version and compare with mine:

-It uses a Stepper motor to pull the paper, it makes the circuit and programming more complex, but the precision it's very reliable, I used instead a DC motor, making the circuit and programming easier, but losing a bit of the precision offered by the stepper.

-The pen makes a circular(that's the word?!) movement, like a pointer in a clock, I opted for a vertical movement, and instead of using a H bridge chip to moving the motor in both directions, I used only a transistor to lower the pen, making a mechanism with a spring to lift it.

-Brunoip used a pic microcontroller as a brain for its printer, I opted for Arduino because it is easy to code, to program , to buy and is very popular here.

Brunoip, thank you for posting this creative instructable, without it I would never think of making mine ;)

Step 2: Enough Talk, Lets Get the Recicled Parts!

You will need a CD or a DVD Reader/Writer, you can ask for one in the computer repairs workshop next to your house. You need the 'sled' from the DVD/CD reader with the stepper motor and laser module, it will be used to movement the pen mechanism.
The gears for opening the tray I used to make the pen mechanism. Here in my house I have boxes with parts that I toke from these drives for the years, so I not used pieces from only one drive. You can find many precious things in old electronics, think twice before putting them in the trash.

I used a piece of acrylic to make the base, but you can use wood or something like that, it only needs to be flat, that piece was from a friend that kindly gave me(acrylic is costly where I live). You can find a nice acrylic sheet in some LCD monitors, be careful opening them, you may hurt you fingers in some sharp parts.

The wheel used to pull the paper is from a old inkjet printer, You will see that I really like to reuse junk in my projects ;).

Step 3: Parts List (Arduino and Electronics).

Ok, let's see what we will need to control the printer.

To receive the data from computer and control the motors:

1 x Arduino Board (Uno, Nano, Mega.... whatever).

To controlling the DC motors:

2 x Diodes 1N4001 or similar.

2 x TIP120 Transistors (Can be the TIP122 too).

2 x 2.2k ohm Resistors (Red,Red,Red) ;

To control the stepper motor:

1 x L293D Dual bridge IC.

You will need too:

A breadboard, I used two halfs (yeah, i know, is what i had in hands).

Jumper cables.

A 7V power source( you can't power the motors through USB). You can see my converter in the images, I'm using a adjustable module to get 7V from my 12V source.

Step 4: Starting the Hard Work.

*You can put your protection glasses now, i'm serious your eyes are too precious, be careful.*

You will need the laser sled from a CD or DVD reader, if you don't know how to disassemble one don't worry, I have a instructable teaching how to disassemble these drives, you can get some tips there.
Disassembling a CD/DVD reader and reusing its parts.

Hey! don't disassemble the entire driver, check the first picture in this step, this piece we will use to carrying the pen.

First, loose the screws that fix the brushless motor (the one that makes the CD spin), after that, with care, retire the laser module from the structure.

Step 5: A Long and Careful Journey, Disassembling the Laser.

We will need to retire many parts from the laser module, leaving only its structure. It will be use to attach the pen mechanism.

My advice is that you get a these made of plastic, like mine, because you will need to make a whole in it, there are the modules with a metal structure, like the one I disassembled in my other instructable, I think they are hard to drill but not impossible, remember to use protection glasses.

You will have to take all the electronics and glass, be careful here, you can cut yourself or hurt your eyes, see the pictures to know how to proceed, after having only the plastic structure make a hole like in the pictures, where the pen will pass.

Step 6: The Acrilic Pieces.

I made the white acrylic pieces with my dremel and a bench vise, but if you have a 3D printer or a laser cutter it can be easier, I think.

I'm putting here the measures of my pieces just to give you a idea,I think that you will have to make some changes, the holes have to be made according with your gears, motors and other parts.

A 2mm acrylic sheet was used, it was easy to cut and drill with the dremel, to glue the pieces together superglue was used.

I tried to make the models on sketchup, they aren't perfect, but you can see and understand them better.

Step 7: The Paper Pulling Gear

Just gather some gears, they don't need to be exactly from a CD/DVD reader, there are gears in old VHS players, DVD/CD players, electric toys, printers....

The wheel used to pull the paper is from a old inkjet printer, but if you don't have one you can use another thing, let me think............I know! A wheel from a broken RC car or a toy, or another thing, just be creative! It just has to offer friction enough to don't let the paper escape.

Sorry, as I said, this project was started some time ago, because this you can see that the piece already was done, I don't even had a camera when started this project, so I disassembled it to show the most I could.

Step 8: The Pen Mechanism.

This piece makes me proud, it's such a piece of engineering made only with my handy dremel and a bench vise.

The gears I took from DVD players and CD readers and the motor from a CD reader. With the dremel I cut the white pieces of acrylic, using super glue to fix them.

When we apply a voltage in the motor, it makes the pen go down, making a dot in the paper, a spring is used to make pen lift and come back to it's position, this way is possible to control the motor with only a transistor instead of a H bridge.

Step 9: All Your Base Are Belong to Us

The base can be made of acrylic, like mine, but you can use wood too.

Before putting the sled on the base, desolder the cable and put a female header to make easy connect it with jumper cables, if you don't have the female header you can solder wire.

In the image you can see that i out some pieces of plastic to make the paper stay in the right place while printing, I made them with rulers.

I used screws to fix the sled structure on the base, this makes easy regulating its height .

Step 10: Finishing the Mechanics

Ok, let's finish mounting the mechanics.

Put the mechanism for pulling the paper on the base, see how much it is close of it, the wheel must make enough pressure on the paper to don't let it escape, but it can't be too strong, to allowing the paper to slide through the base.

Now you have the mechanics, let's go to electronics and after that to software!

Step 11: The Circuit Schematic.

You can see in the images the circuit, be careful with the polarity of the components.

A TIP 120 transistor is used to drive each DC motor, the L293D is used to controlling the Stepper motor from the CD drive.To power the motors I used a 7V source, using more than that can damage your motors, be careful ;).

Any Arduino board can be used, Mega, UNO, Nano...

You can download the schematics(Fritzing and Eagle) below, it can help if you want to see them better.

Step 12: Mounting the Controller Board.

Follow the schematics on the previous step to connecting the components, be careful with their polarity.

A warning:

The L239D can overheat, damaging your breadboard, this was my first time playing with it so I didn't knew. My breadboard melted a little, but maybe because I left it on for a long time. You can make the circuit on a perfboard(a copper board available in electronics stores with a lot of holes) to be sure not damaging your precious breadboard.

Step 13: About the PC Side.

I'm using processing for processing( hehe) the images and sending them to Arduino. Processing is a great and easy language and tool, I only discovered how good it is a month or two ago.

With processing was very easy read the pixels from the image, and use the serial port too, if you still don't know it and is a maker I really recommend trying it.

Processing is derived from java and also is available to Windows, Linux and Mac.

So what you're waiting to download it?!

Download Processing.

Step 14: Understanding the Processing Sketch

The Processing sketch is small, this is possible because of the good work made by the folks at Processing, making easy to play with images and read its pixels.

What the sketch does is to check every pixels in an image and then sends bytes though the serial port to say if the Arduino board must make a dot or not, or start a new line.

//Written by Robson Couto
//http://dragaosemchama.com.br/
//August 2014.
import processing.serial.*;
Serial myPort;  // Create object from Serial class
PImage IMG; //create a PImage named IMG

void setup() {
  size(60, 118);//Put here the size of your image
  String portName = Serial.list()[0];
  myPort = new Serial(this, portName, 9600);//opens the Serial Port
  IMG = loadImage("link2.jpg");//Open your image, put here the name of your image, including the extension.
  image(IMG, 0, 0);
}
void draw() {
  IMG.loadPixels(); 
  for (int y = 0; y < height; y++) {//check the lines
    for (int x = 0; x < width; x++) { //check each pixel in the line
      int loc = x + y*width; //the pixels are loaded as in a aray, so its position is only a number.
      if (IMG.pixels[loc]>color(128)) {
        myPort.write(0);//if a pixel is not black, send a '0'.
        delay(50);
      }
      else {
        myPort.write(1);//if a pixel is black, send a '1'.  
        delay(50);
      }
    }
    delay(10000);//Wait for some time, time enough to the printer finish this line.
    myPort.write('L');//send a "L" to indicate a new line.
  }
  noLoop();
}

Step 15: Programming the Arduino.

It's necessary burn the Arduino only once, because we'll use the serial port through USB to send the images to the Arduino printing them.

The Arduino receives the bytes from the computer and checks if it has to make a dot or not.

At each dot the pen advances, until it receive a order to start a new line, when the paper moves a little.

Isn't necessary to download any additional library, just the code itself.

//Written by Robson Couto
//http://dragaosemchama.com.br/
//August 2014.

#define time 4 // time in miliseconds between each motor's step
#define pentime 200 //time of the pulse in the pen motor
#define pulltime 6200 //time(in microseconds to allow a alrge range) of the pulse on the motor to pull the paper.

#define penPin 4   //pen motor pin
#define paperPin 5 //paper motor pin

#define StepperA1 9  //stepper motor pins
#define StepperA2 10 //
#define StepperB1 11 //
#define StepperB2 12 //

byte data;//byte to receive and check data from computer
void setup() {            
  Serial.begin(9600);//Start the Serial port.  

  pinMode(StepperA1, OUTPUT);//Stepper motor pins as output
  pinMode(StepperA2, OUTPUT);
  pinMode(StepperB1, OUTPUT);
  pinMode(StepperB2, OUTPUT);

  pinMode(penPin,OUTPUT);//Pen motor pin as a output
  pinMode(paperPin,OUTPUT);//Paper motor pin as a output
  back(80);//makes the car return, to be sure it will start at the begin of the line
}

void loop() {
  if(Serial.available()){//if there is data on the Serial buffer
    while(Serial.available()>0){//continues reading the values on the buffer.
      data=Serial.read();
      if(data==1){
        dot();//if a one was received, makes a dot.
        forward(1);//avances one time (four steps)
      }

      if(data==0){
        forward(1);// if a zero was received just avances.
      }
      if(data=='L'){//if a "L" was received, pull the paper to begin a new line.
        pullPaper();//call the pulling paper function.
        back(80);//return the car.
      }
    }
  }
}
void forward(int number){//forward function, you can choose the number of steps when calling the function
  int i=0;//to control the number of steps
  while(i<number){
    digitalWrite(StepperA1, HIGH); //this sequence is part of the basic algoritm to control a bipolar stepper motor.  
    digitalWrite(StepperA2, LOW);    
    digitalWrite(StepperB1, HIGH);     
    digitalWrite(StepperB2, LOW);     
    delay(time);//wait the time defined.                
    digitalWrite(StepperA1, HIGH);    
    digitalWrite(StepperA2, LOW);     
    digitalWrite(StepperB1, LOW);    
    digitalWrite(StepperB2, HIGH);     
    delay(time);
    digitalWrite(StepperA1, LOW);    
    digitalWrite(StepperA2, HIGH);     
    digitalWrite(StepperB1, LOW);    
    digitalWrite(StepperB2, HIGH);     
    delay(time);
    digitalWrite(StepperA1, LOW);    
    digitalWrite(StepperA2, HIGH);     
    digitalWrite(StepperB1, HIGH);    
    digitalWrite(StepperB2, LOW);     
    delay(time);
    i++;
  }
  digitalWrite(StepperA1, LOW);    
  digitalWrite(StepperA2, LOW);     
  digitalWrite(StepperB1, LOW);    
  digitalWrite(StepperB2, LOW);     

}

void back(int number){//As the forward function, but makes the reverse sequence.
  int i=0;
  while(i<number){
    digitalWrite(StepperA1, LOW);    
    digitalWrite(StepperA2, HIGH);     
    digitalWrite(StepperB1, HIGH);    
    digitalWrite(StepperB2, LOW);     
    delay(time);

    digitalWrite(StepperA1, LOW);    
    digitalWrite(StepperA2, HIGH);     
    digitalWrite(StepperB1, LOW);    
    digitalWrite(StepperB2, HIGH);     
    delay(time);

    digitalWrite(StepperA1, HIGH);    
    digitalWrite(StepperA2, LOW);     
    digitalWrite(StepperB1, LOW);    
    digitalWrite(StepperB2, HIGH);     
    delay(time);

    digitalWrite(StepperA1, HIGH);    
    digitalWrite(StepperA2, LOW);     
    digitalWrite(StepperB1, HIGH);    
    digitalWrite(StepperB2, LOW);     
    delay(time);                 

    i++;
  }
  digitalWrite(StepperA1, LOW);    
  digitalWrite(StepperA2, LOW);     
  digitalWrite(StepperB1, LOW);    
  digitalWrite(StepperB2, LOW);     

}
void dot(void){//actives the pen motor for some time
  digitalWrite(penPin,HIGH);
  delay(pentime);
  digitalWrite(penPin,LOW);
}

void pen(void){                        //this functions can be used if you want to make lines instead of dots,
  digitalWrite(penPin,HIGH);           // I think that the dots are cool.
}                                      //
void nopen(void){                      //
  digitalWrite(penPin,LOW);            //
}                                      //

void pullPaper(void){ //function to pull the paper
  digitalWrite(paperPin,HIGH);
  delayMicroseconds(pulltime);
  digitalWrite(paperPin,LOW);
}

Step 16: Done!

It was a nice and rewarding journey, I learned many things making
this printer, it is a powerful didactic device, let's see what i played with:

The mechanical part is full of physics, the reduction gear is used to offer enough torque to pull the paper and do it slower than the the motor rotation.The spring makes the pen return to its original position, potential energy being nice here.

The electronic part has the Arduino and the components needed to make the motors spin, I learned how to use these stepper motors from old CD drivers using the L293D chip, they are really nice if you want precision.

About programming we have:

  • First contact with Processing, a really nice language.
  • Image processing and matrices(easy thanks to Processing), used to know if a pixel in a image is black or not.
  • Serial communication used to transport the bits from the PC to the Arduino.

And recycling! I love to take apart old electronics and learn about them. You can imagine what kind of cool things that are inside these scraps.

Step 17: Show Your Art! Sharing It With Your Friends!

It actually is yours printer's art, but if you don't say it, i won't say too.

My friends and girlfriend seems to like these printings, they even ask for an character, pokémon, or something they like.

What about you? Make some these and give to someone you like, your friends, girlfriend or boyfriend, crush, little brother, grandpa.... I'm sure they will love.

Well, thanks for reading! And don't forget to vote for me in the contests if you liked my instructable, your support is really nice, these amazing prizes can help me to make new instructables that you may like.

Bye!

Microcontroller Contest

Second Prize in the
Microcontroller Contest

Remix Contest

First Prize in the
Remix Contest

Tech Contest

Runner Up in the
Tech Contest