I'm working on my school project. I want to control a light bulb using SSR relay (and nodemcu), but I also want to give user the option to toggle the light bulb using the traditional switch button which we generally have in our homes. The circuit diagram as below:

enter image description here

enter image description here

I'm stuck with this scenario: if the switch button is ON then relay would be of no use, it won't be able to turn off the light until I turn OFF the switch button.

This is the problem: I want to short circuit or disable the switch button line entirely whenever my relay is active.

Imagine you are lying on a bed, you are holding an Android phone and want to be able to command the relay to toggle light but the switch button is ON, but you are too tired to get up and turn off your switch button so that the relay can modify the state of light bulb.

  • \$\begingroup\$ As an alternative to the answer by @Vir, you could make the switch an input to the NodeMCU. It does not have to be in the path of the lightbulb as the NodeMCU already has control over the state of the light. \$\endgroup\$
    – StarCat
    Sep 15, 2021 at 18:34

1 Answer 1



simulate this circuit – Schematic created using CircuitLab

Looks like you already have a SPDT Relay, so now finish it off with a SPDT switch. This is how two-way lights are done in homes so you shouldn't have trouble finding a wall switch that is SPDT.

Edit: find more about multiway switching here.

  • \$\begingroup\$ Thank you very much sir, but I wanted to control the light bulb either with the spdt relay or the traditinal SPST switch button . Im not sure if the disagram u have given is solving the problem . I wanted to give relay higher priority, so that whatever the state of switch, I want to be able to control the bulb using relay. Sorry for my beginner knowledge. ....In summary----Allow user to toogle the light bulb , either using the relay or the spst switch button. \$\endgroup\$
    – RishiN
    Sep 16, 2021 at 16:29
  • \$\begingroup\$ Yes, that is what the circuit will do. \$\endgroup\$
    – vir
    Sep 16, 2021 at 22:14
  • \$\begingroup\$ Thanks, but in my understanding , the curcuit has SPDT switch(SW1) .......I wanted to make use of SPST switch . is it correct ? \$\endgroup\$
    – RishiN
    Sep 17, 2021 at 4:11
  • \$\begingroup\$ hello.. am I right ? is the circuit diagram using SPDT switch ? \$\endgroup\$
    – RishiN
    Sep 18, 2021 at 4:58
  • \$\begingroup\$ Yes the circuit uses a SPDT switch but like I said, you can find SPDT switches that are designed to be used in homes like this one: homedepot.com/p/… If for some reason you can't get or don't want to use an SPDT switch, do what @StarCat suggested and have the switch tie into your micro. \$\endgroup\$
    – vir
    Sep 20, 2021 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.