HomeSpan/docs/StepperDrivers/Stepper_ULN2003A.md

2.8 KiB
Raw Blame History

Stepper_ULN2003A

This is a derived class of StepperControl designed to operate stepper motors driven by a Texas Instruments ULN2003A (or equivalent) chip.

The Texas Instruments ULN2003A chip containins an array of seven Darlington transistor pairs each capable of converting low-voltage/low-current digital signals into higher-voltage/higher-current outputs suitable for driving a stepper motor.1

Various manufacturers have incorporated this chip into a dedicated stepper motor board designed to drive unipolar motors such the 28BYJ48 5Volt Stepper and 28BYJ48 12Volt Stepper. Wiring for the Opencircuit ULN2003 Stepper Motor Driver Board that uses this chip is as follows:

Power Connections2

  • - connect to an external DC power supply that will drive stepper motor (5-12V)
  • - connect to GND on the ESP32, and to ground of external DC power supply

Motor Connections

  • plug the motor directly into the board's 5-pin connector

Control Connections

  • IN1, IN2, IN3, IN4 - connect to four digital pins on the ESP32 - used to step the motor in either direction

The Stepper_ULN2003A class includes the following constructors:

  • Stepper_ULN2003A(int IN1, int IN2, int IN3, int IN4)
    • controls the driver board using only 4 digital pins from the ESP32, where the parameters specify the pin numbers. Supports the following step type modes:

      • FULL_STEP_ONE_PHASE
      • FULL_STEP_TWO_PHASE
      • HALF_STEP

Note: The ULN2003A chip does not support a short brake state. Calls to the brake() method, as well as setting the endAction parameter in the move() and moveTo() methods to StepperControl::BRAKE have no effect on the motor driver.

[!TIP] If you set the motor to move very slowly (e.g. 500ms per step) you will be able to track how the current is turned on and off for each phase of the motor coils depending on the step mode selected by observing the four LEDs (labeled A, B, C, D) built into the driver board. See also this Last Minute Engineers Tutorial for a detailed presentation of the ULN2003A and its use to drive a 28BYJ48 5Volt Stepper Motor.


↩️ Back to the Stepper Motor Control page


  1. Only four of the seven Darlington transistor pairs in the ULN2003A are needed to drive a typical unipolar stepper motor. ↩︎

  2. the ULN2003A is a passive chip - there is no VCC power connection between the driver board and the ESP32 ↩︎