0
\$\begingroup\$

enter image description here


I'm using an Arduino Mega to drive 7 servos (only 3 shown in my schematic), and I'm having some problems with the power management. Worst case scenario, the servos will draw about 4 amps, so I got a 7.5V @ 4A power source that I can connect to an independent DC jack on my custom shield.

Now the problem is that since I command the servos through USB, the arduino has to be connected to the USB, which puts a voltage of 4.3V on the Vin pin.

The circuit you see above is what I originally thought. The diode was supposed to keep the servos from pulling current from the arduino when both of them are connected. However, an obvious problem now is that if both sources are connected (USB to the arduino, and my external power source to the DC jack), then you are asking for a ~2.8V drop across that diode.

While I could disconnect Vin entirely, I want the capability of just having the DC jack connected, and still power the arduino so I can control the servos with a pre-programmed routine. But it still has to work when the arduino is connected to the USB.

Putting an extra resistor in series with the diode seems like a very ugly an inefficient solution. Any ideas on how to make this work?

Thanks in advance for your answers!

\$\endgroup\$
  • \$\begingroup\$ "... which puts a voltage of 4.3V on the Vin pin." Oh? And which part of the schematic allows that? \$\endgroup\$ – Ignacio Vazquez-Abrams May 3 '16 at 0:33
  • \$\begingroup\$ Keep just the ground and data lines connected, don't join the Vin pins, that way the arduino gets power from usb, servos get their own supply (the mega has diode protection anyway but still) \$\endgroup\$ – Sam May 3 '16 at 7:34
  • \$\begingroup\$ Like I said, I want the capability of powering the arduino if in the future I have only the DC jack connected, but not the usb. The arduino board puts 4.3V in the Vin pin as soon as you connect the USB. According to the schematics i've seen online this is not supposed to happen but it does....it is a genuine arduino board as well. \$\endgroup\$ – Pedro Piacenza May 7 '16 at 17:00
1
\$\begingroup\$

Look at the Arduino Mega schematics, there is a circuit that selects either VIN or USB VBUS as the voltage source. It uses LM358 as a comparator, comparing VIN/2 to 3.3V.

So, basically, if VIN is greater than 6.6V, it disconnects USB VBUS from the supply circuit and it is then safe to use VIN.

So you can use the circuit you thought of (the diode isn't even strictly necessary, but is certainly safer), and it won't put 2.8V across the diode, because USB VBUS won't be connected to VIN, even when both the DC jack and the USB are connected. Everything will work as you expect.

Note that it works fine because 7.5V minus the diode drop is greater than 6.6V. Otherwise, you'd need to use a greater supply voltage. Also, if I were you, I'd use a schottky diode, not a silicon one.

\$\endgroup\$
  • \$\begingroup\$ Well that is what I thought it would happen, but I can confirm that connecting the USB cable to the arduino, results in having 4.3V at the Vin pin :( \$\endgroup\$ – Pedro Piacenza May 7 '16 at 16:58
  • \$\begingroup\$ Of course. When only the USB cable is plugged in, T1 and T2 are on. So +5V = USBVCC. Now, you'll see that between USBVCC and VIN, there is the MC33269D regulator. On such linear regulators, when the output is above the input, the current flows backwards (there is the equivalent of a diode). So VIN becomes about 4.3V. Moreover, you should avoid having a lot of current flowing in that direction. But in your application, it seems you never need to be powered through USB only, right ? I understood there is always at least the DC jack. In this case, you don't have to care about this 4.3V. \$\endgroup\$ – dim May 9 '16 at 7:22

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.