I am trying to make system where I want lights to turn off automatically. It should work like that if someone kept lights on by mistake then it should turn off automatically without any human intervention (like in IoT we can turn off with our phone ). For this I have tried thinking about putting camera in room which will detect the presence of human in room and if no human is detected then lights should turn off. But I am having difficulty to figure out how to turn off lights automatically? I mean what can be used ?

  • \$\begingroup\$ Have you googled? \$\endgroup\$
    – across
    Mar 20 '20 at 5:44
  • \$\begingroup\$ just buy a light switch with a motion sensor built-in \$\endgroup\$
    – jsotola
    Mar 20 '20 at 6:09
  • \$\begingroup\$ I had to achieve this because I have a daughter who might burn herself on a stove (she has seizures and she's profoundly autistic and sometimes will otherwise just burn herself by touching a burner.) I use a combination of ultrasound sensors and radar and use data fusion techniques for the sensor inputs to detect when human motion occurs in the room. It's quite a task, really. But it is very effective. If we leave the room and forget to return for a while, the stove is isolated from its power and a keycode is required to re-activate it. The sensing/detection algorithm was a lot of work. \$\endgroup\$
    – jonk
    Mar 20 '20 at 7:24

A relay lets you control AC circuits with low voltage. Do your research to find a safe one and how to use them safely. To detect human presence you could use a camera yes, but if you look into motion detectors I think you'll find them a lot easier to use. And here's a link to one example of that.

  • 1
    \$\begingroup\$ Two things that should never touch mains power are: #1 totally inexperienced people with no skill. #2 that module. That makes this advice a miss in this context. For a relay fit for direct installation in mains, try RiB or Aube. \$\endgroup\$ Mar 20 '20 at 6:43
  • \$\begingroup\$ When you put it like that… I edited my answer to something more responsible, thank you. \$\endgroup\$
    – hallgren
    Mar 20 '20 at 6:52
  • \$\begingroup\$ Oh yes, much betta... yeah, that particular cheap cheese board had this issue here... The relay was good (RU rated) the board wasn't... \$\endgroup\$ Mar 20 '20 at 6:57


They make motion sensors that plug into receptacles and can communicate with whatever IoT network you are using. They can then control the smart bulbs or whatever that you are using.

Then, on the IoT platform, you can add code to have it act like a motion sensor, turn on on motion and turn off after X minutes. You could vary X per time, so it doesn't turn the lights out on you during times you normally are sedentary.

  • \$\begingroup\$ A motion sensor to detect you watching tv? seriously? an infra red detector would be better as some people just don't move... ie couch potatoes... \$\endgroup\$
    – Solar Mike
    Mar 20 '20 at 6:46
  • 1
    \$\begingroup\$ @SolarMike Yeah, that didn't come out so well.... \$\endgroup\$ Mar 20 '20 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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