The battery voltage can be monitored using an Arduino analog input, but you can't directly connect the battery to an input pin because a fully charged battery can exceed the maximum voltage that the Arduino chip can tolerate.
Another factor to be aware of is that the default voltage reference for
analogRead is the 5 volt output from the regulator on the Arduino board.
This regulator requires more than 6 volts to produce a stable 5 volt output. When the voltage
difference between the regulator input and output (referred to in the regulator datasheet as
the dropout voltage) is less than a volt, the output voltage will drop below the required 5
volt level. Because this voltage is used as the default Arduino reference for analog
conversion, the analog readings will no longer be accurate. In short, you shouldn't rely on
the battery voltage as a reference to measure the battery voltage. So you need a reliable
voltage reference that is not dependent on the output from the regulator.
The solution is to use an internal voltage reference that is built into the Arduino chip. This provides a 1.1 volt reference that is stable for any voltage that is sufficient to power the Arduino chip. Because the reference is 1.1 volts, the voltage being measured must not exceed this value, so a voltage divider to drop battery voltage down to an acceptable range is required (Figure D-1).
Figure D-1. Resistors used as a voltage divider
To support a wide range ...