Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrewl/motion-detector
Motion detection and Slack notification for Arduino/ESP8266
https://github.com/andrewl/motion-detector
arduino esp8266 iot motion-detection slack
Last synced: 29 days ago
JSON representation
Motion detection and Slack notification for Arduino/ESP8266
- Host: GitHub
- URL: https://github.com/andrewl/motion-detector
- Owner: andrewl
- License: mit
- Created: 2020-10-21T21:18:00.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-17T18:30:51.000Z (9 months ago)
- Last Synced: 2024-04-17T19:35:35.214Z (9 months ago)
- Topics: arduino, esp8266, iot, motion-detection, slack
- Language: C++
- Homepage:
- Size: 289 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Motion Sensor to Slack Notification
==What is this?
--
This shows you how to hook up some low-cost hardware to periodically send a message to Slack if motion was detected recently.Why?
--
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.Couldn't you buy something to do this?
--
I did. A D-Link or TP-Link something or other with [IFTTT](https://www.ifttt.com) integration through the vendors app.But the manufacturer withdrew support after 18 months though and now it's just more [e-waste](https://en.wikipedia.org/wiki/Electronic_waste)
OK, How do I build one?
--
*Hardware*You'll need
- a [Wemos D1](https://www.wemos.cc/en/latest/d1/d1_mini_lite.html) or similar board (there are plenty of clones available)
- a PIR sensor, such as https://shop.rasp.io/products/pir-motion-sensor-2It's a really simple build, you don't even need a breadboard or resistors.
1. 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).
2. 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.)
![Schematic](./motion-detector.png)
*Software*
1. Create a [slack webhook](https://api.slack.com/messaging/webhooks) where notifications of motion detection are to be sent
2. 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
3. Compile and upload the sketch to your board using the [Arduino IDE](https://www.arduino.cc/en/software)
Running
--
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.
![Slack Screenshot](./screenshot.jpg)