Monday, March 11, 2013

Stepper motor is alive!

A few weeks ago I got from ebay a couple stepper motors with driver boards, like this one. I tried to make them work with my Arduino using the stepper library that comes with the IDE, setting the pins directly, using a couple methods I found on the web but no matter what I did, the motors worked very jerkily, noisy and didn't really rotate the way I expected to. I gave up thinking the motors I have are somehow defective - I know, the probability of both being defective was really small but I could think of nothing else to try.

Again, Adafruit came to the rescue with this Raspberry Pi Lesson 10: Stepper Motors. At first, I was a bit thrown off by the fact that Simon Monk, the author of this lesson (and countless others, as great as this one) uses a ULN2803 to drive the motor while my boards from ebay use ULN2003. But a quick search on the web reveals that they are very similar, ULN2803 having one more input/output compared to the ULN2003. Encouraged by the fact that the chips on my boards use sockets and they are not soldered directly (this was a very nice thing the chinese manufacturer did), I decided to give it a try. Wired everything as in the lesson I just mentioned and it worked from the first try. Now that it worked on my RasPi, I decided to give it a try on Arduino as well, and same wiring and very similar code worked from the first try as well. Which shows that my problems were all along related to the way the driver boards are wired. It took me a while to figure this out but I'm happy I did.

Again, as I said before, I am in debt to Adafruit for all the help they offer to beginners like me! Thank you so much!

As a side note, I haven't done any awesome project with the stepper but I was able to use it on my RasPi as a NinjaBlock module, the code and some notes are here. I know I said this before but it bears repeating: the Ninja Blocks guys are simply awesome for letting people without a real block to still use the dashboard to play, experiment and learn this way. Thank you!

No comments:

Post a Comment