Stepper motors come in two flavors: unipolar and bipolar. The designations refer to how the coils within are driven, of course. In this exercise we'll see how to put a unipolar unit through its paces.
Since this is a starting point, we'll do things the easy way with the 28BYJ-48 module which is ubiquitous and inexpensive. Best of all, it comes with the Darlington drivers included, meaning we can just wire it to the PIC directly and not have to worry about the current requirements which run about 150 mA. The circuit is, therefore, trivial:
This is a 4-phase, 8-pulse affair. If you check out the PMP source code (which is heavily documented), you'll find that the magic lies within an eight cell array, each cell containing the four-bit number which selects the correct coil.
The 28BYJ-48 is a gear driven unit. Thus, its pulling power is quite good for such a low amperage, at the expense of speed.
Would you like to see it in operation? I stuck a toothpick on the spindle so you can easily see what it's up to.
One last thing, I got my module from Amazon for about $4. Apparently the device is used extensively in all sorts of commercial apparatus, hence the low price (thanks to the high volume).
Click to get the source code.
Click to get the schematic PDF.
Next Project: Unipolar Stepper Motor #2