Here's something to get you started, you may need to adjust it accordingly to work with the voltages you're using
I guess the unstated issue is the rise in battery voltage during charging. If the battery is 9V say and going into the Vin, its easy, just connect charger to battery.If using 4x NiMH cells (about 5.3V) then over-charging might push the battery voltage too high for Vcc (5.5V is the maximum). A constant-voltage charger set to 5.5V would be one solution. That would work with either battery, charger or both connected which is nice.
Thanks for the diagram!I do have some questions.The left part is understood, I am curios about the right side, from where Q1 is placed.The purpose of the circuit is to activate the arduino board.So how do I connect both powers so that when the power is down the battery will take over ?ThanksAngela