You are nearer than you think. Use a 10k resistor in series with the trimpot. When the trimpot is adjusted to 0 ohms, you have 10k total. When the trimpot is adjusted to 10k, you have 20k. I really don't think that the trimpot will be needed, but it might.
The 1uF cap is a little large, but might do. Again, the cap is probably not needed either. Make sure that, if the capacitor is polarized, you place the negative side to ground.
The ReadAnalogVoltage reads A0 and should work. I'll review the code to see if it needs a tweek. The PiN diode won't generate much voltage at full light.
Attached is a new schematic with the trimpot and resistor in series, and a polarized cap. Again, the trimpot and cap may not help much.