Protect battery supply and arduino

Hello everyone, how are you? I hope you are well and healthy, I would like to hear your opinion on this matter; Currently, I feed my arduino through a 12v switching source that goes through a stepdown lm2596 giving 5 v to the arduino, so far everything fine, but the problem I have is that when I cannot connect it to the domestic power line (in this case 220v) it cannot work ..
It occurred to me to use a 20v lithium battery that I have from a drill, and I find two options:
Lower the 20v to 12v and connect it to the input of the other stepdown
or lower the 20v to 5v and connect it to the output of the other stepdown.
The problems that I see in option one would be that when it is powered at 220v, 12v would go to the output of the 2nd stepdown and if not, in the second option it would go 5 to the output of the other stepdown, and outside of that, go down from 20v to 5 I think it would demand too much because of the temperature.

How would you do it? (I clarify that the battery will not be permanent, I will place it only when I want it to work without cable, then it would always work at 220v as before)
What do you think would be the best and safest way?
Is there an element that I can or should add?

Thank you very much

Lots of text and private thinking.
Please post the schematics for the 220 volt (AC) alternative. Ready made power supplies are good solutions.
I suggest using a 220 volt AC to 5 volt DC converter.
The alternative supply is the battery, a 20 volt to 5 volt converter.

railroader,sorry,but you cant see the picture in the post?
I'll try again now,the green line divides the wired option from the one that does not, and the colors indicate the option that each one would be (I clarify that it is not connected all together, but I put the two options in the same image)
batery

The LM2596 will handle up to 40v in so do a simple switchover between battery and power pack to the input of the converter.

You made an unusual, but only confusing, way to show things. Better would be on drawing for each alternative.
Also, those Fritzing type pictures are mostly useless. Anonymous boards, no pin designations.... All helpers don't have that stuff and can't give precise answers.

Do not power a UNO(, Mega 2560, Leonardo, Nano, Pro Mini) by the "Barrel Jack" or "Vin" if you propose to connect any other devices to it.

If you have a regulated 5 V supply, connect it to the "5V" pin and ground, but disconnect the "5V" pin while you have it plugged into a PC via the USB socket. On a Nano, you do not have to disconnect it.

Apologies for the delay in responding, thank you for your response. I made two drawings again, one for each case, I hope this time it can be understood a little better, I will try to be as concise and direct as possible this time ... in each case, some stepdown is powered in its OUTPUT according to whether I use the current from the 12v source or the battery, my first query would be that: Is it somehow risky or not recommended that this happens or there is no problem that enters voltage x the output?
because my idea is to leave the two modes of power functional, either by battery or by switching source (But NEVER both at the same time) thank you very much


Yep agree.. the LM2596 will handle a variable input. Either plug into your wall charger or 20v battery... the output will still be 5v.

Just put this in front of your LM2596 and plug into that...
https://tr.aliexpress.com/item/32992149558.html?src=google&src=google&albch=shopping&acnt=494-037-6276&slnk=&plac=&mtctp=&albbt=Google_7_shopping&albagn=888888&isSmbAutoCall=false&needSmbHouyi=false&albcp=9444695485&albag=99457316601&trgt=296904914040&crea=en32992149558&netw=u&device=c&albpg=296904914040&albpd=en32992149558&gclid=CjwKCAjw_L6LBhBbEiwA4c46ujMIuvXVLBy9hrYNs71U0Tjpn_dve3onOLBEoBgBcqm6kTjUW65lMRoCfvMQAvD_BwE&gclsrc=aw.ds&aff_fcid=57390477ea4b46a386e2058bbe9e2dd4-1634770838137-08386-UneMJZVf&aff_fsk=UneMJZVf&aff_platform=aaf&sk=UneMJZVf&aff_trace_key=57390477ea4b46a386e2058bbe9e2dd4-1634770838137-08386-UneMJZVf&terminal_id=7a7ea789f98149ab9a675acb57129e38

thanks for the answer, but I think it was not understood, I know that the input supports a variable voltage, my question is if without being energized (that is, without receiving voltage by the input), receive voltage by the OUTPUT (so I explain above, that when one feeds to be connected in parallel is powered "Indirectly")

You do not need 2 voltage regulators... just unplug the power supply, and plug the battery into the first LM2596.

and as per @Paul_B comment... you don't need to go through the power jack on the Arduino... you already have 5 volts, so just connect direct to the UNOs 5v line. Or if you do go through the power jack then you should adjust the output of the LM2596 to about 9v (the Arduino will reduce to 5v).

thank you so much! you give me a big hand!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.