2015-04-08 21:13:10 +02:00
# doorbuzz
2016-03-31 21:29:57 +02:00
raspberry Pi opening the front door and playing videos the button has an RGB led to show status features:
2015-07-19 17:01:54 +02:00
* button to push to open the door
* LED ring of 60 neopixels showing the current clock
* video player showing some default videos while the space is open
* a shutdown button for a clean shutdown
* watchdog
2015-04-08 22:16:20 +02:00
how to install
==============
2016-04-01 00:09:08 +02:00
* The basics
```
sudo apt-get install vim tmux
```
* If you want to chroot into the image have a look at [this script](https://github.com/CIRCL/Circlean/blob/master/proper_chroot.sh)
* Remove screensaver from `/etc/xdg/lxsession/LXDE/autostart`
2016-03-31 21:29:57 +02:00
``` bash
2015-04-08 22:16:20 +02:00
sudo vi /etc/xdg/lxsession/LXDE/autostart
2016-04-01 00:09:08 +02:00
```
* Copy the files present in `root_files` accordingly on the file system
* Set the hostname: replace the content of `/etc/hostname` with doorbuzz
* Install the suff
``` bash
2016-01-25 23:30:15 +01:00
sudo apt-get install unclutter xdotool git-core screen imagemagick x11-xserver-utils
2015-04-08 22:16:20 +02:00
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
2016-04-01 00:09:08 +02:00
git clone https://github.com/syn2cat/doorbuzz
2015-04-08 22:16:20 +02:00
mkdir -p /home/pi/.config/lxsession/LXDE/
cat > /home/pi/.config/lxsession/LXDE/autostart <<"EOF"
@xset s off
@xset -dpms
@xset s noblank
@unclutter -display :0 -noevents -grab
2015-05-11 22:50:29 +02:00
@sudo python ./doorbuzz/setneocolor.py
2015-05-08 21:27:28 +02:00
@./doorbuzz/buzzctrl.sh
2015-05-02 01:58:10 +02:00
@./doorbuzz/videoplayer.sh
2016-01-25 23:30:15 +01:00
@./doorbuzz/arpspoofdetect.sh
2015-05-08 21:27:28 +02:00
@sudo python ./doorbuzz/shutdownbutton.py
2015-05-11 00:25:31 +02:00
@./doorbuzz/phone_notification_client.sh
2015-04-08 22:16:20 +02:00
EOF
2016-03-31 21:29:57 +02:00
```
2015-04-08 22:16:20 +02:00
2016-03-31 21:29:57 +02:00
* connect the button and LED to pins as shown in `buzzctrl.sh`
* create a file "secret.txt" containing the http://user:pass@10.1.1.xx part of the URL
* adapt the URL in buzzctrl.sh
* adapt spaceapi URL in spacestatus.py
* put .mp4 videos into ~pi/ and they will show when your hackerspace is open you can add videos and they will be taken into account automatically
2015-04-08 22:16:20 +02:00
2016-03-31 21:29:57 +02:00
when booting, the button led uses morsecode to send the low byte of the IP adress in decimal
2015-04-08 22:16:20 +02:00
2016-03-31 21:29:57 +02:00
`phone_notification_client.sh` communicates with pidor's `doorbuzz_wrapper.sh` to command the flash light
2015-05-11 00:25:31 +02:00
2015-05-11 22:50:29 +02:00
# new: using redis to manage the 60 led circle
2016-03-31 21:29:57 +02:00
```
2015-05-11 22:50:29 +02:00
sudo apt-get install python-pip redis-server
2016-04-01 00:09:08 +02:00
sudo pip install redis neopixel
2016-03-31 21:29:57 +02:00
```
# the redi.sh comes from here: https://github.com/crypt1d/redi.sh
```
2015-07-19 22:01:13 +02:00
cd ~
git clone https://github.com/jgarff/rpi_ws281x.git
cd rpi_ws281x
2016-04-01 00:09:08 +02:00
sudo apt-get install scons swig python-dev
2015-07-19 22:01:13 +02:00
scons
sudo scons
2016-04-01 00:09:08 +02:00
cd python
sudo python setup.py install
2016-03-31 21:29:57 +02:00
```
2015-05-11 22:50:29 +02:00
2015-07-19 17:01:54 +02:00
# setup watchdog
2016-03-31 21:29:57 +02:00
```
2015-07-19 17:01:54 +02:00
sudo modprobe bcm2708_wdog
echo "bcm2708_wdog" | sudo tee -a /etc/modules
sudo apt-get install watchdog
sudo update-rc.d watchdog defaults
sudo sed -i 's/#\(watchdog-device\)/\1/
s/#\(max-load-1\s\)/\1/
' /etc/watchdog.conf
sudo service watchdog start
2016-03-31 21:29:57 +02:00
```
Note: `projectionscreen.sh` is a standalone program called remotely by pidor because pidor knows the IP adress of the projector but doorbuzz has the RF remote connected.
The remote command works with ssh, so install pidor's root pub key into `~pi/.ssh/authorized_keys`
2015-07-19 17:01:54 +02:00
2015-04-08 22:16:20 +02:00
todo
====
2016-03-31 21:29:57 +02:00
* create a config file
* put more of the hardcoded values from code into parameters
* make code resilient against missing commands (e.g. gpio not in PATH)
* move script to run in screen instead starting from rc.local