Movement and light sensor for around 10$?

@anon35356645, if you can manage to manufacture a board with PIR, Photocell, and wireless interface in a nice box for less than 10 cents each, and sell them for $10 each, I think you could be doing pretty good business. Realistically speaking, if it were that easy, a commercial package like you describe would be more readily available.

I promise it isn’t that hard to build, though. If you are willing to take the time to learn, you could definitely build 15 of these on your budget. You only need four components.

  1. Microcontroller (Approx $5) - Use a NodeMCU dev board. They are made for beginners with almost no experience. (example: https://smile.amazon.com/HiLetgo-Version-NodeMCU-Internet-Development/dp/B010O1G1ES/ - You can buy these for ~ $5 on aliexpress or banggood). These have a power regulator built in, usb programmer built in, pin headers already soldered on, etc. All you have to do is connect a sensor and upload code. Wifi isn’t really the best option, but it IS the easiest for a beginner.

  2. Sensors (Approx $1 each) - Get a PIR on a chip with pin headers ready to go (example: https://smile.amazon.com/EMY-HC-SR501-Pyroelectric-Infrared-Detector/dp/B00FDPO9B8 - again, don’t buy these on amazon if you are price sensitive, this is just an example.) Same thing with the Light Sensor (example: https://smile.amazon.com/Detection-Digital-Switch-Photosensitive-Module/dp/B00NLA4D4U - buy it someplace else, you get the idea)

  3. Power Supply (Approx $4) - Any cheap 5v usb power supply will work. You really don’t need to be that selective here. If you’re a gadget sort of person (like most of us on this forum are) you probably have a drawer full of these somewhere. Make sure it’s 5v. (example: https://smile.amazon.com/Super-Power-Supply-Graphite-Paperwhite/dp/B01CGGW4NG )

  4. Case (Cost varies, free to $$$) - This is really up to you. Lots of people re-purpose altoids tins, gut old gadgets for the case, use legos, whatever. If looks are very important to you, you could hit 3dhubs and have someone print basically whatever you like. I’ve printed a few highly visible mounts and cases, but usually I just put the sensors in inconspicuous places. (under counters, below window trim, inside unused receptacles, etc).

  5. (optional) If you are REALLY dead set against soldering, buy pin header jumper wire (example: https://smile.amazon.com/uxcell-10PCS-Female-Jumper-Multicolor/dp/B00HG8RLDI - again, this is a stupid expensive price for these).

Assembly is simple. Use your jumper wire to connect the 3.3v power pins on your NodeMCU board to the power in on your two sensors. Do the same with the ground wires. Pick two digital IO pins that make you happy, and connect the PIR to one and the Light Sensor to the other. Stick the whole thing in your case. Admire your ingenuity and creative genius.

(The only caveat here is some sensors will want you to use a pullup resistor. it will probably work without one, but it will work better and longer with one. You can find sensors with these integrated, they cost a little bit more. Some controllers, like the Rapsberry Pi, have pullup resistors built in on certain pins.)

For software, use something simple like EspEasy or MySensors. Just flash the firmware as directed, and connect to the web interface. Tell it what pins are connected to what sensors. Set up MQTT or Rest or whatever you like to use to talk to Home Assistant, then test it out!

This setup is going to cost you roughly $9-$12 each, which should fit in with your budget, depending on what you use for an enclosure.

Congrats, you just built a micro-controller circuit. It really is that easy. Don’t get intimidated by it just because you can see bare circuit board. You wouldn’t be messing around with Home Assistant if you didn’t enjoy tinkering - so go forth and tinker!

10 Likes