I’m more of a software guy. So when it came time to hook up my stepper motor, I was very concerned that it wouldn’t work, and I’d have no idea how to troubleshoot it.
But I persevered, it worked (as seen on my earlier post) – and so I’m documenting step by step how you can get your stepper motor working on the Arduino.
First off, the setup. I used an Arduino Duemilanove, a 28BYJ-48 stepper motor, and a ULN2003 driver board – all of which I . Here’s the motor and board:
The easy part is this connection – there’s only one way for the motor to plug in:
As far as the board, there’s just a few things to remember:
- Everything should be powered off. No power into the board, no running Arduino, nothing. Always disconnect everything before changing or rewiring as well.
- The board jumper stays put. I used a 5 volt stepper motor, and so didn’t change anything. I actually don’t know if the jumper is used for higher voltages, or what; however, unless you’re using a different motor rating, leave the jumper as is (and if you are, sorry this tutorial can’t be of more help).
- The +/-5V for these terminals actually caused me a lot of grief. I knew you had to run separate power for the motors, but how to do it exactly was a problem (in theory you could use the power from the Arduino, but the Internet is full of horror stories from people who tried and failed). In the end, I found an adjustable power plug I had lying around, set it to 4.5v (5v wasn’t available as a setting), and connected the two power wires to the two pins on the stepper board.
- Trying to figure out plus and minus power in the rat’s nest of cables I was using was not fun. However, here’s a tip: using your multimeter set up properly, the black wire will be negative, or ground, unless you connected something wrong and got a reverse reading on your multimeter. Test, and don’t rely on black always being ground, since a mistake can burn out components!
- The four pins from the board to the Arduino are labelled IN1 through IN4 – connect these to the Arduino pins 8 through 11. I recommend you be consistent: IN1 to 8, IN2 to 9, etc. If you’re using a cable then of course it will be simpler.
By the way, the biggest problem was not the hardware setup, but the wiring: the pins on the stepper board required plugs (female connectors) and the pins on the Arduino required pins (male connectors). I’d ordered more cables, but that didn’t help now; scrounging around I was able to find some parts to cut up. However, if possible, get the proper connectors at the same time you get the board – you’ll be glad you did.