Skip to content

Arduino library and Fritzing parts for the X113647 stepper board

License

Notifications You must be signed in to change notification settings

iremsinmaz/X113647Stepper

 
 

Repository files navigation

X113647Stepper Arduino Library

The 28BYJ-48 stepper motor and ULN2003A-based X113647 Stepper Motor Driver Board is pretty common in Arduino kits, and available from various suppliers on aliexpress.

  • 28BYJ-48 stepper motor is a unipolar motor with 32 steps and a 64:1 gear reduction drive.
  • the X113647 module is basically just the ULN2003A with additional LEDs and convenience pins for connecting power for the motor.

I've gone into more detail, including Fritzing parts, in the LittleArduinoProjects repository:

Why the X113647Stepper Library?

Although the name is now a bit misleading, this project started as an attempt to address two issues:

  • clarify the pin connections required to work with the 28BYJ-48
  • add a half-step mode, where the standard Stepper library only provides full-step control

I've updated the X113647Stepper library to better reflect these issues. Feel free to borrow and use this library if it helps. In general though, I'd recommend alternatives:

Pin Connections Summary

Most (all?) versions of the 28BYJ-48 expose a consistent Blue-Pink-Yellow-Orange-Red wire sequence at the connector. Red is the common (5V/positive) connection.

The full step sequence required by the 28BYJ-48 for the 4 control lines is:

Step Blue Pink Yellow Orange
1 1 1
2 1 1
3 1 1
4 1 1

The standard Stepper Library implements the following sequence:

Step C0 C1 C2 C3
1 1 0 1 0
2 0 1 1 0
3 0 1 0 1
4 1 0 0 1

It is readily observed that switching Pink/Yellow (C1/C2) aligns things nicely, so we end up with a 1-3-2-4 pin mapping for initializing the standard Stepper library as follows:

Stepper myStepper(STEPS_PER_REVOLUTION, PIN_IN1_BLUE, PIN_IN3_YELLOW, PIN_IN2_PINK, PIN_IN4_ORANGE);

In full-step mode, STEPS_PER_REVOLUTION is 32 (steps) * 64 (gear reduction) i.e. 2048.

Using the X113647Stepper Library

The X113647Stepper class (in the tardate namespace) is virtually a drop-in replacement for the Stepper library.

Basic initialisation (full step mode by default):

tardate::X113647Stepper myStepper(STEPS_PER_REVOLUTION, PIN_IN1_BLUE, PIN_IN2_PINK, PIN_IN3_YELLOW, PIN_IN4_ORANGE);

Or add the StepMode parameter. For example, half-step:

tardate::X113647Stepper myStepper(STEPS_PER_REVOLUTION, PIN_IN1_BLUE, PIN_IN2_PINK, PIN_IN3_YELLOW, PIN_IN4_ORANGE, tardate::StepMode::HalfStep);

Example sketches:

Construction

The stepper motor and driver will typically draw at least 130mA at 5V with HalfStepSweep, and over 250mA at 5V with WithStepperLibrary, so it is not particularly advisable to power directly from the Arduino's regulated supply.

The Build

Note the crossover of the wires eminating from the 28BYJ-48. This is actually done in the wiring of the standard connector provided with the stepper motor - but I haven't included this detail in the part as yet.

Schematic

The X113647

Credits and References

About

Arduino library and Fritzing parts for the X113647 stepper board

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 100.0%