Electronic – Powering multiple led strips by one switch

led stripmosfetspdt

I have a problem I cannot figure out. I have this circuit which should control two LED strips either by wemos OR (methods are switched between by SPDT because I don't know automatic way) manually. Each "switch" should be able to turn on one or both leds.

Circuit details

Wemos uses two N-mosfets (irlml2502) to turn on/off leds. Manually I turn them on/off by SPDT switch.
Circuit is powered by 12V adapter going to the LEDs and buck-converter to convert to 5V to power wemos. To separate LEDs powering I use Schottky diode SB540.

PROBLEM

The problem is, when I use manual switch, it turns on both of the leds everytime. Also, the buck-converter´s power led is ON on that time but the IN- is not connected to anything.
Even when I connect ground to buck-converter IN- both ledstrips are turned ON.
As I understand it, ground to the mosfets should flow through buck-converter but it is flowing flowing somewhere else.

Only thing I can think of is that MOSFETs are allowing ground to flow "backwards" from drain to source and power the circuit through each other.
Could you please help me fix the circuit?

Picture description

  • Circuit is not powered on pictures.
  • Purple colour shows the ground when I want to power single ledstrip.
  • Turquoise should power both strips.
  • Bold black wire upper-right is manual switch 2 and blue is manual switch 1. Curved blue on the right side is ground.
  • In schematics I ignore buck converter and wemos pins output to mosfets.
    One ledstrip
    two ledstrips
    clear circuit
    wemos buck converter

schematic

simulate this circuit – Schematic created using CircuitLab

Best Answer

There is a logical component "OR" that could be used. What is a logical gate? That is extensivly explained here https://en.wikipedia.org/wiki/Logic_gate

schematic

simulate this circuit – Schematic created using CircuitLab

Another solution is to add the switch to a GPIO on the WeMos and add code, example https://www.arduino.cc/en/Tutorial/BuiltInExamples/Button and if it is a push button please add some "debouncing" code as well, ref. https://www.arduino.cc/en/Tutorial/BuiltInExamples/Debounce

The debounce code is preventing the input from receiving several on/off when the button is pressed. Quote from the Arduino site, Pushbuttons often generate spurious open/close transitions when pressed, due to mechanical and physical issues: these transitions may be read as multiple presses in a very short time fooling the program

Note: Both above suggestions is making the SB540 obsolete.