Yet another inexpensive Motion Sensor for Home Assistant
Taking inspiration from BruhAutomation’s multi sensor, I decided to make a simple ESP8266 based motion sensor for my house. Here’s the part List :
1 x NodeMCUs – https://amzn.to/2ou0NON
1 x MicroUSB Charging cables – https://amzn.to/2sImP1z
1 x HC-SR501 PIR Motion Sensor Modules – https://amzn.to/2yyBlbW
1 x Dash Button (extra) – https://amzn.to/2dPKZhM
Some Jumper Wires – https://amzn.to/2tcw1bR
Some Legos I had laying around for housing.
The project is a pretty straight forward one. No soldering, crazy programming or anything of the sorts. Just a quick flash of the NodeMCU with ESPEASY firmware and connect up a few wires and we are good to go. In fact, I think this is an excellent project for someone to get their feet wet with adding ESP8266s into their home automation bag of tricks. I like to use NodeMCUs since they are relatively inexpensive and you can add more sensors to them in the future.
The PIR sensor that I used is the HC-SR501. This has native support in the ESPEASY software out of the box. Just connect the 3 wires to the NodeMCU.
Since the PIRs need 5v, I use the bottom VIN which will deliver 5V rather than the 3.3v that the other power pins send out. Standard Ground and GPIO10 for the data.
In the ESPEASY software, the set up is JUST as easy.
This screen sets up GPIO10 to be the data pin for the motion sensor. Like most of ESPEASY, this uses MQTT to talk to Home Assistant and the set up is exactly like all others. Note: 192.168.10.10 is my Home Assistant instance.
Everything else in ESPEASY is default settings. So all done in there.
In Home Assistant, you can see my configuration here as a package : https://github.com/CCOSTAN/Home-AssistantConfig/blob/master/packages/office_motion.yaml
So basically, the way the motion sensor works is: You walk in, the motion sensor ‘sees’ you, sends a status update to MQTT, HA reads that update from MQTT and then in my case, turns on the light if it’s dark outside. I use the DASH button to set a daytime override when I want the light to come on during the day (maybe it’s raining, cloudy or just darker than normal). That Boolean gets reset every night so it’s ready to go in the morning each day.
So once it was built, I needed a housing for it. I really couldn’t find anything that I liked so I just built one from Legos. The key with the housing is the Sensor and the ESP need to be away from each other. The distance of the cables (about 6 inches is enough to keep the PIR extremely reliable. Closer (like in the same casing) and the interference from the ESP itself messed up the PIR’s ability to accurately detect motion. I’ve been running this thing for about 6 months like this and it’s been STELLAR. Working exactly as I need it and EXTREMELY fast in response (under a second).
So there it is. Another inexpensive Motion sensor you can build on your own to bring more data points into your Smart Home setup.