0
\$\begingroup\$

I have a 12v battery powering two DC motors through an Arduino and motor controller. The 12v battery is also powering the Arduino using the VIN pin.

Now I am trying to hook up two servo motors from the same Arduino. The servo power supplies are connected together and go to the 5v pin of the Arduino. The grounds are also together and go to the Arduino ground pin. Both servos have a 100uf capacitor across their positive and ground.

There are three grounds coming from the micro controller, one of them the power supply and two others to the motor controllers.

When I have all grounds going to the Arduino ground pins the DC motors come on for 5 seconds or so then turn off over and over. It looks like the Arduino might be turning on and off. But I thought maybe it had something to do with the capacitors interfering with the DC motors since they all share ground? I just don't even know.

So when I remove the ground, coming from the servos, from the Arduino the DC motors run just fine.

Is it possible to share the same battery source for the servos and both the DC motors? Does anybody know what's going on here?

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

It's not likely the capacitors you put on the servos have much to do with it, they will most likely only interfere at start-up, if it powers up fine every time before you start doing anything, don't worry about them.

Although you might want to turn them into 3x 10uF or 2x 22uF, as smaller capacitors paralleled are just as good at spike-currents, draw a smaller start-up peak. You aren't trying to smooth anything, so a very large capacitance is over-kill, they are just there to help the servo start up, when it is power-hungry.

You could add a low value resistor, like so:

schematic

simulate this circuit – Schematic created using CircuitLab

Depending on the steady-state current draw of the servos you can modify the resistance a little, during normal operation no more than 0.5V should fall across it, and do consider a heavier load when you calculate the power of the resistor. For example, if you model it for 100mA, you could make it 5Ohm, then 0.5V will fall across it normally. But, if it then stalls or has more work to do, it might draw 250mA or more. With 250mA the voltage across the resistor would become 1.25V. So the power would be 1.25V * 0.25A = 0.3125W, so you should pick a 0.5W resistor to stay safe.

In fact the dropping of the voltage when it wants to be more hungry than it should, will help reduce some risk there as well, preventing it from drawing so much the voltage regulator on the Arduino will melt. (As which point that happens depends on the Arduino and what regulator they used on it and how they mounted it). Because at the lower voltage the servo gets it will draw a little less current when stalled, so this balances out to a lower current consumption at failure.

The same effect is what prevents heavy pulses of power to trouble the Arduino, when the Servo starts up it draws a high current, but the resistor makes it harder to draw that from the Arduino directly, so it'll first start drawing some power from the capacitors, until they fall to a voltage low enough for the resistor to take over sourcing the current.

An inductor would also be a solution, but modelling those properly takes more knowledge of the peaks and their duration, where the maths around a resistor are quite simple, so I would start with the resistor. If it helps but not enough, you could add an inductance of as little as 2.2uH, but up to 100uH, rated for your stall current to see if that helps, just in series with the same resistor or a slightly smaller value. (3.3 ohm in stead of 5ohm would already be more than enough of a reduction).


What is probably the problem is that you are putting all the power through the Arduino. That makes the noise from both the servos and the DC motors couple through the board and induce all kinds of crap into the system there.

The best thing is to connect the servos completely to the Arduino, since the 5V is generated there, the return path is best also put through the Arduino, so as not to make large loops that might create their own problems. But connect the grounds of the DC motors to the battery directly.

Gregory refers to it as "star ground", this is a trade term for connecting all the power return paths in one spot together, usually as close to the power supply as possible. In this case, because you want the Arduino to supply the 5V, it's best to keep the Servos out of your star ground design.

To explain why you want the motors connected to the battery directly, here's some blabber and pictures:

schematic

simulate this circuit

As I draw, the system inside the Arduino isn't perfect, so the ground will have some resistance. No board is perfect in that regard, it cannot be, such are the rules of nature. (Although, a couple of Arduinos I have held could have done better, but that's a topic for a whoooole other thread.)

So if you put current through the ground system it will create a voltage drop along the traces in the board, represented by the four resistors. This voltage difference will also be seen by the internal circuitry. In reality the problem might be even worse, because there's not just resistance, there's also inductance, which will make the voltage drop of mid to high frequency noise much worse than just the resistance does.

So, if you now put an extra 1A for the DC motors through that trace, it will lift up the voltage of the ground, to different degrees across the board. That means that internal things will see different supply voltages, with respect to their ground contact. As I have drawn it the voltage rise will not be too great with 1A DC, but it is possible those symbolic resistors are larger.

What really happens, though, is that the DC motors create spikes and noise because their brushes connect and disconnect coils all the time, those ripple voltage are on one side connected directly to the battery, which presumably has enough power to keep that side at a reasonably steady 12V. So, where do those ripples go? Ah! Hey! There's a ground track that has a lot more resistance (and inductance as mentioned before) than the wires between the battery and the motor: Tada, that's where they go. The majority of the 50Hz ~ 500Hz (or higher, depending on number of coils and rotation speed) ripple from your DC motors goes into the Arduino's ground system: Bad!

Now, you could add filtering, all sorts of spiffy schemes, but the best rule to apply is: Anything powered by the Arduino also goes back to the Arduino's ground and if that causes troubles you add some resistances, capacitance and/or inductances to filter out the worst of it. Everything working off a voltage not created on the Arduino, especially higher voltages, does not have a ground path inside the Arduino.

And, don't overload the 5V of the Arduino. If your servos do take more than 100mA to 200mA I'm willing to bet your Arduino's regulator doesn't like that, best to just buy an LM7805 and a small heatsink and power those separately as well. But there, you will still want the servo ground to couple back to the Arduino, or your PWM signal controlling them will have to go through hoops (literally) to get a return path. That is a bit annoying to get out, if you don't want to go very deep into electronics right at the start, but the smaller operational currents and the fact they are internally filtered should help, so it should not be a huge problem.

Note:

I know I simplified and cut some corners, but it should stay as simple as possible, seeing the question and inquisitive comments elsewhere.

If you see a mistake or error, though, please complain.

\$\endgroup\$
6
  • \$\begingroup\$ Thank you! You've certainly opened the doors to new things I need to learn. I'll try this in a moment and let you know if works, but first question, why the 1ohm resistor for the servos and would it hurt to just leave the 100uf capacitors I'm using now? I'd rather not desolder and try again, those seem fine. The starter Arduino kit is the one that taught me that. \$\endgroup\$ May 30, 2015 at 22:57
  • 1
    \$\begingroup\$ @MichaelRader A single 100uF should be fine in most cases. The resistor is explained in the post: If you put that in it will limit the amount of high-drain dip you get on the Arduino's main VCC and it will automatically also protect against huge problems when one stalls. It might still be a bit of a problem, but not huge :-D. \$\endgroup\$
    – Asmyldof
    May 30, 2015 at 23:03
  • \$\begingroup\$ I brought the grounds back to the ground of the battery instead of the Arduino but still same issue. DC motors go on and off. The green light not he Arduino comes on then brinks off over and over no matter where I run the grounds. \$\endgroup\$ Jun 1, 2015 at 0:20
  • \$\begingroup\$ @MichaelRader Next step is to test powering the Servos externally. It could be you are demanding too much of the Arduino's internal voltage regulator. I have no specifics about the Servos you are using, so if it isn't ground feedback, it could be the 5V being over-drained. Try it with an external adapter, power supply or with a separate 7805 chip. Keep an eye on the heat of the chip though, if you're not mounting it to anything with some thermal paste. \$\endgroup\$
    – Asmyldof
    Jun 1, 2015 at 1:52
  • \$\begingroup\$ @MichaelRader Feel free to let me know if it doesn't work out. Maybe by direct message, if it's interesting to the entirety of the problem we can both edit our posts accordingly, keeps the comment chain a bit trimmed. \$\endgroup\$
    – Asmyldof
    Jun 1, 2015 at 2:32
0
\$\begingroup\$

It is possible, but it takes careful ground and power design. An using sufficient capacity on each driver.

Start with star connection of power and ground with center on the battery. No gbd or 9ower connections in any othe point. Make sure the wires are thick enough.

Your biggest problem is going to be dealing with current pulses. So you have to bypass rach device with big enough capacitor, ideally with input filter.

Also you have to make sure that your battery can provide current enough for all loads together. Assume that pulses are taken by the capacitors, so just sum all DC currents.

Good luck, keep us posted.

\$\endgroup\$
2
  • \$\begingroup\$ I'm sorry that did not help at all. I don't even understand what you're saying. "Start with star connection" ? " No gbd or 9ower" ? \$\endgroup\$ May 30, 2015 at 6:59
  • \$\begingroup\$ Yes GND and power, but connected each in a single point at the battery. And again, see that you have enough caps for current pulses and that the battery can provide total dc current \$\endgroup\$
    – user76844
    May 30, 2015 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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