Nodemcu esp8266 : Driving a 28BYJ-48 stepper using ULN2003


I needed a simple LUA module (with callbacks) that I can use to drive the cheap 28BYJ-48 & ULN2003 Combo for automating a Candy Jar. I did search online around to see if there is a readymade one available. when I couldn’t find any exact matches, Just wrote a Lua module based on bits and pieces I found online. Hope you find it useful. Feel free create an issue in Github project or get in touch with me for any feature requests.


With this Lua module, you can drive a stepper motor in 3 lines like this

stepper  = require ('stepper')
stepper.init({5,6,7,8}) --pin numbers to which the uln2003 is connected
stepper.rotate(stepper.FORWARD,2500,5,0,function () print('Rotation done.') end)

As you can see, this is an async module. your code should trigger rotate and let the module asynchronously and trigger your callback after completing the rotation.


Any nodemcu gpio pins should work. here is the combination that worked for me.

D5 IN1
D6 IN2
D7 IN3
D8 IN4

Fig : Connection Diagram for 28BYJ-48 Stepper motor using ULN2003 driver with nodemcu esp8266


Here are two good links that helped me understand how to get the stepper working


One thought on “Nodemcu esp8266 : Driving a 28BYJ-48 stepper using ULN2003

  1. I have checked your page and i have found some duplicate
    content, that’s why you don’t rank high in google’s search
    results, but there is a tool that can help you to create 100% unique
    content, search for; Best article rewritwer Ercannou’s essential

Leave a Reply

Your email address will not be published. Required fields are marked *