I have purchased XH-M131 Photoresistor Relay Module to automatically light my outdoor yard at sunset and turn it off at sunrise. I'ts working as it is supposed to, However, if I power off the relay, the light goes off.

I want this to be a closed circuit in such way if the relay malfunction or loose power, the outdoor light stays on which I can manually switch off if I want to.

BTW, I tried connecting the light wires to the otherside, but the whole thing reversed, light goes on when light detected which defies the purpose. Any suggestion or modifications. enter image description here

  • It is correct to connect the light wires to the other side (aka normally closed / NC), but then of course you also need to invert your program logic (turning the light off by activating the relay, turning it on by deactivating the relay). Have you tried that?
    – chrisl
    Oct 18, 2020 at 17:26
  • @chrisl the relay is self controlled by Light Dependent Resistor. Is there a way to reprogram it or reverse the trigger mechanism? Oct 18, 2020 at 18:00
  • Oh, then only if you analyse the used circuit on that module and hack it. But where is the Arduino in your setup? If there is no Arduino, you are at the wrong site. This is Arduino SE
    – chrisl
    Oct 18, 2020 at 18:30

1 Answer 1


If you put an additional relay (Relay B) between the XH-M131 and the light and connect the light to the mains via the Normally Closed pole of Relay B, the light will be ON unless Relay B is activated or you turn off the light switch. Then, connect the coil of Relay B (instead of the light) to the "other side" as you say, of the XH-M131, the logic will be such that when the sensor is exposed to light (daytime) the XH-M131 turns on. That will activate Relay B, switching it from Closed to Open and turn the light OFF. If the XH-M131 fails, the light will be ON.

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.