ESP8266 and Stepper motor example

In this example we will show a basic stepper motor example, we use a driver board that can be bought on many sites which basically comprises of a ULN2003 IC and a few other components, you can use either 5v or 12v, the motor that comes quite often with this board is a 5v type, you can see it further down the page.

Here is the board that I used for this example and here are the connections

Wemos D5 -> IN1
Wemos D6 -> IN2
Wemos D7 ->IN3
Wemos D8 -> IN4

 

Diameter: 28mm; Voltage: 5V; Step angles: 5.625 x 1/64; Speed reduction ratio: 1/64; Power consumption: About 5V / 63mA; Load pull in frequency: >500Hz; Load pull out frequency: > 900Hz; 5-wire 4-phase can be driven with an ordinary ULN2003A chip

I powered the module externally

There are other similar boards where the motor is separate from the board but its the same stepper motor and it uses a ULN2003

 

Code

The code uses the built in stepper library, this is a fairly basic example

 

#include <Stepper.h>
 
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
 
// initialize the stepper library on pins D5 to D8
Stepper myStepper(stepsPerRevolution, D5,D6,D7,D8);
 
int stepCount = 0; // number of steps the motor has taken
 
void setup() {
 
}
 
void loop() {
// step one step:
myStepper.step(1);
stepCount++;
delay(100);
}

 

 

Links

5V 4-phase Stepper Motor+ Driver Board ULN2003

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  

  

  

*