Power supply and USB connected

New to arduinos here.

I'm looking to run a stepper motor off a Hbridge motor shield with a DC power supply as input to the shield. Whenever I have both the USB (from my PC) and the power supply connected (power to the motor shield Vin, and ground back to power supply) the ground gets extremely hot and smokes the wire. This happens at any voltage. e.g. 3v to the motor shield.

I followed this:

Except with the power supply to the motor shield power pins. (I tried the DC jack in the arduino too and this failed aswell)

https://forum.arduino.cc/index.php?topic=512358.0

I've done some reading that I should be able to have both the USB and the power supply connected, but they need to share a common ground. I'm unsure of how to do this or to test until I find a solid answer in fear of blowing the arduino.

The power supply I am using is :

Here is the code:

#include <Stepper.h>

const int stepsPerRevolution = 240;  // change this to fit the number of steps per revolution
                                     // for your motor

// initialize the stepper library using the default pins on the HBridge Shield:
Stepper myStepper(stepsPerRevolution, 4, 7, 3, 2);
//Stepper myStepper_b(stepsPerRevolution, 11, 10, 9, 8);


void setup() {
  // set the speed at 200 rpm:
  myStepper.setSpeed(200);
  //myStepper_b.setSpeed(200);
  // initialize the serial port:
  Serial.begin(9600);
}

void loop() {
  // step one revolution  in one direction:
  Serial.println("clockwise");
  myStepper.step(stepsPerRevolution);
  delay(1000);
  //myStepper_b.step(stepsPerRevolution);
  //delay(1000);
   // step one revolution in the other direction:
  Serial.println("counterclockwise");
  myStepper.step(-stepsPerRevolution);
  delay(1000); 

  //myStepper_b.step(stepsPerRevolution);
}

Could this be an issue with different ground values from the PC and from the power supply causing a current flow? How could I test this?

Thanks

You mean red wire ?

As in the 4 motor wires and USB connection are the same as in that pic. The power supply is however into the two pins in the motor shield which are unused in that pic (above the red wire).

I've also tried that exact same setup and yet the ground back to my power supply still smokes.

Is there any sound coming from motor ?

The motor works as intended when connected with the power supply only and the arduino. e.g. I upload sketch, unplug from usb and then plug into power supply. When I turn on the system with the usb connected it fries the ground cable. I turned it off in a rush as flames occur within ~2 seconds so didn't see if the motor was running/making sound.

kinsey:
I turn on the system with the usb connected it fries the ground cable.

Which wire is that on the picture

The black one is going back to my DC power supply ground

I think the problem is some interference to the program, those motors if dont get right pulses they do not rotate and they get hot.
The test - make some changes i n the program, disable some lines using " // " motor should not rotate and get hot, check that.

Hi I commented parts of the code (all digital/analogue writes) and tested with blink. It does now safely work with the USB and the power supply.

Note ive added pictures of the exact setup and my arduino.
I've tested it on another model with same results.

What might this mean? Could my wiring for the motor be wrong?

Can't tell for sure from the fuzzy pic, but looks like the + (RED) wire is on the - (negative) connector. (wrong).
Never mind, looks OK after a better pair of goggles. :slight_smile:
What size wire are you using? Did you use an Ohmmeter to make sure the motor wires were paired correctly?

Optionally fit the jumper to the header marked “Bridge VIN To Motor Power”.

Did you remove this jumper?

outsider:
Can't tell for sure from the fuzzy pic, but looks like the + (RED) wire is on the - (negative) connector. (wrong).
Never mind, looks OK after a better pair of goggles. :slight_smile:
What size wire are you using? Did you use an Ohmmeter to make sure the motor wires were paired correctly?Did you remove this jumper?

No I hadn't ! Would this cause this sort of problem?

I think you not understand what I was telling you.
Make this test - connect USB cable but do not open arduino IDE - is the wire hot ?

What is the maximum speed of your motor, can it go 10x faster ?
Just curious.

ted:
I think you not understand what I was telling you.
Make this test - connect USB cable but do not open arduino IDE - is the wire hot ?

When the usb cable is connected and nothing is open the cable melts immediately (as soon as I hit on on the power supply) if the sketch loaded is the motor sketch. Otherwise its fine.

I'm not sure about the max speed.

It's this motor.
https://abra-electronics.com/3d-printers-en/electronics-en/stepper-motors/nema-17/sm-42bygo11-25-stepper-motor-with-cable-sm-42bygo11-25.html

Thanks for all your help

Measure the voltages, no USB cable

Set up limit current on your power supply to 100mA, apply voltage to black/red wires.
Start with 0V and go upto slowly 30V, the current should be 0 mA when you stop for a moment increasing the voltage.