본문 바로가기

Electronics

CDROM drive stepper motor hack




This is not an application of CDROM drive stepper, but just a trial of controlling the stepper with Arduino controller board.

You should know about Arduino board to do this hack. Arduino is famous open source micro-controller board.

I used L293D motor driver chip in this circuit. You can drive one bipolar stepper or two DC motors with this L293D chip.
Input is variable resistance potentiometer. I connected it to the Arduino analog port 0. Potentiometer act as voltage divider. You can change input voltage into Arduino Analog 0 with the potentiometer from 0v to 5V. 

But potentiometer input is very unstable, so you have to do something to stabilize it, or the stepper is tend to clutter. There are some methods to stabilize input data. I did averaging the last 10 data. Averaging is simplest way to stabilize. But the performance is not so good. There are still some clutters in this circuit.

There are three motors in CDROM drive. One is spindle motor that is brushless DC motor and the other is pick-up motor that is stepper motor and another is tray drive motor that is normal DC motor.

The motor in this hack is pick-up motor.


 

You should connect earth of this circuit to Arduino ground(earth) port. 

And Arduino code here 

#include <Stepper.h>

int pot[10];

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

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 8, 9, 10, 11);

// the previous reading from the analog input
int previous = 0;

void setup()
{
  // set the speed of the motor 
  stepper.setSpeed(200);
  Serial.begin(9600);
}

void loop()
{

  //averaging the last values to suppress clutter 
  int sum = 0;
  for (int i= 0; i<9; i ++)
  {
    pot[i]= pot[i+1];
    sum = sum + pot[i];
  }
  // get the sensor value
  pot[9] = analogRead(0);
  sum = sum+pot[9];
  int diff = sum / 100;
  Serial.print(pot[9]);Serial.print("\t");
  Serial.print(diff);Serial.print("\t");
  int val = previous - diff;
  Serial.println(val);  
  stepper.step(val);  
  // remember the previous value of the sensor
  previous = diff;
}