I think with a 4k and 1k resistor, the voltage at the Arduino will be 20V multiplied by 1k divided by 5k (i.e. the value of the two resistors added) which is 4V. To get 5V from 20V, the resistors would be 3k and 1k.

But one of the nice things about using the Arduino for this is that you don't have to worry about getting exact value resistors anyway.

You could use the more common 3.3k and 1k values, test the voltage divider with the battery, measure the actual battery voltage with a multimeter and see what corresponding value you get from analogRead().

Then adjust the value you use in your code to convert from analogRead() result to volts. Something like this ...

No. In the diagram that dave-in-nj posted, Vin is the car battery + terminal. Vout = Arduino analog pin. R1 is for example 3.3k or 3.9k resistor, R2 is 1k resistor. You will also need to connect an Arduino GND to the car battery - terminal.

But please take note of the advice to use a zener diode to protect the input from an unusually high voltage from the car battery charging circuit.

Having the lower resistor about 10k will be more power-efficient and isn't too largefor the ADC. 10k and 33k would divide by 4.3, 10k and 22k would divide by 3.2

You can use larger resistances (might be useful if you want to avoid long termcurrent drain), but you then should add a 0.1uF capacitor too to reduce the impedanceseen by analog input (otherwise readings can be rather off the correct value).

[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]