Inexpensive SMALL UPS circuit

power supply

Thank you all guys for taking the time to answer my question. I really appreciate it. Now, I think I made a mistake and asked the question wrong. I know that I can use a telephone charger to power up a small sensor instead of batteries (I am using a laser with an LDR and a light-dependent motion sensor – it only works when it is dark). What I may need is a switch (either with relay or with transistors) to swap between the domestic power supply and the batteries in case of a power shortage.
I apologize, maybe this forum is for advanced users and I am not one. I thank you all twice for that.

→I am trying to build an inexpensive SMALL UPS circuit allowing me to swap between domestic power line and batteries. It would be fine if it could convert from 110 or 220 VAC to 5 or 12 VDC. Is this even possible without making a bulky device or using a transformer?
Thanks a lot for your answer even if it is to tell me it is not possible.←

Best Answer

Difficult to answer - what are you intending to run on this UPS, and for how long? It might be worth checking if your intended use case is actually possible... a washing machine, for example, would require a very non-trivial battery to USP for any real amount of time,

In which case, I'd strongly recommend buying a real UPS. Poking mains power is dangerous.