4

Is it safe to connect a 9 volt battery to an Arduino Mega 2560 directly to power it?

dda
  • 1,595
  • 1
  • 12
  • 17
Waqas
  • 41
  • 1
  • 4

3 Answers3

3

Yes. On this page, you can see that you can safely connect 7-12V to the VIN pin.

Furthermore, you can simultaneously connect the USB; your Arduino will automatically draw power from the appropriate source.

Note that the power supply jack pin is connected to the Vin pin through a diode. Do not connect a battery and an external power supply, since a sufficiently high power supply voltage will try to charge your battery, which may be bad news for the battery.

Sanchises
  • 149
  • 7
0

DO NOT CONNECT IT TO Vcc, CONNECT IT TO VIn.

By connecting it to VIn, your 9V will go from the battery, though the VReg, and then to your Arduino. This is what you HAVE to do. By connecting it directly to the Arduino Vcc pin, you are basicly frying it.

Note that once the battery has gone bellow 7V, it might start getting unsafe because you are not giving the Arduino enough power.

Dat Ha
  • 2,933
  • 6
  • 24
  • 46
0

Yes.

Batteries are acceptable power sources for the Arduino Mega and other Arduino boards. I've used them for years for various applications where access to AC is inconvenient, impractical, or nearly impossible.

The Mega page on the Arduino site also explicitly permits battery power.

Helpful Guidelines

Here are some important criteria to meet.

  • The Voltage is within the published range for the Arduino model you are using, which is 7 to 12 Volts DC for the Mega 2560
  • The positive of the battery supply connected to Vin (NOT any of the other power pins)
  • The negative of the battery supply is connected to Gnd
  • Critical applications don't run under the assumption that the battery will never drop below the required 7 Volts
  • The header is never plugged in backwards or in the wrong location, which would likely damage the Arduino circuitry

Connection Safety Using Plug and Jack

If you are connecting and disconnecting the Arduino from your battery frequently or you just want .

See the Power section of the page to make sure you never plug in the header wrong, you can connect your battery supply to the Arduino board's existing power jack. When connecting a battery supply to an Arduino compatible plug, you can ensure that the plug's inner conductor is positive in Voltage relative to the outer sheath using a Voltmeter.

Battery Use in Robotics and Flight Control

A 9V battery will eventually drop in Voltage below 7V, upon which the operation of the board may fail at any time, so you may want to add more 9V batteries in parallel to extend your battery supply's life 1.

Another approach common in robotics or flight control applications, to preemptively avoid erratic behavior as the battery drains below operational thresholds, is to use the low voltage detection features of the CPU. The Atmel CPU used by the Arduino Mega 2560 has a Brown-Out Detection feature. The Atmel CPU for the Due and other boards have under-voltage detection too.

A simpler approach for critical applications is a resistor divider on an analog input is another related approach.

.....

[1] Batteries may vary in Voltage when purchased, but some small variance above or below 9V hurts neither the batteries nor the Arduino. They will equalize themselves without dissipating (wasting) much energy, so you will get close to N times the battery life, where N is the number of 9V batteries in parallel. See this Electronics StackExchange Q&A and this battery company article for more information.

Douglas Daseeco
  • 274
  • 1
  • 7