Skip to content

Commit

Permalink
Update README.md, Upload pics with new wiring
Browse files Browse the repository at this point in the history
  • Loading branch information
nenoch committed Sep 16, 2017
1 parent fa371f8 commit ee1351e
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 29 deletions.
57 changes: 30 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Sensor Butler
![Sensor Butler Icon](./imgs/sensor-butler.png)

##### _A Raspberry Pi device to share a message on a slack channel when the door is opened._
> _A Raspberry Pi device to share a message on a slack channel when a door is opened._
![Raspberry Pi & PIR sensor](./imgs/IMG_6392.JPG)
![Raspberry Pi & PIR sensor](./imgs/IMG_6418.JPG)

**1) Slack & Webhooks**
Create a slack team for prototyping purposes and your first slack App. You will need a incoming webhook url to send the POST request with your message to slack.
Create a slack team for prototyping purposes and your first slack App. You will need a incoming webhook url to send the POST request with your message to slack.

**_~ Resources ~_**
https://api.slack.com/tutorials/slack-apps-hello-world

Try out your incoming webhook in the terminal:
Expand All @@ -18,38 +20,39 @@ curl -X POST -H 'Content-type: application/json' --data '{"text":"Door :door: is
Build your Raspberry Pi device. You will need:
* Raspberry Pi
* PIR sensor
* PIR sensor
* Jumper wires
* Dupont Wire
* Breadboard

_For easy setup_
* USB Wi-Fi adaptor
* USB Bluetooth adaptor
* Jumper wires (female to female)
_Note: male to female will work too if you have a Breadboard_

![Raspberry Pi & PIR sensor](./imgs/IMG_6392.JPG)

![wiring detail 1](./imgs/IMG_6393.JPG) | ![wiring detail 2](./imgs/IMG_6394.JPG)
> **_IMPORTANT: Setup_**
You will need access to the RPi via screen (HDMI), mouse and keyboard.

![wiring detail 1](./imgs/IMG_6419.JPG) | ![wiring detail 2](./imgs/IMG_6420.JPG)
------------ | -------------
![wiring detail 3](./imgs/IMG_6395.JPG) | ![wiring detail 4](./imgs/IMG_6396.JPG)
![wiring detail 3](./imgs/IMG_6418.JPG) | ![wiring detail 4](./imgs/IMG_6421.JPG)

**_~ Resources ~_**
https://www.hackster.io/hardikrathod/pir-motion-sensor-with-raspberry-pi-415c04
https://www.raspberrypi.org/learning/parent-detector/worksheet/

**3) Download the python script in your RPi**
Download pir.py and change the webhook url to the one of your slack app.

**4) Schedule tasks with Cron**
Follow the instruction in the cron-config.md file and the link below.
With this setting the sensor will be active at reboot and then everyday after midnight. Remember that the sensor will be 'triggerable' only once per day.
_Note: change the path to the path of the pir.py script on your RPi_
https://www.raspberrypi.org/documentation/linux/usage/cron.md

### Further Resources
**3) Download the sensor-butler repository in your RPi**

*Run the python script at startup (RPi)*
https://www.dexterindustries.com/howto/run-a-program-on-your-raspberry-pi-at-startup/
In the Terminal:
```
$ cd Desktop
$ git clone https://github.com/nenoch/sensor-butler.git
```
Open ```pir.py``` and change the webhook url to the one in your slack app.

*git on Raspberry Pi*
**_~ Resources ~_**
https://projects.raspberrypi.org/en/projects/getting-started-with-git

*Self-updating apps using Docker*
https://medium.com/imont/self-updating-iot-apps-on-the-raspberry-pi-using-docker-a0b223fd4eeb
**4) Schedule tasks with Cron**
Follow the instruction in the cron-config.md file.
With this setting the sensor will be active at reboot and then everyday after midnight. Remember that the sensor will be 'triggerable' only once per day.
_Note: remember change the path if your directory is not in the Desktop_

**_~ Resources ~_**
https://www.raspberrypi.org/documentation/linux/usage/cron.md
6 changes: 4 additions & 2 deletions cron-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ Select ```nano```.

Copy and paste the following cron jobs at the end of the document:
```
@reboot python /home/pi/Desktop/sensor-butler/pir.py &
@reboot python /home/pi/Desktop/sensor-butler/wifi-checker.py &
0 0 * * * python /home/pi/Desktop/sensor-butler/pir.py
0 0 * * * python /home/pi/Desktop/sensor-butler/wifi-checker.py
```

The 1st line will run the script in the background at startup, the 2nd will run the script at midnight everyday.
We are calling ```wifi-checker.py``` and not ```pir.py``` because the first will
activate the sensor only if the RPi is connected to the Internet.
Binary file removed imgs/IMG_6393.JPG
Binary file not shown.
Binary file removed imgs/IMG_6394.JPG
Binary file not shown.
Binary file removed imgs/IMG_6395.JPG
Binary file not shown.
Binary file removed imgs/IMG_6396.JPG
Binary file not shown.
Binary file added imgs/IMG_6418.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/IMG_6419.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/IMG_6420.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/IMG_6421.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed imgs/sensor-butler.png
Binary file not shown.

0 comments on commit ee1351e

Please sign in to comment.