Does a diode clamp work with a voltage divider reference instead of a 5V source?
You'll notice the diode has little effect on the circuit when a voltage divider is used. This is because the 5V coming from the divider has an extra output resistance associated with it.
Loosely put, adding a capacitor overcomes this resistance.