Friday, August 17, 2018

Stepper Motor - Direct Connect

This entry covers direct connecting a stepper motor to the Arduino.  In this case it is common to use a ULN2003 board to simplify the wiring interface.



As shown above, the stepper motor connects via a key'ed interface to the ULN2003 which is externally powered.  Then the Arduino connects to the ULN2003 via data lines only.

Wiring

Digital pins are connected between the ULN2003 and the Arduino.  Power is connected via the Power Supply Module.  Note they all have common grounds.

Code

The sketch examples to use is:

  • Examples > Stepper > stepper_oneRevolution
  • Examples > Stepper > stepper_speedControl

The pins should already be correct per the sketch if the following wiring diagram is used above.
  • setSpeed(#) // 0-100
  • stepsPerRevoluion(200)
Note that with the wiring specified above, the stepper instance needs to be initialized a little different for it to work:

  • Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11);

No comments:

Post a Comment