Arduino Pro Mini rebooting when initializing stepper motors

I'm having trouble with an Arduino that appears to be constantly rebooting. The setup is attached. Hardware is:

  • Lolin NodeMCU v3
  • Deek-Robot Arduino Pro Mini 3.3v
  • 28byj-48 5v steppers
  • ULN2003 Driver boards
  • XL6009 DC-DC boost module

Overview: NodeMCU provides 3.3v output to power the Pro Mini. It connects to an MQTT server for commands, and parses those commands and sends motor id and position updates to the Pro Mini via SoftwareSerial. Pro Mini handles all of the stepper motors.

Power is delivered by a 5v 2A USB charger (Samsung Adaptive Fast charger, testing shows it doesn't limit current). Initially, I was powering the steppers from the NodeMCU's VUSB pin, which passes through the USB voltage. However, the NodeMCU board seemed to be getting pretty hot, and I was having issues with the steppers missing steps. The ULN2003 has a voltage drop of about 1v, which means the steppers were actually only getting 4v, so I decided to try providing 6v to the ULN2003 boards. I initially tested with a completely separate 9v supply with a buck converter set to 6v, and that worked great, so I grabbed some boost converters.

Now I'm splitting the USB power to the NodeMCU and the XL6009, and boosting the power to the steppers up to 6v. When I plug it in, the LEDs on the ULN2003 boards all briefly blink, then shut off, then repeat that ad-nauseam. However, if I unplug 2 or 3 of the 4 stepper motors from the driver boards, it will boot up.

Here's the really weird part (to me, at least): I figured doing some serial debugging would be useful, so I hooked my FTDI board to the Pro Mini, and it powered up fine with all motors connected. I can then unplug the FTDI board and it will continue functioning. I also discovered that I can plug in the unplugged stepper motors after startup, and that works too.

Some other info: I'm using the AccelStepper class, but I've written my own derived class from that which overrides some methods and adds some other new methods. (For example, I've overridden the run() and move() methods to disable the output pins when the motor is done moving and re-enable before moving, since I care about limiting power usage and don't need the holding torque. So I'm not sure how useful posting my code will be, but I'm happy to provide anything desired. Here's the main part of my code, at least:

#include "ClockHand.h"
#include <SoftwareSerial.h>

#define STEPS 4096
#define MODE 8
#define SPEED 500
#define POSITIONS 13

#define SERBUFFER 8

ClockHand one = ClockHand(true, POSITIONS, SPEED, STEPS, MODE, 2, 4, 3, 5);
ClockHand two = ClockHand(false, POSITIONS, SPEED, STEPS, MODE, 6, 8, 7, 9);
ClockHand three = ClockHand(true, POSITIONS, SPEED, STEPS, MODE, 10, 12, 11, 13);
ClockHand four = ClockHand(false, POSITIONS, SPEED, STEPS, MODE, 14, 16, 15, 17);
ClockHand *active;

SoftwareSerial ser(A5, A4);
char cmd[SERBUFFER];
boolean newData = false;

void setup() {
  Serial.begin(9600);
  ser.begin(9600);
  Serial.println("Startup complete.");
}

void loop() {

  serReceive();
  if(newData) {
    processCommand();
    newData = false;
  }

  one.run();
  two.run();
  three.run();
  four.run();
}

Any suggestions? Am I doing something dumb with my power setup? Thanks in advance!

You're overloading your USB supply. Have you measured the current consumption of the boost converter with loads connected? I suspect it overloads the USB rail which then shuts down for a short while.

And you might want to review how you are connecting the grounds.

MarkT:
You're overloading your USB supply. Have you measured the current consumption of the boost converter with loads connected? I suspect it overloads the USB rail which then shuts down for a short while.

I measured the current consumption of the steppers during operation when they were running on 5v, and they used around 600mA total. However, I completely neglected to measure them in this setup, or at startup to see if there's any inrush current. I just assumed that since the NodeMCU kept running, the power supply was still supplying a steady 5v. All of my voltages (5v supply, regulated 3.3v, and 6v boosted) all read steady on my multimeter. But you're right, I should definitely check the current draw again.

Idahowalker:
And you might want to review how you are connecting the grounds.

How so? I did verify that the In- and Out- on the boost converter are one and the same. Is there anything else I should consider?

MarkT:
You're overloading your USB supply. Have you measured the current consumption of the boost converter with loads connected? I suspect it overloads the USB rail which then shuts down for a short while.

I just measured the current draw of the entire system from the USB supply. It fluctuates, of course, but the highest number I saw on my multimeter was about 370mA.

The boost converter itself is rated for 4A (link here).

Edit: I just tried running everything from a 22W, non-USB supply. I'm getting the same behavior with the Arduino rebooting.

Keep all 4 steppers connected, comment out the code for all but one motors, does the uController keep running? Un-comment a 2nd one and so an and so forth. Does it work with only one motor active, 2, 3, 4? From your descriptions the issue could be running out of RAM that the program runs in.


I, initially, thought of a possible ground connection issue.

Idahowalker:
Keep all 4 steppers connected, comment out the code for all but one motors, does the uController keep running? Un-comment a 2nd one and so an and so forth. Does it work with only one motor active, 2, 3, 4? From your descriptions the issue could be running out of RAM that the program runs in.


I, initially, thought of a possible ground connection issue.

The code ran fine with a different power setup, so I'm certain it isn't a RAM issue. And I can unplug some of the motors, boot it up, then plug the motors back in and it functions.

UPDATE:
I used a spare Arduino Uno as a cheap oscilloscope, and scoped the main input voltage. Every time my Arduino rebooted, I saw a quick voltage drop. So I tested another one of the boost converters with a high-power multi-tap resistor with 2.5, 5, 7.5, and 10 ohm options. When I drew enough current on the output, I suddenly got a huge inrush current and drop in voltage on the supply side. So, looks like MarkT was right! So the boost converter is out. I'll probably give up using a USB-based supply and switch to a 6V 2A supply.

Interesting note: Samsung Adaptive Fast Chargers are similar to, but not identical to, Qualcomm QuickChargers. The output is listed as 5V 2A, or 9V 1.67A. It defaults to 5V, but can be switched to 9V with a special, but unpublished, handshake on the data pins. I breadboarded up the recommended circuit for QC2 (using modified resistor values, but the set9v() function did nothing. I figured I'd try the set12v() funcion just to see what would happen, since the voltage levels more closely matched what I scoped on the data lines with a phone that successfully requested 9V, and... I got 12V out of my adapter! It seems that at least some Samsung AFCs are able to output 12v if the device asks for it. Part of me is tempted to do that and step it down to 6V, but it seems like simpler is probably the better option here.

Anyway, thanks for the help both of you, especially MarkT for nailing the problem!