User Tools

Site Tools


rocnet:headless-cam-fr
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


rocnet:headless-cam-fr [2019/08/19 15:54] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +======Configuration sans écran======
 +[[:france#rocview|{{  :viewer.png}}]][[:france|{{  :rocrail-logo-35.png}}]]
 +[[:france|Sommaire]] -> [[:france#rocview|Rocview ]] -> [[:rocnet:cam-fr|Diffusion par caméra]]
 +  * **[[:rocnet:headless-cam-fr|Configuration sans écran]]**
 + 
 +|< >|
 +^  [[https://en.wikipedia.org/wiki/Headless_computer|Wikipedia explique le "sans écran" en anglais]]  ^
 + \\
 + \\
 +=====Carte SD avec Raspbian Lite=====
 +Voir 
 +  * https://www.raspberrypi.org/downloads/raspbian/
 +sur comment créer une image sur carte SD.\\
  
 +
 + \\
 +=====Configurer la partition Boot=====
 +Crérer localement un fichier nommé "wpa_supplicant.conf" avec le contenu suivant:
 +<code>
 +country=FR
 +ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
 +update_config=1
 +network={
 +       ssid="<my SSID>"
 +       psk="<my PASSWORD>"
 +       key_mgmt=WPA-PSK
 +}
 +</code>
 +Remplacer les valeurs "<my*>" avec les vraies valeurs.\\
 +
 +
 +Copier un fichier vide nommé "SSH", et un fichier "wpa_supplicant.conf" dans la partition boot de la carte SD:\\
 +{{:rocnet:cam:boot-1.png?400}}{{:rocnet:cam:boot-2.png?400}}\\
 +
 +  - Démonter/Éjecter la carte SD.
 +  - Insérer la carte SD dans l'emplacement du Raspberry Pi.
 +  - Alimenter le Raspberry Pi.
 +  - Attendre quelques minutes pour donner du temps à Raspbian de re-dimentionner le système de fichiers. (Avec un écran branché, sur le Mini-HDMI, la progression peut être vue.)
 +
 + \\
 +=====Mise à jour de Raspbian=====
 +<code>
 +ssh pi@raspberrypi
 +sudo apt update
 +sudo apt upgrade
 +</code>
 +
 +
 + \\
 +=====Raspi-Config=====
 +<code>
 +ssh pi@raspberrypi
 +sudo raspi-config
 +</code>
 +{{:rocnet:cam:conf-1.png?600}}\\
 +{{:rocnet:cam:conf-2.png?600}}\\
 +{{:rocnet:cam:conf-3.png?600}}\\
 +{{:rocnet:cam:conf-4.png?600}}\\
 +{{:rocnet:cam:conf-5.png?600}}\\
 +{{:rocnet:cam:conf-6.png?600}}\\
 +
 +
 +
 + \\
 +=====Python Script=====
 +Décompresser le fichier {{:rocnet:cam:cam.py.zip|cam.py.zip}}, et copier le sur le Raspberry Pi:
 +<code>
 +scp cam.py pi@raspberrypi:/home/pi
 +</code>
 +
 +
 + \\
 +=====Installer PiCamera=====
 +<code>
 +ssh pi@raspberrypi
 +sudo apt install python3-picamera
 +</code>
 +
 +
 + \\
 +=====Démarrer le script=====
 +<code>
 +ssh pi@raspberrypi
 +nano startcam.sh
 +</code>
 +Créer le script "/home/pi/startcam.sh" avec le contenu suivant:
 +<code bash>
 +#!/bin/sh
 +cd /home/pi
 +python3 cam.py
 +</code>
 +Rendre le script exécutable:
 +<code>
 +chmod +x startcam.sh
 +</code>
 +
 + \\
 +=====Crontab=====
 +Ajouter la ligne "@reboot /home/pi/startcam.sh" au crontab:
 +<code>
 +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]: 
 +</code>
 +Fermer l'éditeur nano avec ctrl+x après avoir sauvegardé les changements édités.\\
 +
 +Vérifier si les changements ont été sauvegardés:
 +<code>
 +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
 +</code>
 +
 +Redémarrer le Raspberry Pi:
 +<code>
 +sudo reboot
 +</code>
 +
 +
 + \\
 +=====Notes=====
 +  * Les commandes **ssh** et **scp** du terminal/console sont disponible sous Linux, Windows10 et Apple macOS.
 +  * Si "raspberrypi" ne peut pas être résolu, "Could not resolve hostname raspberrypi", vérifier le routeur et utiliser l'adresse IP à la place: \\ {{:rocnet:cam:fritz.png?400}}
rocnet/headless-cam-fr.txt · Last modified: 2019/08/19 15:54 by 127.0.0.1