Set up works on breadboard but not with direct connections

Hi there-
I'm working on an art project that involves a stepper motor activated by an ultrasonic distance sensor. I have my small stepper (28BYJ-48 5V) hooked up to the driver. The driver is powered by a 3.3V 5V Power Supply Module that is plugged into a 12V wall plug.
The whole set up works seamlessly when connected to a large breadboard, the kind with 60 rows. If I put the set up into a breadboard half the size it won't work. I tried using a solder-able bread board as well as jumper cables directly to the power module. In both instances the stepper motor gets power and tries to step but can't. The lights on the driver indicate that the information is being sent, but not enough power is being transmitted.
I've tested the voltage in all 3 set ups, it's always 5V or just under.
Can anybody explain what might be happening? I'm pretty confused about this. Any insight would be appreciated.

When it worked, was the Arduino still connected to the PC and the USB connector?

Paul

Yes (it's a mac), Arduino is connected to the computer at all times so far.

caorline:
Yes (it's a mac), Arduino is connected to the computer at all times so far.

And ALL the grounds are connected to a single location?

Paul

Yes.
I guess at this point I'm thinking that it is a code-related problem. I found most of the source code online and tweaked a few things.

If the same code and components work perfectly in one setup but not when you change just the physical layout then it’s extremely unlikely to be a code problem. It’s either power or wiring.

Perhaps it would help if you say exactly what components you are using…what Arduino, motor driver, motor, sensor and particularly the “3.3V 5V Power Supply” and “12V wall plug”. Datasheets or at least links to the components would be good.

Steve

I’m using:
-arduino uno
-HC-SR04 sensor
-28BYJ-48 5V Stepper motor
-ULN2003 Driver Board
-HiLetgo 3.3V 5V Power Supply Module for MB102 102 Prototype Breadboard DC 6.5-12V or USB Power Supply Module
( https://www.amazon.com/gp/product/B00HJ6AE72/ref=ppx_yo_dt_b_asin_title_o01_s01?ie=UTF8&psc=1 )
-60 row breadboard
-Wall Adapter Power Supply - 12VDC 600mA

One thing to point out is that I have 2 types of power modules. One came with an Arduino starter pack and the other 4 I got from amazon. I want to only use the new 4. The original power module, despite being labeled as a 3.3V 5V is putting off nearly 10V. The other brand is working as expected an emitting about 5V.

The only success I’ve had with using the smaller breadboard/ jumper cables was with the high voltage emitting power source. But I’m worried that one will cause issues with the driver and arduino. So it seems like the whole setup works when the power module is giving off too much voltage… which leads me to believe that maybe somewhere in the code it’s calling for too much to happen? I found the code on the arduino forum and tweaked a few things, but there’s a few lines that I can’t figure out :confused:

Thanks for the input so far, Steve! It’s much appreciated.

Also, here’s the code just for good measure:

#define IN1  8
#define IN2  9
#define IN3  10
#define IN4  11
#define STEPS_PER_ROTATION 4096

const int pingPin = 12;
const int echoPin = 13;
unsigned int duration, inches;


void setup()
{

  pinMode(12,OUTPUT);
  pinMode(13,INPUT);
  Serial.begin(9600);
  Serial.println("File From Distance Test");

}

void ping()  {
  digitalWrite(pingPin, LOW);        // Ensure pin is low
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);       // Start ranging
  delayMicroseconds(5);              //   with 5 microsecond burst
  digitalWrite(pingPin, LOW);        // End ranging

  duration = pulseIn(echoPin, HIGH); // Read echo pulse
  inches = duration / 74 / 2;        // Convert to inches
  Serial.println(inches);            // Display result
  if ((inches>2) && (inches<30)) 
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
  delay(400);

}

void loop() {
  delay(50);
  ping();
  if ((inches>2) && (inches<30)) {
    rotate(1.5);
    delay(400);
    rotate(-2);
    delay(400);
  }
}
  
  void rotate(float rotations) {
    rotate_steps(rotations * STEPS_PER_ROTATION);
  }

  int phase = 0;
  byte phases[] = { 
    1, 3, 2, 6, 4, 12, 8, 9   };

  void rotate_steps(int steps)
  {
    int dir = (steps > 0) - (steps < 0);
    steps *= dir;
    long laststep;
    for (int i = 0; i < steps;) {
      long now = micros();
      if (now - laststep < 1000) continue;
      laststep = now;
      stepper_writepins(phases[phase]);
      phase = (8 + phase + dir) % 8;
      i++;
    }
    stepper_writepins(0);
  }

  void stepper_writepins(int bitmap) {
    digitalWrite(IN1, bitmap & 8 ? HIGH : LOW);
    digitalWrite(IN2, bitmap & 4 ? HIGH : LOW);
    digitalWrite(IN3, bitmap & 2 ? HIGH : LOW);
    digitalWrite(IN4, bitmap & 1 ? HIGH : LOW);
  }

Here's a simple setup, no breadboard required. Try that, prove that the stepper and driver still work https://www.makerguides.com/28byj-48-stepper-motor-arduino-tutorial/
I am not familiar with this specific stepper or driver, but it could be friction in the gearbox in your particular motor, if it won't start. Generally, voltages for steppers don't matter much, since the voltage to the windings are pulsed, e.g. 'more industrial type' of 5V 4A motor uses a 70V power supply. Perhaps a data sheet read may help you.
It is most likely a hardware or wiring fault as mentioned by others, or physical damage if everything else and the code has not changed between breadboard changes.
(I can't verify the link I've given as working well, but at first glance it seems to be worth what you pay for it)

Beware cheapo hookup wires for breadboard use often cannot carry much current at all, being hair-thin.

All the stepper-motor connections should be using wire capable of enough current, and connected securely - a loose connection to a stepper motor winding can burn out the driver chip rapidly. Soldering, screw terminals,
decent connectors are all better than breadboarding for this case.