Following chapter is a very high overview. Please read further down about more practical info about the drive and motor types. But basics presented here is pretty universal and widely used in DIY community.
So- what we need to get these motors going? Let’s break it down to components and explain each part briefly. Commonly you need following parts to drive a stepper motor.
- Power supply
I didn’t include a power supply for (micro)controller here since it’s self-explanatory. A microcontroller like in this case Arduino- gets its power from the USB cable or battery.
Stepper Motor Driver
As we know- stepping motor can be moved one step at a time by applying electricity to coils in the correct order (and polarities). You could do this manually with some switches– step by step, but it has no practical use other than learning. This is where the driver comes into play.
The driver is doing the heavy lifting and it hides all the complexity behind a simple interface. It makes correct windings to be excited in the correct way based on the input signals. They usually have only 2 input pins which take commands in form of digital high and low. One sets the direction of rotation and other is for step commands.
Steps are given as digital pulses. After each step (HIGH) there must be (LOW) input for a moment. So drive can detect when new step command is given. If there is are no pulses given- there will be no steps done by the drive and motor.
Direction input pin can be LOW or HIGH all the time, while steps are made, depending on the direction needed. Direction does not need impulses.
Note: Some small unipolar stepper motors are driven via transistor arrays or chips like uln2003 and ln2004. There can be 4 control wires instead of 2 from the microcontroller. In that configuration, the microcontroller is directly telling which wires (coils) to energize by turning correct ones on each step “manually”. Look at example schema on the Arduino page.
It’s possible to make motors move by touching the step pin on driver manually with HIGH wire. But that would not be very practical other than testing. This is why microcontroller comes into play. Microcontrollers can give many hundreds or even thousands of impulses per second so the motor can be rotated very fast and accurate.