Arduino-based step/dir driver for unipolar motors ULN2003

Just wanted to share very simple thing with community. Sometimes you don't have step/dir motor driver to drive your unipolar motor right here right now. Temporary solution can be to use arduino as software step/dir driver.

I tried to google it somewhere, but couldn't find existing solution and wrote this very simple sketch. I hope it can help someone.

I have my step/dir drivers still somewhere in postman's satchel on the way from China. And I wanted to start using my cnc engraver made of scrap parts from old printers and dvd right now. I use GRBL on arduino as controller which supports only step/dir drivers, the only thing was missing - motor drivers themselves.

While waiting for drivers I just took spare arduino uno and made it work as step/dir driver for my unipolar motors. I used ULN2803/ULN2003 to drive motors. Its okay in case motors are not very powerful.

How to connect motor using uln2003/uln2803: example circuits

Sketch is on github: SoftwareStepDirUnipolarDriver

You are free to use it in any way you want.

Thanks a lot!!! i am now in the same situation, i´ll try your sketch.


I added some lines and change others to add the z axis. If you are interested , i can send you the sketch. You need to add one library. Still using only the ic ULN2803 as driver (actually 3 (because my motor´s amp) ), and nothing more.

hey AndreKravcenko

I'm french so sorry for the language

I very want your code please

To be clear…: that’s not my code. I just updated the code from A Viktorov ( post owner) to 3 axis.
Read entire to understand and follow the diagram :

Link with my modification is there !
G.L. !!!