Arduino Battery Backup Circuit

Hello! I'm new to the Arduino scene! I have both an Uno R3 and Mega.

I'm a software developer, and am trying to learn circuitry. I understand how to read schematics so I'm not a complete noobie.

I need to make a circuit that I can have plugged into the wall with a 9v AC adapter, and a 9v battery. I need to have a battery backup. How would I make the circuit for this to where the board will know if I'm running on the battery, or the wall adapter? I want to have the board log whenever it looses main power.

Thank you guys for the help! If this question exists elsewhere sorry for the double post! Just link me to that forum.

Thanks!

Do a search on battery backup in the search box at top of this page.

Weedpharma

I've been looking, but can't find any active links with the schematics I need.

A plug pack feeding a battery via a diode, then to the Arduino.

Resistor divider from input to the diode to sense power from the mains.

Weedpharma