4
\$\begingroup\$

Powering an arduino board using batteries via the the barrel connector, is it ok to use the negative terminal as ground wherever its needed?

For example, I have a shield that takes +5 and Ground from arduino pins - is it ok to use the negative from the battery as the Ground?

UPDATE: I attach a rough sketch. I've ignored control lines etc. The M is for a motor that is being controlled by the H-Bridge which requires +5/GND from arduino and external power.

enter image description here

\$\endgroup\$
  • 1
    \$\begingroup\$ Using something as the ground probably means attaching something to the wire and if that means attaching some form of sensor that also feeds a signal into the arduino's IO then the answer could be "No" based on a few things. More information is needed before I can answer properly. \$\endgroup\$ – Andy aka Sep 25 '13 at 18:23
  • \$\begingroup\$ I'm powering an arduino and a h-bridge IC using external batteries for each. Can I join the negatives together and use it also as Ground, for example the h-brdige needs +5v and Ground - can the Ground come from the battery negative? \$\endgroup\$ – zaf Sep 26 '13 at 12:35
  • \$\begingroup\$ Try posting a small idealized drawing of how you envisage it and send me a comment so I can look at it please. \$\endgroup\$ – Andy aka Sep 26 '13 at 12:41
  • \$\begingroup\$ @Andyaka Done... \$\endgroup\$ – zaf Sep 26 '13 at 14:06
  • \$\begingroup\$ Sometimes it is better to use a more direct ground very close to the power supply, in fact, rather than some ground node on a circuit board far from the power supply. \$\endgroup\$ – Kaz Sep 27 '13 at 4:30
7
\$\begingroup\$

I'd wire the set-up like this: -

enter image description here

Ground (pin 8 typically for an L298 but will be different on other devices) on the H bridge becomes the star point for the connections to the rest of the "system". This means that motor load currents are kept away from the arduino - these can cause problems. Also keep the wires to the motor battery and to the motor as short as you can to avoid induction into other circuits.

\$\endgroup\$
  • \$\begingroup\$ Thank you for that. At least I now know that I won't blow anything. Will let you know very soon if it works. \$\endgroup\$ – zaf Sep 26 '13 at 14:43
  • \$\begingroup\$ @zaf also note that you'll need reverse-emf protection diodes on motor output pins unless your H bridge circuit has them built-in. Which H bridge are you using BTW? \$\endgroup\$ – Andy aka Sep 26 '13 at 15:02
  • \$\begingroup\$ +1 for single-point grounding system and separate motor battery. I'd give you +1 for each of those features if I could. \$\endgroup\$ – John R. Strohm Sep 27 '13 at 1:27
  • \$\begingroup\$ Using the SN754410NE. Just did a test and I don't know if its my wiring skills but I got some very strange behavior from the arduino, sometimes it was freezing after some time. Also, I forgot to take into account plugging in the USB and how that affects the whole circuit. I'm going to make the obvious circuit to gain the stability again. \$\endgroup\$ – zaf Sep 27 '13 at 5:31
4
\$\begingroup\$

"Ground" is the name of a net your circuit. All pins and nodes that connect to ground are therefore at the same potential, and just as applicable to use for ground connections.

There are some situations (dealing with high speed data, analog vs. digital, etc.) where the location you use is important, but for what you're doing it should not be a factor.

So yes, feel free to use the negative side of the battery for ground, as well as the "GND" or "-" marked pins on the Arduino: they're all "ground."

\$\endgroup\$
  • \$\begingroup\$ Thanks for the answer. I've added a sketch of the circuit I'm planning - can you check it if it seems OK? I really don't want to blow anything since I only have one of each component and it would take ages to order more... \$\endgroup\$ – zaf Sep 26 '13 at 14:07
1
\$\begingroup\$

As pointed out by JYelton, "Ground" is just a name for a connection. If we assume that the ground wire has no resistance (which is a safe assumption, as PCB leads should have resistances of less than an ohm per meter, and we're operating at far shorter lengths than that), then connecting to ground at the arduino is the same as connecting to ground at the battery, or anywhere else. This should be true in most cases. One case where this wouldn't be true is if we were using an isolation transformer somewhere, where there's actually no electrical connectivity between one side of the transformer to the other (hence, isolation). Isolation transformers may show up if you're dealing with ac signals, but this looks to be a purely digital application.

Please please please, however, take note of the inductors. Motors use inductors to create a magnetic field, which causes an armature (a wire coil inside the magnetic field) to experience a force, which causes the motor to spin. Whereas a resistor's voltage drop can be given by V = I*R, an inductor's voltage drop is given by v = L * di/dt. L is the inductance of the inductor, measured in Henries. di/dt is the rate of change of the current flowing through the inductor. This means that, if the current changes quickly, there will be a large voltage present on the inductor.

H-bridges use transistors like switches. The current flowing through them is either ON or OFF. When going from ON to OFF, or vice versa, the rate of change of current is very large. TO see this, draw a square wave, and look at the slope of the line when moving from ON to OFF. It's given by \$\frac {\Delta i}{\Delta t}\$, which is equal to some value over 0. In reality, a perfect square wave is impossible to create (For this very reason), and the transition from OFF to ON will take some time. Despite this, the rate of change of the current is still quite high, resulting in a large voltage induced across the inductor. Worse yet, this voltage will be negative half the time, resulting in a the circuit being reverse-polarized half the time.

How do we fix that? Put a diode from the motor to ground, such that a negative voltage at the motor will flow through the diode, avoiding any reverse polarization.

Edit: I was totally wrong about those capacitors. Removed that section, and updated with the diodes, which is the correct solution. Refer to Andy aka, as well, about the motor currents. While connecting to any ground isn't technically "wrong", for an application like this it's a good idea to try and minimize the size of any high-current loops.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.