Introduction: Stepper Motor Controlled Stepper Motor | Stepper Motor As a Rotary Encoder

Have a couple of stepper motors lying around and want to do something? In this Instructable, let's use a stepper motor as a rotary encoder to control another stepper motor's position using an Arduino microcontroller. So without further ado, let's get started!

Step 1: Get All the Stuff

Here is what you will require for this project:

  • An Arduino microcontroller board compatible with Adafruit Motor Shield V2(UNO, Leonardo, etc)
  • An Adafruit Motor Shield V2
  • A Rotary encoder Stepper motor(Unipolar is recommended)
  • A stepper motor to be driven(Unipolar or bipolar)
  • 4 male to male jumper wires(For connecting the rotary encoder to the Arduino board)
  • 4 male to male jumper wires(For connecting the stepper motor to the motor shield)
  • A 5 to 12-volt DC power source(As per the requirement of the driven stepper motor)

Step 2: Program the Arduino Microcontroller

Step 3: Install the Motor Shield on the Arduino Board

Align the pins of the motor shield with the headers of the Arduino board and make sure no pins get bent.

Step 4: Connect the Stepper Motor to the Motor Shield

Connect the stepper motor's coil pair wires to the output terminals of the motor shield marked 'M3' and 'M4'.

Step 5: Study the Circuit Schematic

Step 6: Connect the Pushbutton to the Setup

Connect the pushbuttons between 'GND' and 'D12' of the Arduino board.

Step 7: Connect the Controller Stepper Motor to the Amplifier Board

Step 8: Connect the Amplifier Board to the Arduino Board

Connect the +ve and -ve pins of the amplifier to +5-volts(or +3.3-volts if using a 3.3-volt logic Arduino microcontroller) and 'GND' respectively.

Connect the output pins of the amplifier board to the digital inputs 'D5' and 'D6' of the Arduino board.

Step 9: Connect the Setup to Power

Connect the setup to an appropriate DC power source. Here, a mobile phone charger is being used to power the setup through the Arduino board's onboard USB connector.

Step 10: Test the Controls

If the motor to be driven does not move properly and steps back and forth, tighten the wire connections, and if the problem persists, change the sequence of the stepper motor's wiring connections made with the motor shield.

Step 11: Share Your Work

If you have got it working, why not share it with the community. Doing so, will inspire others to make the project too. All the best!