COVID-19 Project - Needs help with advising and coding

Hello, I am working on a project for Covid-19 ventilators and really need some helps. I am looking to power my Arduino circuit with a stepper motor using automated mains and rechargeable batteries. The power will be auto switched from the main power source to batteries. The circuit will always be powered, in case the power lost, there will be batteries.

When the board is connected to AC wall power source, the circuit runs off this power and charges the batteries until full. When the power is disconnected/lost, it’s powered by the fully charged batteries.

Can anyone suggest a solution?

Please attached some image for better clearing your doubt.

@nuoialon

Could you take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum in the future.
Other general help and troubleshooting advice can be found here.

Bob.