So I have "built" a voltage sensor for an Arduino by using two resistors. The current setup is as shown in the schismatic and the Arduino pins are only 5V tolerant.
The accuracy of the sensor is alright when there is little current draw on the battery. But when the battery is powering motors, the voltage tends to jump around a lot. The first thing I will do to this setup is to increase the value of R2 from 100K to 330K. This will lower the max voltage from 55V to 20V, but I should never be pushing more than 20V anyway. That will increase the resolution at which I can measure the battery, but I believe to get very accurate data that I should add smoothing capacitors somewhere in the circuit to make sure the voltage doesn't "jump" around as much. Any thoughts?
EDIT:
So after hearing some recommendations in this post I decided to run some tests. I decided to switch out the 1M and 100K resistor with a 10K and 1K respectively. I then used a fully charged 2 cell lipo battery and ran 4 motors on it continuously for about 25 minutes until that battery ran out of juice. The data was recorded in the Serial Mointor and graphed in Excel. I did not start the motors until 20 seconds have passed for recording. Here are my findings.
As you can see from the graphs, the data in the first two is all over the place. The "stability" of the signal being recorded does not seem to be dependent on the impedance of that signal (At least for the Atmega32u4). Averaging 20 samples at a time did show usable data that seems consistent with other lipo battery discharge curves.
The following graphs stability could be improved by lowering the ratio of R1 and R2, and I suspect adding a filtering Cap across R2 would also increase accuracy of the measurement.