How to buffer an ATMEGA for millisecond-level power interruption without strange behavior?
You can use a super capacitor (1F/5.5v) after the diode, connecting it directly to the VCC and GND. This will help you in buffering the power.