3.6 KiB
3.6 KiB
RASPBERRY PI ALS ZENTRALRECHNER FUER BIENENSTOCKUEBERWACHUNG
Hardware Variante A
- Raspberry Pi Zero W
- 3G Stick Huawei E3531
Hardware Variante B (Kurt Jakob)
- Raspberry Pi 3 Model B
- Itead Raspberry Pi GSM/GPRS Board (SIM800)
- ModMyPi Itead GSM Board Gehäuse
INSTALLATION
Grundinstallation
Image: 2017-09-07-raspbian-stretch-lite.zip von https://www.raspberrypi.org/downloads/raspbian/
Installation auf SD:
# unzip -p 2017-09-07-raspbian-stretch-lite.zip |dd of=/dev/sdXXX bs=4M conv=fsync
# raspi-config
- Change User Password: meielis-...
- Hostname: beielipi
- locale: en_US.utf8 (auch Default)
- locale: de_CH.utf8
- Timezone: Europe/Zurich
- Change Wifi Country: CH
- Keyboard: Generic 105-key (Intl), German (Switzerland)
- Enable SSH Server
- Fuer Variante A: WLAN einrichten (siehe "per WLAN")
# apt-get update
# apt-get upgrade
Software installieren:
# apt-get install gammu python-gammu
# apt-get install python-serial
# apt-get install python-yaml
# apt-get install minicom
# apt-get install ppp
# apt-get install python-pexpect
# apt-get install hostapd
# apt-get install ntpdate
# apt-get install dnsmasq
# apt-get install python-bottle
Firmware-Update:
# rpi-update
Zugang ermöglichen
per WLAN
# cat /etc/wpa_supplicant/wpa_supplicant.conf
country=CH
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="haerdoepfu27" psk="XXXXXXXXXXXX"
}
per LAN
root@beielipi:~# cat /etc/network/interfaces.d/eth0
auto eth0
iface eth0 inet static
address 192.168.0.50
netmask 255.255.255.0
Variante A
Einrichten GSM:
/etc/usb_modeswitch.d/12d1:157d:
#Huawei E3533
TargetVendor=0x12d1
TargetProduct=0x1436
MessageContent="55534243123456780000000000000011063000000000010000000000000000"
NoMBIMCheck=1
/etc/usb_modeswitch.conf:
SetStorageDelay=4
Quick Tutorial Gammu:
https://wammu.eu/docs/manual/quick/index.html
Folgender Init-String muss gesendet werden (sonst werden die empfangenen SMS nicht abfragbar sein):
AT+CPMS="SM";+CNMI=2,0,0,2,1
Wir fuegen den String in /etc/chatscripts/gprs ein:
# +CPIN provides the SIM card PIN
#OK "AT+CPIN=1234"
# Einstellungen wegen SMS-Empfang
OK AT+CPMS="SM";+CNMI=2,0,0,2,1
Variante B
# systemctl disable hciuart.service
# cat /boot/config.txt
...
# Wegen GSM Modul
dtoverlay=pi3-miniuart-bt
#dtoverlay=pi3-disable-bt
enable_uart=1
===
# cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 root=PARTUUID=61612258-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
===
Test SMS-Versand:
gammu sendsms TEXT 0765006123 -text "Halooo von beielipi"
Installation Applikation
User/Gruppe erstellen:
# groupadd -g 2000 beieli
# useradd -m -g beieli beieli -s /bin/bash
# usermod -a -G dialout beieli
Passwoerter anpassen:
# passwd pi => meielis-...
# Aus Git uebernehmen:
(auf anderem Rechner):
$ git clone https://git.nbit.ch/joerg/beielipi.git
$ cd beielipi
$ tar cvf /var/tmp/beielipi-git-files.tar .
# cd /home/beieli && tar xvf /var/tmp/beielipi-git-files.tar
# rm -rf /home/beieli/.git
# chown -R beieli:beieli /home/beieli
# chown -R root:root /home/beieli/root-bin
# chown -R root:root /home/beieli/web-root
# su - beieli
beieli@beielipi:~ $ mkdir config_backups data send_sms_queue tmp web-csv
beieli@beielipi:~ $ exit
# cd /home/beieli/install-files
# for i in $(find . -type f); do echo cp $i /$i ; done
# for i in $(find . -type f); do cp $i /$i ; done
Fuer Variante A wieder loeschen:
# rm /etc/cron.d/gsm_poweron
# systemctl enable beielimon
# systemctl enable smsmon
Fuer Variante B:
# systemctl disable dhcpcd
Reboot:
# init 6