User Tools

Site Tools


rocnet:headless-cam-de

This is an old revision of the document!


Headless-Konfiguration

SD-Card mit Raspbian-Lite

Siehe

wie ein SD-Image erstellt wird.


Konfigurieren der Boot-Partition

Eine Datei namens wpa_supplicant.conf mit folgendem Inhalt lokal erstellen:

country=DE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
       ssid="<my SSID>"
       psk="<my PASSWORD>"
       key_mgmt=WPA-PSK
}

Die "<my*>"-Werte durch die realen ersetzen.

  • Hinweis: Mehrere Netzwerkdefinitionen scheinen erlaubt zu sein.

Eine leere Datei namens "SSH" und die "wpa_supplicant.conf"-Datei in die Boot-Partition der SD-Card kopieren:

  1. Unmounten und Auswerfen der SD-Card.
  2. Einsetzen der SD-Card in den Slot des Raspberry Pi.
  3. Raspberry Pi einschalten.
  4. Ein paare Minuten warten, um dem Raspbian Zeit für die Größenanpassung des Datei-Systems zu geben. (Mit einem an dem Mini-HDMI angeschlossenen Monitor kann der Fortschritt beobachtet werden.)


Raspbian SSH-Verbindung

ssh pi@raspberrypi

Das Standard-Passwort ist raspberry

Raspbian-Update

sudo apt update
sudo apt upgrade


Raspi-Konfiguration

ssh pi@raspberrypi
sudo raspi-config








Python-Script

Die cam.py.zip entzippen und zum Raspberry Pi kopieren:

scp cam.py pi@raspberrypi:/home/pi


PiCamera installieren

ssh pi@raspberrypi
sudo apt install python3-picamera


Script starten

ssh pi@raspberrypi
nano startcam.sh

Das Script "/home/pi/startcam.sh" mit forlgendem Inhalt erstellen:

#!/bin/sh
cd /home/pi
python3 cam.py

Das Script ausführbar machen:

chmod +x startcam.sh


Crontab

Die Zeile "@reboot /home/pi/startcam.sh" der crontab hinzufügen:

ssh pi@raspberrypi
crontab -e

no crontab for pi - using an empty one

Select an editor.  To change later, run 'select-editor'.
  1. /bin/nano        <---- easiest
  2. /usr/bin/vim.tiny
  3. /bin/ed

Choose 1-3 [1]: 

Den nano editor mit ctrl+x nach Editieren schliessen, um die Änderungen zu speichern.

Prüfen, ob die Änderungen gespeichert sind:

crontab -l
# Edit this file to introduce tasks to be run by cron.
# 
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
# 
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
# 
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
# 
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
# 
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# 
# For more information see the manual pages of crontab(5) and cron(8)
# 
# m h  dom mon dow   command
@reboot /home/pi/startcam.sh

Reboot des Raspberry Pi:

sudo reboot


Boot Geschwindigkeit

systemd-analyze blame


Hinweise

SSH

  • Die Terminal/Consolen-Befehle ssh und scp sind unter Linux, Windows10 und Apple macOS verfügbar.
  • Wenn "raspberrypi" cnicht aufgelöst werden kann , "Could not resolve hostname raspberrypi", im Router prüfen und stattdessen die IP-Adresse verwenden:

Beim Boot auf Netzwerk warten

Unter bestimmten Netzwerkbedingungen muss die folgende Systemoption (sudo raspi-conf) aktiviert werden, wenn WIOpi oder CAM beim Booten nicht gestartet werden:

  • 1 System-Optionen
    • S6 Netzwerk beim Boot 1)
1)
Warten auf Netzwerkverbindung beim Booten auswählen
rocnet/headless-cam-de.1611355139.txt.gz · Last modified: 2021/01/22 23:38 by rainerk