How to drive a stepper motor using Arduino microcontroller. For this project, additionally to the microcontroller and also the stepper motor, an L298N H-bridge module is necessary.

Stepper Motor

With a stepper motor you can “step” precisely an applied angle. Further, a stepper motor can hold its current position once it’s not moving. Although stepper motors are obtainable in unipolar and bipolar varieties, the bipolar type is the strongest one in the stepper motor. Bipolar stepper motor typically has four leads connected to 2 sets of internal electromagnetic coils. The “stepping” is achieved by changing the direction of current through the coils.

stepper motor

Stepper motor

Stepper Motor Driver

Stepper motors don’t seem to be like straightforward dc motors and can’t be driven by feeding simply a dc voltage. Dedicated driver circuit (and quite often a microcontroller) is required to control the speed and direction of a stepper motor. Here, i’m using a pre-wired L298N H-bridge dual motor driver module as the stepper motor driver. The module is basically a “standalone” type which includes power connectors, flywheel diodes, visual indicators, and even an onboard voltage regulator chip. I am sure, this can be the proper way to save money, time, and effort!

stepper motor controller module

Stepper motor controller module

Arduino Controller Hookup

My initial experiment was administered with the help of a 12V bipolar stepper motor. Based on that experimentation, instructions are given below for you to proceed along with your own experiments. Firstly, Connect the twin-wires (A-B) from the stepper motor to the driver module connection points MA+, MA-, MB+ and MB- respectively. Leave all jumpers of the driver module in place, and connect the headers IN1, IN2, IN3 and IN4 to Arduino digital pins D8, D9, D10 and D11 respectively. Next, connect Arduino GND to point GND , and Arduino Vin to +5V OUT point to the module. Finally, connect a 12V/1A external power supply to points +12V IN and GND of the driver module.

ASD-4

Now you can control the stepper motor from your sketches, thanks to the built-in Stepper library within the Arduino IDE. For testing, you can load the stepper_oneRevolutionsketch included with the Stepper library. thus have fun and build something amazing!