doorbuzz/README.txt

162 lines
5.0 KiB
Plaintext
Raw Permalink Normal View History

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 update
sudo apt-get dist-upgrade
2016-04-01 00:09:08 +02:00
sudo apt-get install vim tmux
# now you get funky errors: "unexpected end of file or stream"
# fix it:
sudo apt-get clean
sudo apt-get --fix-broken install
* sometimes you ask yourself why the locales are not generated as needed
sudo sed -i "$(locale | awk -F= '$2!=""{gsub("\"","");if(!a[$2]++){print "s/# *" $2 "/" $2 "/;"}}' )" /etc/locale.gen
sudo locale-gen
2016-04-03 10:07:50 +02:00
```
2016-04-03 10:10:14 +02:00
* authorize boorduzz to connect to pidor and vice versa
2016-04-03 10:07:50 +02:00
2016-04-01 00:09:08 +02:00
```
mkdir /home/pi/.ssh
chmod go= /home/pi/.ssh /home/pi/.ssh/authorized_keys
2016-04-03 10:07:50 +02:00
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTVHK+yXSXHm42vr1RZ4sgKBFdkL3vi1u8BXYD/zkcbJkDSyWWRlU5q/qzEQYVk2zae870jcSQ5oTeoLZ99ujkuGltTCdzcCin24Aoig8ATyztFXoSHIfdUPCw5dbjhQXGWRPIkk1lSGU6mtLJRmVwLeY0rzVSQKdlspQlKBLwFBeIuACZQZfUzbIB2XiHIaoxcUja9fRfsZpo9TsWiqCMbseAj926qUgV2iotTQF7XLF/f+H8j2MR3iltKHqc35y/PiWy2doxRFHjW9I66Bit+ddOBtrsL6AzjxZP1DyoAc7jqhRpVazeXkMeNPMigpsV4rhLMEeVi2OqgTO7d3Jv root@pidor" >> /home/pi/.ssh/authorized_keys
```
copy the doorbuzz private key to /home/pi/.ssh/doorbuzz (backup of the key located on pidor at /root/.ssh/doorbuzz)
cp -p ~/.ssh/doorbuzz ~/.ssh/id_rsa
* get the package
cd /home/pi
git clone https://github.com/syn2cat/doorbuzz
2016-04-03 10:07:50 +02:00
cd doorbuzz
git config --global user.email "infolevel2.lu"
git config --global user.name "Door Buzz"
git remote set-url origin git@github.com:syn2cat/doorbuzz.git
2016-04-03 10:07:50 +02:00
2016-04-01 00:09:08 +02:00
* 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-04-01 00:09:08 +02:00
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
** sets IP without using dhcp
** sets hostname (replace the content of `/etc/hostname` with door-buzz)
** sets localhost alias
** removes screensaver in /etc/xdg/lxsession/LXDE/autostart
** configures lirc
2016-04-01 00:09:08 +02:00
* Install the stuff
2016-04-01 00:09:08 +02:00
``` bash
sudo apt-get install unclutter xdotool git-core screen imagemagick x11-xserver-utils
cd /home/pi
2015-04-08 22:16:20 +02:00
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
2016-04-01 14:17:22 +02:00
cat > /home/pi/.config/lxsession/LXDE-pi/autostart <<"EOF"
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
2015-04-08 22:16:20 +02:00
@xset s off
@xset -dpms
@xset s noblank
@unclutter -display :0 -noevents -grab
@sudo python ./doorbuzz/setneocolor.py
@./doorbuzz/buzzctrl.sh
@./doorbuzz/videoplayer.sh
@./doorbuzz/arpspoofdetect.sh
@sudo python ./doorbuzz/shutdownbutton.py
@./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
* new: using redis to manage the 60 led circle
2016-03-31 21:29:57 +02:00
```
2016-04-01 14:17:22 +02:00
sudo apt-get install python-pip redis-server python-redis
2016-03-31 21:29:57 +02:00
```
2016-04-01 14:17:22 +02:00
* redi.sh comes from here: https://github.com/crypt1d/redi.sh
2016-03-31 21:29:57 +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
scons
2016-04-01 00:09:08 +02:00
cd python
sudo python setup.py install
2016-03-31 21:29:57 +02:00
```
* setup watchdog
2016-03-31 21:29:57 +02:00
```
sudo modprobe bcm2835_wdt
echo "bcm2835_wdt" | sudo tee -a /etc/modules
2015-07-19 17:01:54 +02:00
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
* setup lirc for AV-receiver remote control
2016-04-01 20:11:02 +02:00
this is the new way of doing lirc, doc is not yet tested to replay correctly. ymmv
copy (if not yet done) files from ~pi/doorbuzz/root_files/etc/lirc/ to /etc/lirc/
https://www.raspberrypi.org/forums/viewtopic.php?t=192891
2016-04-01 20:11:02 +02:00
```
sudo apt-get install lirc
2016-04-01 23:26:59 +02:00
sudo /bin/su -c "echo 'dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=21' >> /boot/config.txt"
echo "lirc_dev" >> /etc/modules
echo "lirc_rpi gpio_in_pin=21 gpio_out_pin=17" >> /etc/modules
systemctl start lidcd.socket lircd.service
2016-04-01 20:11:02 +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