Karl’s Home Automation Project – Part 3: Adding Light Detection to a Motion Sensor

This is the 3rd part of my Home Automation light project. In the first part, I wrote about basic setup with basic Sonoff Wifi MQTT switches and setting them up. In the second one, we added some 433 MHz motion sensors and a 433 MHz to MQTT bridge. And finally in part 3, we are going to modify the 433 MHz motion sensors to only work when it is dark in the room.

Motion Sensor

Click to Enlarge

The motion sensor I linked in part 2 is run by a common chip called a BISS0001. We are interested in pin 9. If voltage is below .2v it will not trigger a motion. This solves the problem discussed in part 2, when we have a gloomy day or if blinds are closed etc.

By adding an GL5537 LDR (Light Dependent Resistor) shown as R3 in the diagram above, you will achieve the desired effect. Extend the LDR with some wires and solder between ground and pin 9.

The GL5537 is extremely sensitive. You can adjust your sensitivity by placement. I put mine right next to the PIR sensor so it sees outside the window. It works perfectly. If you wanted it to get a little darker you can use the mounting hole on the back or make a new on the top or sides. Direct access to the outside light would mean it would need to be darker in the room for it to trigger. You have to be careful with the motion sensor placement or your light being triggered might cause the motion sensor not to trigger because there is too much light. I get this if the motion sensor is too close to the lamps I am triggering.

Home Assistant

Before modifying we had 2 automations one for before sunrise and one for after sunset:


Now that we’ve added the logic for light and dark at the motion sensor itself, we can simplify these 2 down to one automation, and only specify the time. The rest of the home assistant configuration can be found in 2nd article here.


That is all I have for now. If you have an idea or a product that you feel that meets the cheap and DIY criteria leave a comment below. I will test it out. I know you can do a ton of things with Home Assistant and a lot seem over the top. I want to focus on mundane things like turning off lights. I am also going to get some 433 MHz moisture sensors for my house to place in crawl spaces, and under the sink but that is pretty basic.

Continue reading “Part 4: MQTT Bridge Updated to Use YS-IRTM IR Receiver & Transmitter with NodeMCU“.

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX RK3588 mini-ITX motherboard

Leave a Reply

Your email address will not be published. Required fields are marked *

Boardcon Rockchip and Allwinner SoM and SBC products
Boardcon Rockchip and Allwinner SoM and SBC products