Electronic – Master switch to turn on and off independent lights

circuit-designledswitches

i am adding some led lighting to a dolls house where each room can be turned on and off independently but i would like a master switch which turns all lights off(simple) but should turn on all lights even if they were off before. I just can't figure how to get this to work.

Example

  • With 2 LEDs in the system.
  • When the master switch is turned on all LEDs turn on.
  • Led1 is switched off, led2 is kept on.
    -When the master switch is turned off all LEDs turn off.
  • And then when the master switch is turned on all LEDs are turned on.

enter image description here

Best Answer

You will not be able to do the last step without resetting relays (costly, not easy to find), complex logic circuit (hardware intensive) or a microcontroller. A microcontroller solution with push buttons will be super easy. On/off switches will require slightly more code but pretty easy too.

The microcontroller solution can be cheap, and consist of nothing more than the switches and some resistor + Transistor pairs (and your leds of course). Depending on how many lights you could skip the transistors too. The internal Pull-Ups are enough for the inputs, but external ones can be used too.

schematic

simulate this circuit ā€“ Schematic created using CircuitLab

Code would be simple:

Boot/Power On{
  turn all lights on, set inputs;
  Wait for button press{
    At button press toggle light;
    At master button turn all lights off;
    At second master button, go to boot.
  }
}

Or skip the master button and use a hard power switch turning the microcontroller off. When turned on it starts at boot. Cuts down on some of the coding.

schematic

simulate this circuit