battery voltage with microcontroller
You are picking up noise, pretty much like a radio receiver does, but on a lower frequency. If you closely look at the values you measure, you will recognize the 60 or 50Hz mains in it.

Easiest way to get rid of it is to attach a resistor to ground, you want a slight load when measuring the battery anyway. 10k\$\Omega\$ will probably get rid of the noise. Depending on the battery you might want to change it to a lower value to give it some load.