I'm attempting to design a circuit for some LED lighting that will be powered from a mains connected 24V DC transformer but if the power fails then the a battery should take over as the power source and automatically switch the LED lights on.
In the circuit below the idea is the LED light D1 is normally powered by V1. When V1 has power relay SW3 would switch from the position shown in the diagram and thus break the B1 circuit meaning D1 LED would be controlled by V1 and SW1. When V1 loses power SW3 would be in the position shown and the LED light would be powered by BAT1 and always on.
Is my analysis on the right track or is there a much simpler way to accomplish my goal? If I am on the right track what sort of relay should I be looking at for SW3?
Update:
Below is my revised attempt. The polarity on the SW1 terminals needs to be reversed. I don't think there's any need for a diode between the + terminals of BAT1 and V1 since they will only ever be connected if V1, the mains supply has failed in which case it will act as an open circuit. I think there is a problem with this new circuit in that the SW1 relay will always be off while SW2 is open and hence the LED will be lit by the battery. I need SW1 on even if SW2 is off.