Read voltage of the battery that feeds ATmega328p
You can use the internal 1.1V bandgap reference to indirectly measure the voltage on the Vcc pin. This 1.1V reference is built into the chip and can be connected to the ADC by setting the MUX registers correctly.



Full details here...

https://wp.josh.com/2014/11/06/battery-fuel-guage-with-zero-parts-and-zero-pins-on-avr/