Drive CD-ROM Stepper Motor with Arduino + L293d shield

cd-rom-stepper-motor arduino driver shield

Here is I am shearing the code for drive a CD-Rom Stepper Motor. You can also watch the demo video.

To drive stepper motor I am using…

  • Arduino UNO
  • Adafruit driver shield (L293d driver shield)
  • CD Rom stepper motor

You have to connect the stepper motor to driver shield.

Subscribe to our channel to get cool projects!


Here is the arduino code.

#include <AFMotor.h>
// Motor with 200 steps per rev (1.8 degree)
// to motor port #1 (M1 and M2)
AF_Stepper motor(200, 2);
void setup() {
// set up Serial library at 9600 bps
Serial.println(“Stepper test!”);
motor.setSpeed(4 00); // 50 rpm
void loop() {

Serial.println(“Micrsostep steps”);
motor.step(50, FORWARD, MICROSTEP);
motor.step(50, BACKWARD, MICROSTEP);
motor.step(100, FORWARD, MICROSTEP);
motor.step(100, BACKWARD, MICROSTEP);
motor.step(200, FORWARD, MICROSTEP);
motor.step(200, BACKWARD, MICROSTEP);
motor.step(250, FORWARD, MICROSTEP);
motor.step(250, BACKWARD, MICROSTEP);

motor.step(3, FORWARD, MICROSTEP);
motor.step(3, BACKWARD, MICROSTEP);

Related Post

  1. Rhayan 2 years ago

    Helped a lot , thanks.

  2. CoolDann 2 years ago

    Can show me in a graphic how can I connect the stepper motor to driver shield?


  3. xuân hồi 2 years ago

    hello D project I need to use one motor step
    cycle works as follows. Press 1 stepper motor is run with 180-degree rotation and stop at that. While pressing 2 rotary step motor with reverse rotation as well with 180 degree rotation and stop there
    I use Arduino & L298N
    thank D

  4. hugo cruz 2 years ago

    tanks friend,

  5. Omar 1 year ago

    Thank you for the code and sharing, i learned a lot whit it, just to let you know (im a newbie) i had an error in the code (my bad) in this line:
    motor.setSpeed(4 00); // 50 rpm

    because of the space between the 4 and 00 😉

    Thank you!

Leave a reply

Your email address will not be published. Required fields are marked *



Log in with your credentials


Forgot your details?


Create Account