Monday, May 11, 2015

Automating CD Driver Stepper Motor Using IR Sensor





Take a look at this video you know what is project is all about.



I had a CD driver which has not been used for a very long time with me, I removed the case and opened the lens carriage, I thought of using it for a portable plotter before going for the exact idea I wanted to operate the motor automatically with IR sensors , that's how this project was started. It was so much of fun doing this, where you can easily do this project less than $10 if you have arduino with you.



I started it by removing the upper case of the CD driver, which is really easy to do, in the bottom of the driver it had some 4 screws to remove, you don't need to be a professional for doing this kind of job, anyone can do it. 




This lens carriage is the only part that required for this project, apart from this lens carriage there are also a CD Open and closer mechanism and a motor also present inside this CD driver which I can use for some other project. 


If possible remove the stepper motor from the lens carriage, which would allow us to easily solder the stepper motor, or you can also solder without removing it. 



connect the stepper motor to the L293d Motor driver , complete the circuit with the help of the above fritzing .

Arduino Program: 
// I have modified the stepper one revolution program, you can also write your own version for this, programming a stepper with arduino is really easy with the available library, If you are using this project Easy stepper driver Please note this program will not work for it, you need modification for it, please leave a comment , I can also upload the program for easy drive if you really need it.


------------------------------------------------------------------------------------------------------------------------------
#include <Stepper.h>

int motor = 1;

const int stepsPerRevolution = 180;  // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  // set the speed at 60 rpm:
  myStepper.setSpeed(60);
  // initialize the serial port:
  Serial.begin(9600);
}

void loop() {
  // step one revolution  in one direction:
  int sensor1 = digitalRead(2);
  int sensor2 = digitalRead(3);
  
  if(sensor1 == HIGH && sensor2 == LOW){
    motor = 1;
  }
  
  if (sensor1 == LOW && sensor2 == HIGH){
   motor = 2;}
  
   
    if(motor ==1){
  Serial.println("clockwise");
  myStepper.step(stepsPerRevolution);
  delay(5);
  }
  // step one revolution in the other direction:
  else
{
  Serial.println("counterclockwise");
  myStepper.step(-stepsPerRevolution);
  delay(5);}
}

--------------------------------------------------------------------------------------------------------------------------------

alternatively you can download the same program here

You can also make your own IR sensor following the video below: 


IR sensors are easily available in all the online electronics and hobbyist shops, you can also make your own IR sensor with just a dollar. 

2 comments :

  1. Hi! great project! how can'I put a pot to control the speed of step motor? i'm an arduino beginner!

    ReplyDelete
  2. How do I wire the stepper motor - I have one from the store and it has 5 pins ? How do I figure which pin is what ?
    My servo has 5 pins and your diagram has 6 ? Appreciate any help on debugging the servo hardware.

    ReplyDelete