Step 1: the Design
The design shows two diodes with their cathodes connected together and anodes terminated to a 14 V source and anodes to the positive of a 12 V battery source respectively. The common cathodes of the diodes are further connected to a IC 7805 IC whose output is finally applied to the Arduino board.
When mains is present the 14 V supply ensures s constant trickle charge supply to the attached battery via R1 and also feeds the Arduino borad through D1 and the 7805 IC.
In this situation D1 cathode experiences a much higher potential than the cathode of D2 due a relatively lower battery potential at D2 cathode.
The above situation keeps D2 reverse biased allowing the battery charge to stay blocked and pass only the adapter voltage to the Arduino board.
But as soon as the mains supply fails, D1 instantly stops conducting and enables D2 to get forward biased so that now the battery instantly takes over and begins supplying the Arduino via the 7805 IC.