28BYJ-48: everything you need to know about this stepper motor

28BYJ-48 stepper motor

One of the most popular stepper motors is the 28BYJ-48. After the article published in this blog, you should already know everything you need about this type of precision stepper motors. This allows them to have a multitude of applications, from industrial, to robotics, to many others that you can think of.

The 28BYJ-48 is a small single-pole stepper motor, and easy to integrate with Arduino, as it has a driver/controller module model ULN2003A that is usually included with it. All for a very cheap price and a quite compact size. These features also make it ideal to start practicing with these devices.

28BYJ-48 Features

28BYJ-48

The 28BYJ-498 motor is a stepper motor that has the following features:Type: stepper motor or single-pole stepper

  • Phases: 4 (full step), as there are 4 coils inside.
  • Resistance: 50 Ω.
  • Torque: 34 N/m, that is, if the Newton per meter is passed to Kg, it would be a force equivalent to putting about 0.34 Kg per cm on its axis. Enough to lift with a pulley just over a quarter of a kilo.
  • Consumption: 55 mA
  • Steps per turn: 8 half steps (45º each)
  • Integrated reducer: yes, 1/64, so it divides each step into 64 smaller ones for greater precision, therefore, it reaches 512 steps of 0.7º each. Or you can also see it as 256 full steps per turn.

Full or half steps, or full and half steps, are the modes you can work with. If you remember, in the article on stepper motors I said that the code example for Arduino IDE was worked in full torque.

For more information, you can download their datasheet, such as for example this one. As for the pinout, you don’t have to worry too much, although you can also see information in the datasheet of the model you have bought. But this concrete has a connection that allows you to connect all the cables at once, without worrying about polarization or where each one goes, just insert in the controller and that’s it…

Driver module ULN2003

As for the controller or motor driver included with this 28BYJ-48 motor, you have the ULN2003A, one of the most popular and you can use it with Arduino very easily. It has a Darlington transistor array that supports up to 500mA and it has connection pins to link the 4 coils with pins of the Arduino board numbered from IN1 to IN4, as you saw in the stepper motor article I mentioned before. From Arduino, you can have wires from pin 5v and GND to the two pins of the controller module board marked as -+ (5-12v) to power the board and the stepper motor.

ULN2003A chip pinout and circuit

By the way, with the Darlington transistors it is allowed to use a pair of bipolar transistors placed together and acting as a single transistor. This greatly increases the gain of the signal on the resulting single “transistor”, and also allows higher currents and voltages to be conducted.

The par Darlington, as the single “transistor” formed by the combination of two bipolar transistors is known. It originated in the Bell Labs in 1952, by Sidney Darlington, hence its name. These transistors are connected in such a way that one NPN has its collector connected to the collector of the second NPN transistor. While the emitter of the first one goes to the base of the second one. That is, the resulting transistor or pair has three connections as a single transistor. The base of the first transistor and the collector/emitter of the second transistor .

Where to buy the engine

engine package 28BYJ-48

You can find them in many stores specialized in electronics, and also online like Amazon. For example, you can buy them at:

  • For about 6 ? you can have an .
  • and cables for their connections, in case you need more than one motor for the robot or project you are doing…

Programming 28BYJ-48 with Arduino

 

Arduino with stepper motor and controller

First of all, you should have clear concepts of a stepper motor, so I recommend you to read the article of Hwlibre about these elements. These motors are not designed to be fed continuously, but to be polarized in its different phases so that they advance only the degrees that we want. To excite the phases and control the rotation of the shaft, you have to be feeding properly each connection.

The manufacturer recommends to excite 2 coils each time.

  • To run at maximum torque, with the fastest speed and maximum consumption, you can use this table:
Step Coil A Bobble B Coil C Coil D
1 HIGH HIGH LOW LOW
2 LOW HIGH HIGH LOW
3 LOW LOW HIGH HIGH
4 HIGH LOW LOW HIGH
  • To excite only one coil at a time, and operate in wave drive mode (half torque, but low power consumption), you could use the following table:
Step Coil A Bobble B Coil C Coil D
1 HIGH LOW LOW LOW
2 LOW HIGH LOW LOW
3 LOW LOW HIGH LOW
4 LOW LOW LOW HIGH
  • Or for medium advances (half steps), you can use this other to achieve greater turning accuracy in shorter steps:
Step Coil A Bobble B Coil C Coil D
1 HIGH LOW LOW LOW
2 HIGH HIGH LOW LOW
3 LOW HIGH LOW LOW
4 LOW HIGH HIGH LOW
5 LOW LOW HIGH LOW
6 LOW LOW HIGH HIGH
7 LOW LOW LOW HIGH
8 LOW LOW LOW HIGH

And you can think… what does this have to do with Arduino’s programming? Well, a lot, since you can create an array with the values in Arduino IDE to make the engine move at will, and then use that array in a loop or when you need it… Taking into account that LOW=0 and HIGH=1, i.e. no voltage or high voltage, you can create the signals that Arduino must send to the controller to drive the motor. For example, to make medium steps you could use the code for the matrix:


int Step [ 8 ][ 4 ] =
     { {1, 0, 0, 0},
        {1, 1, 0, 0},
        {0, 1, 0, 0},
        {0, 1, 1, 0},
        {0, 0, 1, 0},
        {0, 0, 1, 1},
        {0, 0, 0, 1},
        {1, 0, 0, 1} };

That is, for the full code of the Arduino IDE sketch, you can use this basic example to test how the 28BYJ-48 stepper motor works. With it, you will be able to rotate the motor shaft once you have the whole sketch connected properly. Try modifying the values or altering the code for the application you need in your case:


// Define pins connected to the driver coils
#define IN1 8
#define IN2 9
#define IN3 10
#define IN4 11

// Sequence of steps at maximum engine torque. It's actually a matrix representing the unipolar table I've shown before
int step [4][4] =
{
  {1, 1, 0, 0},
  {0, 1, 1, 0},
  {0, 0, 1, 1},
  {1, 0, 0, 1}
};

void setup()
{
  // All pins are configured as output, since the motor will not send signal to Arduino
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
}

// Loop to make it turn
void loop()
{
    for (int i = 0; i < 4; i++)
    {
      digitalWrite(IN1, step [i][0]);
      digitalWrite(IN2, step[i][1]);
      digitalWrite(IN3, step[i][2]);
      digitalWrite(IN4, step[i][3]);
      delay(10);
    }
}

As you can see, in this case it would work with maximum torque by activating the coils in pairs…

Leave a Comment

*

*