Miniature stepper motor

  • Expansion board for stepper motor drivers and, in fact, the driver itself. I took A4988.

Expansion board with driver

Expansion board with driver

Stepper motor

Stepper motor

Debugging (connection)

My task was not difficult, I needed to achieve precise positioning (movement at a given angle), because this is one of the advantages for which we use stepper motors.
I will not go into detail about what a stepper motor is and the principle of its operation; there is plenty of this information on the Internet. I will only say that I have a 2-phase stepper, and therefore its design uses two windings.

Shagovichok

Shagovichok

Stepper motors come in different configurations. It came to me exactly as in the picture. I would say half-baked. Soldering enthusiasts will love working with this. A housing with miniature pins protruding from it. When overheated, these pins gracefully fly out of the plastic case, after which their reassembly is almost impossible. That's why I recommend immediately look with a soldered adapter, save most of the nervous system.
By the way, this picture is all I had for these steps, and I don’t need more. I know where entrance And exit each phase. But still, call just in case and find these same input and output of each phase.

Now let’s figure out where to connect the wires soldered to the stepper to the expansion board.

Contacts

Contacts

I think anyone who has a multimeter can easily identify these contacts. Why is it important to identify them, because in the picture with the stepper there is A+ A- B+ B-, and on the driver and expansion board the designation is A2 A1 B2 B1. This was the most difficult thing I had to face. Sit and think about where and what to connect.
Below is a very important picture that helped me solve this problem.

As we can see, one winding must be connected to pins 2B and 2A, and another to 1A and 1B. And this is the most important thing that we need to know when connecting.

Driver pins

Driver pins

Connection summary:

Connection

Connection

Debugging (program)

I didn't reinvent the wheel, because Hoover (AlexGyver) has an excellent library for working with stepper motors. Although, there I also had to try and read a lot of things in order for the program to work as I needed.

#define DRIVER_STEP_TIME 2 

#include "GyverStepper.h"
GStepper< STEPPER2WIRE> stepper(22, 2, 3);  //Точно калибруется тут (1-ый параметр)

void setup() {
  stepper.setMaxSpeed(50);   // установка максимальной скорости по модулю в шагах/секунду, тип данных float.
  stepper.setTargetDeg(180);  // отправляем на 180 градусов
}
void loop() {
  while (stepper.tick());     // ждём, когда мотор доедет
  stepper.setTargetDeg(0);    // отправляем на 0 градусов
  while (stepper.tick());     // ждём, когда мотор доедет
  stepper.setTargetDeg(270);  // отправляем на 270 градусов
}

Since I needed positioning, the whole problem was here:

GStepper< STEPPER2WIRE> stepper(22, 2, 3);

The first parameter in brackets is the number of steps per revolution. And this parameter must be taken from the documentation for the engine. This very documentation on my stepper I didn't find it anywhere. Therefore, I selected this parameter empirically. Perhaps it is +-1, I measured the angle by eye.
It is worth noting that this parameter will change when changing the microstep on the expansion board (red box with switches).

End

I hope this article will simplify the path of a beginner in mastering stepper motors.

Express debugging

Express debugging

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *