0
\$\begingroup\$

I have a project that requires 3 stepper motors driven by A4988 and NodeMCU V3 LoLin (ESP32). I 3D printed a panel to mount my components. Since I have 3 seperate A4988 drivers one for each motor I wanted to mount them on a nice development board. This way I can have a single point of connection for power supply and can use the more rugged cable-to-pin headers and have a easier way of mounting capacitors.

However I'm experiencing very weird problems. But first here is the schematic and the actual images of the board:
Gray cables are GND, Orange cables are +

enter image description here

I have a cordless drill 20V 5Ah battery from it I pull 4 cables, two go directly to the development board and connect directly to the motor power supply pins between them is a 100uF capacitor for each A4988.

Second two cables go to a LM2596 which reduce the voltage down to 5V for the circuit supply. From the negative cable I also pull a cable to the ESP32 own GND for common ground.

Pictures: enter image description hereenter image description here

Note: As you can see the cables are a bit short for the chipset +/GND so what I did is I connected the GND of the A4988 on the right to the GND of the A4988 in the middle. I did the same for the GND of the middle unit I connected it to GND of the left side A4988 and from there directly to the - cable coming from LM2596 which also has a cable going to ESP32 GND.

Note 2: I did similar for the positive/+ wire but just for the A4988 on the right its +/positive is connected to the positive/+ of the A4988 on the left.

Code:

#include "AccelStepper.h"

#define motorInterfaceType 1

// AccelStepper ballFeederStepper = AccelStepper(motorInterfaceType, D0, D1);
AccelStepper angleStepper = AccelStepper(motorInterfaceType, D2, D3);
// AccelStepper turnStepper = AccelStepper(motorInterfaceType, D4, D5);

void setup() {
  angleStepper.setMaxSpeed(100);

  // ballFeederStepper.setMaxSpeed(4000);

  // turnStepper.setMaxSpeed(4000);
  // turnStepper.setAcceleration(200);
}

void loop() {
  angleStepper.setSpeed(30);
  angleStepper.runSpeed();
  // ballFeederStepper.setSpeed(1600);
  // ballFeederStepper.runSpeed();
  // turnStepper.setSpeed(1000);
  // turnStepper.runSpeed();
}

Code is very simple and works. Continuously spinning the motors. This is just the test code.

The issues:

  • Motor RPM setSpeed()/setMaxSpeed() cannot go above 1600 value even tho this was possible before breadboard.
  • If I connect only a single motor to any of the 3 A4988 than RPM reaches 1600 at least it does spin fast but wont go above 1600 value. However the motor does have decent amount of torque. However if I connect a second motor to the left A4988 that has a tiny weight on it it jitters or moves very slowly or does not move and just beeps indicating low torque.
  • In the code above only a single motor should turn in my test I had a motor that should be running connected to the left A4988 and a second motor connected to the middle A4988 driver and even tho code was disabled for the second motor while the motor on the first A4988 was running very poorly with little torque the second was was jittering and trying to spin.

Additionally:

  • The battery is fully powered and should provide sufficient current and voltage to move the motors. The motors are NEMA17 HS4401 1.7A. I have set the VREF on all 3 to a little above 0.9242 but it makes no difference for torque or speed if I increase or decrease it.
  • On the top cable-to-pin connector it seems its sufficient to just connect the + wire for some reason
  • During chipset/motor operation I have tested out the voltage on motor power supply pins and chipset power supply pins on each A4988 voltage is sufficient and stable.
\$\endgroup\$
3
  • \$\begingroup\$ For one thing, your circuit diagram and your code don't match up. Diagram shows A0 and D0 to U3, D1 and D2 to U2; code shows D2 and D3 to U2. I can't see the control lines in your pictures. \$\endgroup\$
    – Paul
    Commented Feb 6 at 14:20
  • \$\begingroup\$ @Paul It's just symbolic but it goes like this: Right motor: DIR->D1, STEP->D0, Middle motor: DIR->D3, STEP->D2, Left moro: DIR->D5, STEP->D4 But these wires or the A1, A2, B1, B2 wires to motors aren't and issue motors do spin and I can control the direction and speed easily. The issue is motor performance. \$\endgroup\$ Commented Feb 6 at 16:35
  • \$\begingroup\$ Is it the intended use of the library to call setSpeed() and runSpeed() over and over again in a very fast loop several million times per second? \$\endgroup\$
    – Jens
    Commented Feb 7 at 2:24

0