Articles on: Learning & FAQ

Can You Send Me A Schematic That How to Wire The Stepper Driver to An Arduino?

Please follow below steps to connect stepper driver to Arduino:

Connect driver's DIR+ and PUL+ to Arduino's digital port. eg. PIN8 and PIN9.
Connect PUL- and DIR- to Arduino's GND.
Write program on your computer by pointing PIN8 and PIN9 to DIR and PUL.
Download the program to Arduino, and power Arduino by 5V power supply.

Below schematic diagram is showing the basic connection of Arduino, stepper driver, power supply and stepper motor.

We also provide a simple demo code.
int x;
void setup() {
pinMode(9,OUTPUT); // set Pin9 as PUL
pinMode(8,OUTPUT); // set Pin8 as DIR
void loop() {
digitalWrite(8,HIGH); // set high level direction
for(x = 0; x < 400; x++) // repeat 400 times a revolution when setting 400 on driver
digitalWrite(9,HIGH); // Output high
delayMicroseconds(500); // set rotate speed
digitalWrite(9,LOW); // Output low
delayMicroseconds(500); // set rotate speed
delay(1000); //pause 1 second
digitalWrite(8,LOW); // set high level direction
for(x = 0; x < 400; x++)


The code uses the pinMode() function to set Pin9 as PUL (pulse) and Pin8 as DIR (direction). This is a common configuration for stepper motors.
The loop() function contains two for loops that control the motor. The first loop sets the direction to HIGH and rotates the motor 400 steps using the digitalWrite() function and delayMicroseconds() function to control the speed. The second loop sets the direction to LOW and rotates the motor another 400 steps using the same technique.
There is a delay() function after each for loop, which pauses the program for 1 second.

Updated on: 31/10/2023

Was this article helpful?

Share your feedback


Thank you!