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

by KushagraK7 in Circuits > Arduino

10353 Views, 96 Favorites, 0 Comments

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

Cover image.JPG

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!

Get All the Stuff

IMG_2545.JPG
IMG_2548.JPG

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)

Program the Arduino Microcontroller

Arduino code.PNG

Install the Motor Shield on the Arduino Board

IMG_2546.JPG

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

Connect the Stepper Motor to the Motor Shield

IMG_2549.JPG

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

Study the Circuit Schematic

Stepper motor controlled stepper motor.PNG
Circuit schematic.png

Connect the Pushbutton to the Setup

IMG_2550.JPG

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

Connect the Controller Stepper Motor to the Amplifier Board

IMG_2551.JPG
IMG_2552.JPG

Connect the Amplifier Board to the Arduino Board

IMG_2553.JPG
IMG_2554.JPG

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.

Connect the Setup to Power

IMG_2555.JPG

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.

Test the Controls

Stepper Motor Controlled Stepper Motor | Stepper Motor as Rotary Encoder | Arduino

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.

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!