Electrical – How to connect two power sources to a switch

power supplyswitches

enter image description here

I want to operate LED lights using either batteries or an AC/DC adapter wall plug. I have a SPDT switch but Iā€™m not sure how to connect the two power sources to the switch. I might be using the wrong switch, if so what switch do you suggest? The main thing is that the AC power source is never connected to the battery and to have a choice by either operating the led lights by battery or AC/DC wall plug.

Best Answer

schematic

simulate this circuit ā€“ Schematic created using CircuitLab

Figure 1. Wiring the components.

If your LED doesn't have built-in current limiting you will need to add a resistor to limit the current to a safe value.