I have made a voltage divider with two trim pots set at 900k and 14k with a source voltage of 300V DC. I am supposed to get 4.5V at the center, which I do get and checked by a standard multimeter. Now when I feed this point to any of the analog input A0/1/2/3/4/5 of the UNO and try to read the analog value, I get somewhere around 560 for a couple of seconds and then around 650 for a couple of seconds and it keeps repeating. After a reboot the values change but they always seem to jump between two levels. I know these values are from 0-1023 range but 4.5V should have given anaolog value of somewhere in the region of 900. There is a delay of 1 second in the loop. The arduino is powered by a 12V adapter through the barrel jack. I checked whether the analog inputs are good by using a acs712 ampere sensor at the analog input, and it works fine and gives proper analog values with respect to the load.
An ADC typically needs a low impedance. What you have is a very high impedance. With that large of a voltage divider it will take a while for the sampling capacitor to charge. The standard way to solve this issue is to use a voltage follower. This gives you a low impedance to you ADC pin. Depending on which op amp you chose will determine if you need R2. If the op-amp can drive a larger capacitive load than what the internal sampling capacitor of the ADC in the microcontroller is then you won't need it. But anything from 10 to 100 ohm won't hurt anything for what you're doing.