touchmysound
Published © CC BY-SA

Driving a Stepper Motor Saved from an Old Printer

Disassemble an old printer (in this case a dot matrix) and drive the stepper motor(s) for linear motion or rotation. With Arduino.

EasyProtip2 hours10,268

Things used in this project

Hardware components

Stepper motor driver board A4988
SparkFun Stepper motor driver board A4988
×1
Capacitor 100 µF
Capacitor 100 µF
×1
Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Seikosha SP-2400 Dot Matrix Printer service manual

Original service manual as a reference

Circuit Diagram

Base circuit for controlling a stepper via the A4988 driver.
Dotmatrixsteppermotorcontrol schem smili8zy99

Code

Short pattern for stepper motor

Arduino
This is a test pattern I used. Manually put the head in the middle while the power is off (motor disconnected), so you are (almost) sure the head will not hit the end of the rail.
// DIR = HIGH ----> HEADING RIGHT
// DIR = LOW  ----> HEADING LEFT
// 200 steps = one turn

const int stepPin = 6; //connected to STEP on the A4988
const int dirPin = 5; //connected to DIR on the A4988
 
void setup() {
  pinMode(stepPin,OUTPUT); 
  pinMode(dirPin,OUTPUT);
}
void loop() {

  delay(1000);
  digitalWrite(dirPin,HIGH);          // HIGH and LOW set the direction forward or backwards
  for(int x = 0; x < 100; x++) {      // 100 steps forward (half a turn)
    digitalWrite(stepPin,HIGH);       // one pulse (HIGH for 5 ms)
    delayMicroseconds(5000); 
    digitalWrite(stepPin,LOW); 
    delayMicroseconds(5000); 
    }

     delay(2000);

      digitalWrite(dirPin,LOW);       // Same as before, but reverse direction
  for(int x = 0; x < 100; x++) {
    digitalWrite(stepPin,HIGH); 
    delayMicroseconds(5000); 
    digitalWrite(stepPin,LOW); 
    delayMicroseconds(5000); 
    }
  
  delay(2000);
  
 digitalWrite(dirPin,HIGH);           //Pattern with a short segment back and forth
  for(int x = 0; x < 10; x++) {
    digitalWrite(stepPin,HIGH); 
    delay(10); 
    digitalWrite(stepPin,LOW); 
    delay(10);    }
 digitalWrite(dirPin,LOW);
  for(int x = 0; x < 10; x++) {
    digitalWrite(stepPin,HIGH); 
    delay(10); 
    digitalWrite(stepPin,LOW); 
    delay(10);    }
   digitalWrite(dirPin,HIGH);
  for(int x = 0; x < 10; x++) {
    digitalWrite(stepPin,HIGH); 
    delay(10); 
    digitalWrite(stepPin,LOW); 
    delay(10);    }
 digitalWrite(dirPin,LOW);
   for(int x = 0; x < 10; x++) {
    digitalWrite(stepPin,HIGH); 
    delay(10); 
    digitalWrite(stepPin,LOW); 
    delay(10);    }

     delay(2000);
     
 digitalWrite(dirPin,HIGH);             // Same as before, but faster
  for(int x = 0; x < 15; x++) {
    digitalWrite(stepPin,HIGH); 
    delayMicroseconds(5000); 
    digitalWrite(stepPin,LOW); 
    delayMicroseconds(5000);   }
 digitalWrite(dirPin,LOW);
  for(int x = 0; x < 15; x++) {
    digitalWrite(stepPin,HIGH); 
    delayMicroseconds(5000); 
    digitalWrite(stepPin,LOW); 
    delayMicroseconds(5000);  }
   digitalWrite(dirPin,HIGH);
  for(int x = 0; x < 15; x++) {
    digitalWrite(stepPin,HIGH); 
    delayMicroseconds(5000); 
    digitalWrite(stepPin,LOW); 
    delayMicroseconds(5000);   }
 digitalWrite(dirPin,LOW);
  for(int x = 0; x < 15; x++) {
    digitalWrite(stepPin,HIGH); 
    delayMicroseconds(5000); 
    digitalWrite(stepPin,LOW); 
    delayMicroseconds(5000);  }

    delay(5000);
  }

Credits

touchmysound

touchmysound

1 project • 20 followers
Alessandro Perini's artistic production ranges from audiovisual and light-based works to net-art, land-art and vibration-based works.

Comments