Common ground or Common Earth (PE) / How best power a MEGA

We are using an Arduino Mega for a commercial / industrial application

It is connected to 7 stepper motor drivers, a temperature shield, digital potentiometers, and a couple of RS485 adapters

The steppers have their own separate power supply (Switched)

The Mega is powered by a 12V switching power supply, connected to VIN and to GND

There is annother control unit on the equipment with its own electrical connection to the main, on the signal side it is connected to the digital potentiometer

We encounter some interesting problems: The USB connection to the computer is not stable.

When mounted in the electric cabinet together with all other equipment, the only way to get connection for programming is to remove both GND and VIN between the board and the power supply. Also, it makes a difference if the computer is connected to the mains, or if it runs on battery only.

If we take out the board from the cabinet and connect it to the same power supply, and to the computer (USB), the conection to the computer works fine.

Good practice for ground

How to wire this equipment, shall we connect everything to earth ground, or shall we work with a common ground ?

On the other control unit, there is earth ground on the incomming main, but there is also GND on the low voltage signal side. How to treat those in this system?

Even though we connect all components to a common ground, or to earth ground, still the USB seem to live its own life. Is there no physical connection between the USB gnd and the board gnd available on pins

How to power the Mega in a a robust and durable way

While trying to understand our issue, I came across an article/statment where is was argued that any professional application will power the Mega with a separate 5V suupply. It was argued that the VIN was just created for educational purposes and not a very robust system.

If we get a 5V switched power supply and connect that to the 5V pin, then there is no protection to the board, but that may not be a problem ?

A good advice would be appreciated

Mega shouldn't be powered by +12, the 7805 linear regulator will run hot. Run it from +5 and bring it in on the +5 pin (I assume you're using some type of terminal shield.


The onboard power and the USB are NOT isolated. Put a switch in the RED wire of the USB cable to prevent backfeed.

I wonder if there is a ground loop situation here. The USB port in the computer is connected to the computer's PE ground eventually. If the computer is plugged into the mains, you will have a connection back to the board's ground via both the USB and the board's power supply.

Not every device likes to have it's ground connected to other electrical ckts. AND often it depends on the physical location of the various grounds.

Could you make a quick sketch showing the basic equipment? Try to draw the grounds as they are connected. i.e. is the ground on machine A grounded at machine B then a wire goes to the Mega.

Quite inappropriate.

Care to explain further?

Correct.

What is that supposed to mean?

It is not a 7805. :roll_eyes: A 7805 with a heatsink might have been OK, but it isn't.

The concern is that when powering with 5 V to the 5 V pin (and ground of course) which is always the correct way to power it, if a PC is connected to the USB port then the 5 V may back-feed into the PC's USB port system and cause problems.

That does sound like the case.

Hi -
Many thanks for support.

On Pauls request, enclosed a schematic of the wiring.Please take it for what it is - an amateur sketch. I'm a mechanical engineer...lacking fundamental circuit desgin competence.... sorry... :slight_smile:

In the sketch (simplified, there are many more stepper motors), the only units currently connected to each other through protective earth is the ECU, the PC and the VFD.

The switched power supply connected to VIN has been adjusted down from 12 to 7,8 V

If the board is powered directly on its 5V pin by external power, there's no built in protection against current/voltage/temp? Based on several answers I do understand this is how it should be powered, so then I wonder if there si anything special I shall tink of when selecting the power supply. Is a standard MeanWell a good choice: HDR-15-5 MEAN WELL 15W 5VDC 2.4A 115/230VAC

There's a comment that if I power the board on the 5V pin, there may be a conflict connecting a PC to the USB. If so, that is an issue. Customers shall be able to connect for software updates and fault tracing. How to isolate them from each other ?
Schematics.pdf (216.4 KB)

What is good practice here. Shall al PE be connected with each other, directly in the machine and not through the mains, and shall V- on the switched power supplys also be connected to PE. Then everything has the same reference. But, if I understand well. There can be noice on the PE ? Well, this is where I get lost. I can find arguments and reasoning in different directions, but end of the day I don't know what to do.

Hi John, thanks. yes i've donne a sketch as I was responding to Paul. I now saw that You also asked

Hi Paul,

The USB connection was always lost when connecting extrernal power supply on VIN. (On a identical mega, not wired up in the cabinet, but only to VIN and GND and to the computer via USB - it worked. Very strange to my view. anyway I believe it shows that the switch on the Arduino can function)

In one situation (I can't remember exactly, but I think both power supplys were on) it lost connection unless the ECU was powered on. I tried to connect the ground on the ECU signal side to the V- on the power supply, but no difference)

It's a complex scheme of tests that needs to be done to understand the issue, if the probelm should be solved that way.

I thought of a different starting point: what is good practice when wiring such a system up, and then manage issues if they occur.

Put in the switch on the USB to cut the power lead and things will get much simpler.

Just some suggestions about the wiring in the cabinet, as general practice. The high voltage and low voltage wiring should be kept well separated, e.g. the HV side stays on the right side, and the low voltage on the left or bottom. They should run in separate ducts, and if crossing, should cross at right angles if possible.
The grounds should not be daisy-chained from one to the next, but should all go to a good grounding point on the case.
It is certainly possible that the power supply in use is of poor quality. It is worth swapping it out if you have a spare.
It is possible that the Mega is the problem and swapping it for the spare one may shed some light too

Common misunderstanding here. :roll_eyes:

We are here concerned about interference pickup. "Star" grounding is about analog voltage drops in wiring and pickup of small voltages over small distances. What we need to avoid in digital control circuits (as well as analog circuits) is open loops in wiring and adding distance to a common ground point is creating such open loops.

In fact, "daisy chaining" grounds is the correct practice as long as it results in both the power supply and the signal/ control lines always travelling paired with the ground so that there is no separation between which could form an inductive loop or an exposure for capacitive coupling to another circuit.

Good points, but not completely agree.
Daisy chaining low voltage grounds with HV grounds is going to lead to LV and HV circuits travelling together. Now, all the grounds travelling to the Mega could be joined together close to the Mega

But you cannot do that within the constraints I specified. :thinking:

Each circuit - LV or HV - originates at the power supply, so in order for the supply and return ("ground") to be kept together, the "chain" for each originates at the power supply, so if the circuits do share a common ground, the power supply is that common or "star" point.

Hi -
Thanks - got it.
The high voltage part is separate in the cabinet (I will even create separate cover inside the cabinet)
Had not thought of the rigth angle if crossing, but offcourse... :slightly_smiling_face:

Hi Paul,

I understand the power supply in through USB shall be removed/switchable. I found cables to buy with integrated switch. All good. But now I would love to understand exactly why. Is the ground in the USB port on the MEGA not connected to the rest of the GND on the board? If it is, then why should we need to remove the power?

Shall I ground everything to PE, or just have a common ground between the MEGA and the two power supplies. It would means mixing PE from the 400V main with GND for the signal part of the system.

In relation to long distances, what is a long distance?
The USB cable is around 3 meters in total
The distances in the cabinet is short, the cabinet is 600 x 400 mm

Most USB cables with an integrated switch do not contain the data wires and are only for phone charging! Sad but true. :thinking:

Not without a really good reason.

How long is a piece of string? :grin:

A 3m USB cable is in itself, not a problem. But it may be a problem if it becomes part of a ground loop where the PC and the device on the other end both connect to the PE.

Aha, a semantics issue.
You are calling going back to origin daisy-chaining.
I would consider daisy chaining going from ground of stepper 1 to ground of stepper 2, to ground of ... stepper 8, then to common ground.
What you are describing in not daisy chaining.

Hi Paul,
Great - many thanks :slight_smile:
I now have a better idea of what to do. Will try it out and maybe share later on.

Best
Martin

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.