This shows you how to hook up some low-cost hardware to periodically send a message to Slack if motion was detected recently.
We have an elderly relative who recently had a fall necessitating hospital treatment. This is a simple solution to help assure us that they're still moving around - but without being as intrusive as a camera might be.
I did. A D-Link or TP-Link something or other with IFTTT integration through the vendors app.
But the manufacturer withdrew support after 18 months though and now it's just more e-waste
Hardware
You'll need
- a Wemos D1 or similar board (there are plenty of clones available)
- a PIR sensor, such as https://shop.rasp.io/products/pir-motion-sensor-2
It's a really simple build, you don't even need a breadboard or resistors.
-
Attach the PIR sensor to the board as per the schematic below.. You just need to connect the 5v, ground and a digital pin that has no internal pull-up (so that by default if reads LOW - D0 on a Wemos D1 is a good choice).
-
Set the delay setting on the sensor to minimum (consult your sensor's documentation - but with these sensors there's often a screw-type adjustment on them to alter delay and sensitivity.)
Software
-
Create a slack webhook where notifications of motion detection are to be sent
-
Copy secrets.EXAMPLE.h to secrets.h and enter your wifi details (you can enter a primary and secondary wifi - useful for testing in one location and deploying in a second) and slack webhook url
-
Compile and upload the sketch to your board using the Arduino IDE
After powering on the device it will pause for 1 minute to enable the sensor to warm up before sending a message to the slack webhook.
It will then poll the sensor every 5 seconds to see if any motion has been sensed - if so it will light the internal LED, and make a note that motion has been detected.
After polling, if more than hour has passed since sending the last message to slack, it sends a notification to slack with information about whether motion was detected during that hour.
The output to Slack will look something like this - the number preceeding the message is the number of seconds the board has been powered on - perhaps useful for debugging when running remotely.