One point that you have to considder is that the 5 volts supply voltage needs to drop to close to zero volts when the mains is removed. If you do not leave the power switched off for long enough for this to happen then the reset circuit will not work correctly. If you need it to work even when the supply has been off for only a short time then we would have to make a modification to the power supply circuit to ensure the output voltage drops quickly enough when the power is removed.
Les.
Les.