Resistors, scale, resolution, consumption and accuracy for reading high voltages with a microcontroller
E24 series resistors. The maximum source impedance and the sampling capacitor are in the microcontroller datasheet; 10 kΩ and a few picofarads are typical values.
A microcontroller's ADC only measures between 0 V and its reference, 3.3 or 5 V. To read the voltage of a 12 V battery, a 24 V supply or a solar panel, it is reduced with two resistors and the program multiplies by the inverse factor. It is the simplest way to monitor a battery's charge, detect a power loss or measure the output of a supply.
The ADC charges a small internal capacitor at the start of each conversion. That capacitor charges through the equivalent resistance of the divider, R1‖R2; if it is high, there is not enough time and the measurement reads low. Manufacturers specify a maximum source impedance, around 10 kΩ. With high-value dividers the solution is a capacitor at the ADC input: it acts as a charge reservoir and, if it is at least 2n+1 times the sampling capacitor, the error stays below half an LSB. In exchange, the measurement becomes slow (low-pass filter), which does not matter for a battery but does for a fast-changing signal. In that case an op amp is used as a voltage follower.
Related: ADC and DAC conversion, reading NTC sensors, 24 V inputs to a microcontroller and current sensing with a shunt.