Arduino to ground cable burns. USB + power supply

I am having problems connecting my arduino to a motor shield with the USB powering the arduino and a variable power supply powering the shield / motor. I want to power a stepper motor and control it by sending serial data via usb.

#include <Stepper.h>

const int stepsPerRevolution = 200;  // 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, 8, 9, 10, 11);

void setup() {
  // set the speed at 200 rpm:
  myStepper.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);
   // step one revolution in the other direction:
  Serial.println("counterclockwise");
  myStepper.step(-stepsPerRevolution);
  delay(1000); 
}

It works when I power the arduino with the 5v output from the shield however not when I have both USB + power supply connected.

I have the supply connected at 9v however the problem occurs at any voltage.
I have checked and double checked everything and have friend 2 arduinos and a couple of usb ports this way :(.

It is the yellow wire in the photo attached that fries immediately when connecting the USB or power (both order has same result).

The arduino is a chinese clone. https://www.instructables.com/id/How-to-fix-bad-Chinese-Arduino-clones/
However I have tested this on a freetronics leonardo and had the same result.

I am using a L298N H-bridge to try and power / control the motor.

https://tronixlabs.com.au/news/tutorial-l298n-dual-motor-controller-module-2a-and-arduino/

The variable power supply:

Could this be something about having two DC supplies. i.e. my computer and the power supply connected to the main AC house circuit?

Also, I am using the V- terminal on the power supply as the common ground. Should I be using the GND terminal? I get very weird values when measuring voltages using the GND terminal and V+.

I'm from a software background so my electrical knowledge is not great. Any help would be greatly appreciated.

Also, I am using the V- terminal on the power supply as the common ground. Should I be using the GND terminal?

Do you mean you are strapping the supply negative output (black) to mains ground (yellow)?

Is the USB supply isolated? If not try letting the variable power supply float (remove the strap).

MarkT:
Do you mean you are strapping the supply negative output (black) to mains ground (yellow)?

Is the USB supply isolated? If not try letting the variable power supply float (remove the strap).

No the middle GND terminal in my power supply has nothing connected to it. Should there be?

And no, the usb supply is not isolated to my knowledge. Does this mean mains isolated? I've had it connected to my computers moniter and (blew a port) a usb hub and neither have worked.

Eric1313:
No the middle GND terminal in my power supply has nothing connected to it. Should there be?

It didn't come pre-strapped to the black terminal? You are sure its not strapped across?

Normally you would use the ground strap for safety - ie not have the supply floating, but sometimes
you need a floating supply, or a negative supply (strapping the red terminal to ground).

If its a very cheap supply it might not be isolated in the first place even - you can easily check with a
multimeter.

And no, the usb supply is not isolated to my knowledge. Does this mean mains isolated? I've had it connected to my computers moniter and (blew a port) a usb hub and neither have worked.

Again, multimeter time.

That could be a tracking supply when you set it for 5 volts the black minus terminal is a -5volts.

No there

MarkT:
It didn't come pre-strapped to the black terminal? You are sure its not strapped across?

Normally you would use the ground strap for safety - ie not have the supply floating, but sometimes
you need a floating supply, or a negative supply (strapping the red terminal to ground).

If its a very cheap supply it might not be isolated in the first place even - you can easily check with a
multimeter.Again, multimeter time.

The power supply is exactly as pictured above. i.e. no strap between the yellow and black terminals.
How might I go about testing this with a multimeter? Is this by testing resistance between the terminals?

Should I test this with GND connected to V- also?

Use the ground terminal not the black minus terminal. Then you'll have common grounds.

No, use the supply with ground not connected and see if the problem is solved.

MarkT:
No, use the supply with ground not connected and see if the problem is solved.

This is what I have been doing and it's the case when it causes it the Arduino -> V- (power supply) cable to heat up instantly and melt/catch alignt. There is no connecter between V- and GND.

Sorry if my terminology is poor.

noweare:
Use the ground terminal not the black minus terminal. Then you'll have common grounds.

I measured the voltage across V+ and GND on the power supply when its set to 5V and as soon as I connect it the reading on the power supply jumps to ~50V and the multimeter is at anywhere between -10 and -30V.
I'm guessing this isn't expected?

I'm not too keen to plug my arduino into this until I fully understand what's going on. The power supply isn't meant to even reach 50V..
might this be a dodgy power supply? Can anyone reccomend a good mains isolated power supply?

Your last result is not good. Based on that I think your supply is broke.
I would just use a wall mount power supply with no load connected to the motor just to get something working. I don't know about you but I save all the power supplies and have a bunch to use for projects.

Lots of power supplies don't like being connected to computers. They have different means of connecting grounds. That is why we use isolators to convey signals between devices connected to computers. If you float the ground on the computer it should prevent the current loop from pulling that current from the power supply's ground atleast for testing purposes. Does the computer need to be connected for any purpose other than development or code debugging? If not then floating the pc ground should do the trick until the project is completed.

Frankly unless he takes all his items in question outside into daylight (but not full sun) where a photo can be taken in which we can see what he is doing (as distinct from a murky indoors photo), we are most unlikely to observe the obvious blunder.

noweare:
Your last result is not good. Based on that I think your supply is broke.
I would just use a wall mount power supply with no load connected to the motor just to get something working. I don't know about you but I save all the power supplies and have a bunch to use for projects.

Ok I will try this. You mean just cutting a 12v wall plug and using those two terminals into the motor shield while also having the usb plugged in?
I do have a habit of hoarding all my old cables and plugs which will now come in handy!

So the wiring I posted in the first picture without my DC supply but with a 12v plug?

Ken_F:
Lots of power supplies don't like being connected to computers. They have different means of connecting grounds. That is why we use isolators to convey signals between devices connected to computers. If you float the ground on the computer it should prevent the current loop from pulling that current from the power supply's ground atleast for testing purposes. Does the computer need to be connected for any purpose other than development or code debugging? If not then floating the pc ground should do the trick until the project is completed.

Yeah I want to be controlling two steppers through serial data from my pc to the arduino.
At this point ive got a bluetooth module coming so I can do it that way because I can't seem to work this out.
I would however like to know the source of the problem rather than just trying to hide it !

How would I go about floating the ground on the computer? The USB hub that the arduino has no third pin in its power supply. From my limited understanding this is a floating ground?

Paul__B:
Frankly unless he takes all his items in question outside into daylight (but not full sun) where a photo can be taken in which we can see what he is doing (as distinct from a murky indoors photo), we are most unlikely to observe the obvious blunder.

I've checked and rechecked this wiring and had two friends who have made similar projects look over it, (although using battery packs rather than a DC supply) as it was a stepper controlled robot. I've blown 3-4 arduinos now :frowning: and I'm confident that this wiring is how it is! If not, I want to know that the diagram I posted should work. Or any issues which might arise from the diagram above with USB + power supplies connected etc.

I've attached a photo of how everything is arranged.

Thank you all for your suggestions.

Where on plant earth do you reside? A country is all that is required, just need to know what your household electrical service is.

You stated you measured some voltages so you have a meter, which is good. What kid of meter? Digital? Analog? Make and model if it’s known brand would be nice to know.

It should be relatively easy to determine if the 12v supply is the problem once we know a few more details.

although using battery packs rather than a DC supply

So not equivalent at all then.

What happens if you remove the powers hub and just connect things to the PC?

But please do the measurements first and report back.

avr_fred:
Where on plant earth do you reside? A country is all that is required, just need to know what your household electrical service is.

You stated you measured some voltages so you have a meter, which is good. What kid of meter? Digital? Analog? Make and model if it’s known brand would be nice to know.

It should be relatively easy to determine if the 12v supply is the problem once we know a few more details.

I'm from Australia.

The multimeter :

I just tested with my laptop NOT plugged in and it works fine. Motor driving and all with the power supply I mentioned. Nothing burns! :slight_smile:

Grumpy_Mike:
So not equivalent at all then.

What happens if you remove the powers hub and just connect things to the PC?

But please do the measurements first and report back.

I plugged it into my Desktop and It had the same result from a motherboard USB port.

What might be at fault here? The computer? My houses wiring? The power supply?

Is this sort of thing expected or not?

Thank you guys.

It looks like your computer’s power supply is at fault.

Is this sort of thing expected or not

Not.