I have a controller running on a Standalone ATMega328P-PU, working fine.
I need to design a power supply unit to feed it from a 24 to 28 VDC solar powered battery system.
The energy needed is very low, so a linear Regulator like 7805 would do the work, and is extremely simple. But I need it to be bullet proof to avoid passing 28 Volt (with sun) or 24 Volt (with no sun) to the ATMega in case of failure.
My design with the ATMega only takes 29 mA, and drives three 4N25 optocouplers.
A linear regulator with such a large input-output differential voltage is not a good idea at all. Can the 7805 even handle 28V input? I'm looking... okay, it's 35V so just barely. If you absolutely must do this, ensure that you have it properly heat sinked. Also don't get designs from YouTube or Instructables.
Another thing, when you post here, don't provide only vagueness like "energy needed is very low". Tell us what the expected energy is. We're grown ups, we can handle it.
You need to think about power dissipation : 100mA at a 19volt drop is 1.9 watts .
If you want simple , use a 12v regulator followed by a 5v regulator with small heat sinks
If you want to make it safe you can put a zener diode across the supply with a fuse between it and the 7805 , if the supply fails the fuse will blow and disconnect the supply , more sophisticated over voltage protection circuits are around .
I probably wouldn’t bother , chances of failure are low .
Instead of a second regulator, how about putting a 470R, 1 watt resistor in series ahead of the 7805? It would be there solely to dissipate most of the heat produced by linear regulation, and at 29mA the input voltage of the 7805 would be reduced to a reasonable level so it wouldn't get very warm.
But as others have said, with this big voltage drop you are wasting most of the battery power used to power the Arduino. About 80% of the battery draw is wasted as heat. This is why God made switching regulators.