15-03-2019
This commit is contained in:
213
docs/Raspberry/hardware.md
Normal file
213
docs/Raspberry/hardware.md
Normal file
@@ -0,0 +1,213 @@
|
||||
# Hardware
|
||||
|
||||
|
||||
|
||||
#### Version of Debian:
|
||||
|
||||
```bash
|
||||
pi@framboise:~ $ cat /etc/debian_version
|
||||
9.6
|
||||
```
|
||||
|
||||
#### OS Release Notes:
|
||||
|
||||
```bash
|
||||
pi@framboise:~ $ cat /etc/os-release
|
||||
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
|
||||
NAME="Raspbian GNU/Linux"
|
||||
VERSION_ID="9"
|
||||
VERSION="9 (stretch)"
|
||||
ID=raspbian
|
||||
ID_LIKE=debian
|
||||
HOME_URL="http://www.raspbian.org/"
|
||||
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
|
||||
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
|
||||
```
|
||||
|
||||
#### Kernel version:
|
||||
|
||||
```bash
|
||||
pi@framboise:~ $ uname -a
|
||||
Linux framboise 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux
|
||||
```
|
||||
|
||||
#### Harware version:
|
||||
|
||||
```bash
|
||||
pi@framboise:~ $ cat /proc/cpuinfo
|
||||
processor : 0
|
||||
model name : ARMv7 Processor rev 4 (v7l)
|
||||
BogoMIPS : 38.40
|
||||
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
|
||||
CPU implementer : 0x41
|
||||
CPU architecture: 7
|
||||
CPU variant : 0x0
|
||||
CPU part : 0xd03
|
||||
CPU revision : 4
|
||||
|
||||
processor : 1
|
||||
model name : ARMv7 Processor rev 4 (v7l)
|
||||
BogoMIPS : 38.40
|
||||
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
|
||||
CPU implementer : 0x41
|
||||
CPU architecture: 7
|
||||
CPU variant : 0x0
|
||||
CPU part : 0xd03
|
||||
CPU revision : 4
|
||||
|
||||
processor : 2
|
||||
model name : ARMv7 Processor rev 4 (v7l)
|
||||
BogoMIPS : 38.40
|
||||
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
|
||||
CPU implementer : 0x41
|
||||
CPU architecture: 7
|
||||
CPU variant : 0x0
|
||||
CPU part : 0xd03
|
||||
CPU revision : 4
|
||||
|
||||
processor : 3
|
||||
model name : ARMv7 Processor rev 4 (v7l)
|
||||
BogoMIPS : 38.40
|
||||
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
|
||||
CPU implementer : 0x41
|
||||
CPU architecture: 7
|
||||
CPU variant : 0x0
|
||||
CPU part : 0xd03
|
||||
CPU revision : 4
|
||||
|
||||
Hardware : BCM2835
|
||||
Revision : a02082
|
||||
Serial : 000000004c7a2d11
|
||||
```
|
||||
|
||||
|
||||
Revision: a02082 correspond au Pi3 Model B
|
||||
|
||||
https://elinux.org/RPi_HardwareHistory
|
||||
|
||||
|
||||
|
||||
#### Autres méthodes (Raspian reçent):
|
||||
|
||||
```bash
|
||||
pi@framboise:~ $ cat /proc/device-tree/model
|
||||
Raspberry Pi 3 Model B Rev 1.2
|
||||
```
|
||||
|
||||
```bash
|
||||
pi@framboise:~ $ pinout
|
||||
,--------------------------------.
|
||||
| oooooooooooooooooooo J8 +====
|
||||
| 1ooooooooooooooooooo | USB
|
||||
| +====
|
||||
| Pi Model 3B V1.2 |
|
||||
| +----+ +====
|
||||
| |D| |SoC | | USB
|
||||
| |S| | | +====
|
||||
| |I| +----+ |
|
||||
| |C| +======
|
||||
| |S| | Net
|
||||
| pwr |HDMI| |I||A| +======
|
||||
`-| |--------| |----|V|-------'
|
||||
|
||||
Revision : a02082
|
||||
SoC : BCM2837
|
||||
RAM : 1024Mb
|
||||
Storage : MicroSD
|
||||
USB ports : 4 (excluding power)
|
||||
Ethernet ports : 1
|
||||
Wi-fi : True
|
||||
Bluetooth : True
|
||||
Camera ports (CSI) : 1
|
||||
Display ports (DSI): 1
|
||||
|
||||
J8:
|
||||
3V3 (1) (2) 5V
|
||||
GPIO2 (3) (4) 5V
|
||||
GPIO3 (5) (6) GND
|
||||
GPIO4 (7) (8) GPIO14
|
||||
GND (9) (10) GPIO15
|
||||
GPIO17 (11) (12) GPIO18
|
||||
GPIO27 (13) (14) GND
|
||||
GPIO22 (15) (16) GPIO23
|
||||
3V3 (17) (18) GPIO24
|
||||
GPIO10 (19) (20) GND
|
||||
GPIO9 (21) (22) GPIO25
|
||||
GPIO11 (23) (24) GPIO8
|
||||
GND (25) (26) GPIO7
|
||||
GPIO0 (27) (28) GPIO1
|
||||
GPIO5 (29) (30) GND
|
||||
GPIO6 (31) (32) GPIO12
|
||||
GPIO13 (33) (34) GND
|
||||
GPIO19 (35) (36) GPIO16
|
||||
GPIO26 (37) (38) GPIO20
|
||||
GND (39) (40) GPIO21
|
||||
|
||||
For further information, please refer to https://pinout.xyz/
|
||||
```
|
||||
|
||||
#### Version actuelle du firmware:
|
||||
|
||||
```bash
|
||||
pi@framboise:~ $ vcgencmd version
|
||||
Nov 4 2018 16:35:17
|
||||
Copyright (c) 2012 Broadcom
|
||||
version ed5baf9520a3c4ca82ba38594b898f0c0446da66 (clean) (release)
|
||||
```
|
||||
|
||||
#### Télécharger la m-à-j du firmware sans installer:
|
||||
|
||||
```bash
|
||||
pi@framboise:~ $ sudo JUST_CHECK=1 rpi-update
|
||||
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
|
||||
*** Performing self-update
|
||||
% Total % Received % Xferd Average Speed Time Time Time Current
|
||||
Dload Upload Total Spent Left Speed
|
||||
100 13545 100 13545 0 0 43575 0 --:--:-- --:--:-- --:--:-- 43693
|
||||
*** Relaunching after update
|
||||
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
|
||||
*** We're running for the first time
|
||||
```
|
||||
|
||||
#### Mettre à jour le firmware:
|
||||
|
||||
```bash
|
||||
pi@framboise:~ $ sudo rpi-update
|
||||
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
|
||||
*** Performing self-update
|
||||
*** Relaunching after update
|
||||
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
|
||||
*** We're running for the first time
|
||||
*** Backing up files (this will take a few minutes)
|
||||
*** Backing up firmware
|
||||
*** Backing up modules 4.14.79-v7+
|
||||
|
||||
###### #######################################################
|
||||
|
||||
This update bumps to rpi-4.14.y linux tree
|
||||
Be aware there could be compatibility issues with some drivers
|
||||
Discussion here:
|
||||
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=197689
|
||||
|
||||
###### ########################################################
|
||||
|
||||
*** Downloading specific firmware revision (this will take a few minutes)
|
||||
% Total % Received % Xferd Average Speed Time Time Time Current
|
||||
Dload Upload Total Spent Left Speed
|
||||
100 168 0 168 0 0 420 0 --:--:-- --:--:-- --:--:-- 421
|
||||
100 56.2M 100 56.2M 0 0 3594k 0 0:00:16 0:00:16 --:--:-- 3192k
|
||||
*** Updating firmware
|
||||
*** Updating kernel modules
|
||||
*** depmod 4.14.94+
|
||||
*** depmod 4.14.94-v7+
|
||||
*** Updating VideoCore libraries
|
||||
*** Using HardFP libraries
|
||||
*** Updating SDK
|
||||
*** Running ldconfig
|
||||
*** Storing current firmware revision
|
||||
*** Deleting downloaded files
|
||||
*** Syncing changes to disk
|
||||
*** If no errors appeared, your firmware was successfully updated to 699879be36d90225232de87e9ae589be7209b14c
|
||||
*** A reboot is needed to activate the new firmware
|
||||
```
|
||||
|
||||
180
docs/Raspberry/headless.md
Normal file
180
docs/Raspberry/headless.md
Normal file
@@ -0,0 +1,180 @@
|
||||
# Headless
|
||||
|
||||
|
||||
|
||||
Télécharger l'image [Raspian Stretch Lite](https://www.raspberrypi.org/downloads/raspbian/) et l'installer sur la carte SD avec [Etcher](https://www.balena.io/etcher/).
|
||||
|
||||
Activer et connecter le wifi:
|
||||
|
||||
Il faut créer un fichier `wpa_supplicant.conf` dans /boot
|
||||
|
||||
```bash
|
||||
# Depuis macOS
|
||||
cd /Volumes/boot
|
||||
nano wpa_supplicant.conf
|
||||
|
||||
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
|
||||
update_config=1
|
||||
country=FR
|
||||
|
||||
network={
|
||||
ssid="SSID"
|
||||
psk="Mot de passe"
|
||||
key_mgmt=WPA-PSK
|
||||
}
|
||||
```
|
||||
|
||||
Activer SSH:
|
||||
|
||||
Il faut créer un fichier `ssh` dans /boot
|
||||
|
||||
```bash
|
||||
#Depuis macOS
|
||||
cd /Volumes/boot
|
||||
touch ssh
|
||||
```
|
||||
|
||||
|
||||
Démarrer le Raspberry, il va se connecter automatiquement à la Box.
|
||||
Pour trouver l'ip, aller sur la box -> Configuration DHCP -> Baux DHCP valides
|
||||
|
||||
Se connecter au Raspberry en SSH:
|
||||
|
||||
```bash
|
||||
$ ssh pi@ip
|
||||
avec le mot-de-passe Raspberry
|
||||
```
|
||||
|
||||
Changer le mot-de-passe:
|
||||
|
||||
```bash
|
||||
$ passwd
|
||||
Changing password for pi.
|
||||
(current) UNIX password:
|
||||
Enter new UNIX password:
|
||||
Retype new UNIX password:
|
||||
passwd: password updated successfully
|
||||
```
|
||||
|
||||
Mettre en IP fixe:
|
||||
|
||||
```bash
|
||||
$ sudo nano /etc/dhcpcd.conf
|
||||
|
||||
à rajouter à la fin du fichier:
|
||||
interface eth0
|
||||
static ip_address=192.168.1.24/24
|
||||
static routers=192.168.1.1
|
||||
static domain_name_servers=192.168.1.1
|
||||
|
||||
interface wlan0
|
||||
static ip_address=192.168.1.23/24
|
||||
static routers=192.168.1.1
|
||||
static domain_name_servers=192.168.1.1
|
||||
```
|
||||
|
||||
Ajouter la clé ssh:
|
||||
|
||||
```
|
||||
bruno@silverbook:~/.ssh$ ssh pi@framboise.local 'mkdir -p ~/.ssh; chmod 0700 ~/.ssh; echo ' $(< ~/.ssh/id_ed25519.pub) ' >> ~/.ssh/authorized_keys ; chmod 0600 ~/.ssh/authorized_keys'
|
||||
```
|
||||
|
||||
Sécuriser ssh:
|
||||
|
||||
```bash
|
||||
$ sudo nano /etc/ssh/sshd_config
|
||||
Port 36722
|
||||
PermitRootLogin prohibit-password
|
||||
|
||||
yes (défaut)
|
||||
# without-password (prohibit-password) authentification par mot de passe désactivée, # authentification par clé publique seulement
|
||||
# forced-commands-only avec l'option Commande, authentification par clé publique seulement
|
||||
# no
|
||||
|
||||
$ sudo service ssh restart
|
||||
```
|
||||
|
||||
Configurer le Raspberry:
|
||||
|
||||
```bash
|
||||
$ sudo raspi-config
|
||||
|
||||
-Network Options -> changer le hostname
|
||||
-Localisations Options -> Change Locale, Change Timezone
|
||||
-Interfacing Options -> enable Camera, SPI, I2C, Serial
|
||||
-Advanced Options -> Expanding filesystem
|
||||
-Update (raspi-config)
|
||||
```
|
||||
|
||||
Installer git:
|
||||
|
||||
```bash
|
||||
$ sudo apt-get install -y git dirmngr
|
||||
```
|
||||
|
||||
Installer log2ram:
|
||||
|
||||
```bash
|
||||
cd /home/pi
|
||||
git clone https://github.com/azlux/log2ram.git
|
||||
cd log2ram
|
||||
chmod +x install.sh
|
||||
sudo ./install.sh
|
||||
|
||||
#Change the log size value to 128M
|
||||
sudo vi /etc/log2ram.conf
|
||||
```
|
||||
|
||||
Vérifier l'installation de log2ram:
|
||||
|
||||
```
|
||||
$ df -h
|
||||
Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
|
||||
/dev/root 15G 1,1G 13G 8% /
|
||||
devtmpfs 181M 0 181M 0% /dev
|
||||
tmpfs 186M 0 186M 0% /dev/shm
|
||||
tmpfs 186M 2,7M 183M 2% /run
|
||||
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
|
||||
tmpfs 186M 0 186M 0% /sys/fs/cgroup
|
||||
/dev/mmcblk0p1 44M 23M 22M 51% /boot
|
||||
log2ram 40M 636K 40M 2% /var/log
|
||||
tmpfs 37M 0 37M 0% /run/user/1000
|
||||
```
|
||||
|
||||
Toutes les heures, log2ram copie les logs en mémoire vers les fichiers. On peut modifier pour que ce soit tous les jours.
|
||||
|
||||
```bash
|
||||
sudo mv /etc/cron.hourly/log2ram /etc/cron.daily/log2ram
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
Mettre à jour le Raspberry:
|
||||
|
||||
```bash
|
||||
$ sudo apt-get update && sudo apt-get upgrade
|
||||
```
|
||||
|
||||
Créer un alias dans .bashrc:
|
||||
alias update='sudo apt-get update && sudo apt-get upgrade'
|
||||
|
||||
Backup de la carte SD
|
||||
https://raspberrypi.stackexchange.com/questions/311/how-do-i-backup-my-raspberry-pi
|
||||
|
||||
```bash
|
||||
bruno@silverbook:~$ diskutil list
|
||||
bruno@silverbook:~$ sudo dd if=/dev/rdisk2 of=/Users/bruno/Downloads/litePi_1.img bs=1m
|
||||
# ou
|
||||
bruno@silverbook:~$ sudo dd if=/dev/rdisk2 bs=1m | gzip > /Users/bruno/Downloads/litePi_1.gz
|
||||
# avec progression:
|
||||
bruno@silverbook:~$ sudo dd if=/dev/rdisk2 bs=1m | pv | gzip > /Users/bruno/Downloads/litePi_1.gz
|
||||
```
|
||||
|
||||
Restaurer:
|
||||
|
||||
```bash
|
||||
bruno@silverbook:~$ diskutil list
|
||||
bruno@silverbook:~$ sudo dd if=/Users/bruno/Downloads/litePi_1.img of=/dev/rdisk2 bs=1m
|
||||
# ou
|
||||
bruno@silverbook:~$ gzip -dc /Users/bruno/Downloads/litePi_1.gz | sudo dd of=/dev/rdisk2 bs=1m
|
||||
```
|
||||
|
||||
@@ -1,13 +1,28 @@
|
||||
# Raspberry
|
||||
|
||||
|
||||
|
||||
[apt-get & apt-cache](apt-get.md)
|
||||
|
||||
[aptitude](aptitude.md)
|
||||
|
||||
[Backup](backup.md)
|
||||
|
||||
[Commandes apt-get & apt-cache](apt-get.md)
|
||||
[Envoyer un mail depuis le Raspberry](send_mail.md)
|
||||
|
||||
[Hardware](hardware.md)
|
||||
|
||||
[Matériels](materiels/materiels.md)
|
||||
|
||||
[Réseau](reseau.md)
|
||||
|
||||
[Boot et clone](boot.md)
|
||||
|
||||
[Bouton du Pi Desktop](pi-desktop.md)
|
||||
[Pi Desktop](pi-desktop.md)
|
||||
|
||||
[Divers](divers.md)
|
||||
|
||||
[SiriControl](siri_control.md)
|
||||
|
||||
[Tools](tools.md)
|
||||
|
||||
[Divers](divers.md)
|
||||
19
docs/Raspberry/materiels/HC-SR04.md
Normal file
19
docs/Raspberry/materiels/HC-SR04.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Capteur à Ultra-sons HC-SR04
|
||||
|
||||
|
||||
|
||||
[http://espace-raspberry-francais.fr/Composants/Mesure-de-distance-avec-HC-SR04-Raspberry-Francais/](http://espace-raspberry-francais.fr/Composants/Mesure-de-distance-avec-HC-SR04-Raspberry-Francais/)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Autre capteur: SRF06
|
||||
[http://www.yoctopuce.com/FR/article/le-srf06-un-capteur-de-distance-bon-marche](http://www.yoctopuce.com/FR/article/le-srf06-un-capteur-de-distance-bon-marche)
|
||||
|
||||
33
docs/Raspberry/materiels/HC-SR501.md
Normal file
33
docs/Raspberry/materiels/HC-SR501.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Détecteur de mouvement PIR infrarouge HC-SR501
|
||||
|
||||
|
||||
|
||||
[http://espace-raspberry-francais.fr/Composants/Capteur-presence-HC-SR501-Raspberry-Francais/](http://espace-raspberry-francais.fr/Composants/Capteur-presence-HC-SR501-Raspberry-Francais/)
|
||||
[http://www.ihm3d.fr/httpwww-ihm3d-frutilisation-dun-detecteur-de-mouvement-hc-sr501-avec-arduino-raspberry-pi3.html](http://www.ihm3d.fr/httpwww-ihm3d-frutilisation-dun-detecteur-de-mouvement-hc-sr501-avec-arduino-raspberry-pi3.html)
|
||||
|
||||
#### Ordre des broches (côté micro-controleur):
|
||||
|
||||
VCC - Out - GND
|
||||
L'ordre peut varier selon les modèles. <u>Le micro-controleur est toujours côté GND</u>. Sinon déclipser le dome pour vérifier.
|
||||
|
||||
#### PIR (Passive Infrared Sensor)
|
||||
|
||||
|
||||
Le détecteur HC-SR501 fonctionne grâce au rayonnement infrarouge. Il possède deux états, haut et bas. Lorsque quelque chose se trouve en mouvement dans son champ de vision, il passe à l'état haut. Lorsque celui-ci ne détecte aucun mouvements, il passe à l'état bas.
|
||||
|
||||
Le détecteur possède deux potentiomètres qui correspondent:
|
||||
|
||||
- au temps de détection
|
||||
- à la distance de détection.
|
||||
|
||||
Lorsque l'on tourne le <u>potentiomètre du temps de détection</u> dans le sens des aiguilles d'une montre, la durée est plus longue (de 3 secondes à 5 minutes).
|
||||
Lorsque l'on tourne le <u>potentiomètre de la distance de détection</u> dans le sens des aiguilles d'une montre, celle-ci est plus grande (3 mètres à 7 mètres).
|
||||
|
||||
Le détecteur possède aussi un cavalier qui permet de déterminer le <u>mode de détection</u> : un mode de <u>détection unique</u>, et un mode de <u>détection multiple</u>.
|
||||
|
||||
- H (repeat): le capteur continue de sortir un signal Haut tant qu'il continue de détecter un mouvement.
|
||||
- L (no repeat): le capteur continue de sortir un signal Haut pour la période réglée par le potentiomètre Temps.
|
||||
|
||||
A la mise sous tension, le capteur se calibre par rapport à son envirronnement (30-60s).
|
||||
Après une détection, le capteur se reset. Durant cette période (5-6s), il ne détecte aucun mouvement.
|
||||
|
||||
53
docs/Raspberry/materiels/camera.md
Normal file
53
docs/Raspberry/materiels/camera.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# Caméra
|
||||
|
||||
|
||||
|
||||
#### Installer la caméra:
|
||||
|
||||
https://www.rs-online.com/designspark/raspberry-pi-camera-setup
|
||||
|
||||
1. Eteindre le Raspberry
|
||||
|
||||
2. Brancher la caméra au connecteur CSI (entre Ethernet et HDMI), la partie alu côté HDMI.
|
||||
|
||||
3. Redémarrer le Raspberry et activer la caméra dans Raspi-config
|
||||
|
||||
```bash
|
||||
$ sudo raspi-config
|
||||
# 5 Interfacing Options -> P1 Camera -> enable
|
||||
```
|
||||
|
||||
4. Redémarrer
|
||||
|
||||
#### Capturer une image:
|
||||
|
||||
```bash
|
||||
# au format jpeg
|
||||
$ raspistill -o image.jpg
|
||||
# largeur 1200px
|
||||
$ raspistill -w 1200 -o image.jpg
|
||||
```
|
||||
|
||||
#### Capturer une video:
|
||||
|
||||
```bash
|
||||
# 5s au format h264
|
||||
$ raspivid -o video.h264
|
||||
|
||||
# 10s
|
||||
$ raspivid -o video.h264 -t 10000
|
||||
# largeur 1200px
|
||||
$ raspivid -w 1200$ raspivid -o video.h264 -t 10000
|
||||
|
||||
# 10s dans le mode demo
|
||||
$ raspivid -o video.h264 -t 10000 -d
|
||||
```
|
||||
|
||||
Pour voir la liste des options de **raspivid** ou **raspistill**:
|
||||
|
||||
```bash
|
||||
$ raspivid | less
|
||||
|
||||
$ raspistill | less
|
||||
```
|
||||
|
||||
30
docs/Raspberry/materiels/materiels.md
Normal file
30
docs/Raspberry/materiels/materiels.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Matériels
|
||||
|
||||
|
||||
|
||||
Chargeur USB 5V 1A 1000C PowerBoost 1000
|
||||
TPS61090
|
||||
adafruit
|
||||
|
||||
Module Camera v2 8MP
|
||||
|
||||
Caméra Infrarouge v2 8MP
|
||||
|
||||
Raspberry Pi Camera à vision nocturneFish Eye 5MP avec 2 IR
|
||||
|
||||
Ecran tactile 7" 1024x600 Capacitif HDMI
|
||||
|
||||
Flex cable pour RPi Camera 300mn
|
||||
|
||||
4 Canaux Module 5V DC Relais pour Arduino DSP AVR PIC ARM Raspberry Pi Relay
|
||||
5V 4 canaux Relais carte d'interface, et chacun a besoin 15-20mA actuel du pilote.
|
||||
Equipé de relais à courant élevé, AC250V 10A; DC30V 10A.
|
||||
Interface standard qui peut être contrôlé directement par le microcontrôleur (Arduino, 8051, AVR, PIC, DSP, ARM, ARM, MSP430, logique TTL).
|
||||
Indication des LED pour l'état de sortie de relais.
|
||||
|
||||
RPI RELAY BOARD
|
||||
|
||||
Capteur à Ultra-sons [HC-SR04](HC-SR04.md)
|
||||
|
||||
Détecteur de mouvement PIR infrarouge [HC-SR501](HC-SR501.md)
|
||||
|
||||
@@ -1,20 +1,78 @@
|
||||
# Pi Desktop
|
||||
|
||||
### Télécharger le paquet Pi Desktop:
|
||||
#### Télécharger le paquet Pi Desktop:
|
||||
|
||||
https://github.com/pi-desktop/deb-make/releases
|
||||
|
||||
https://github.com/hoopsurfer/pidesktop (Fork)
|
||||
|
||||
|
||||
### Installer Pi Desktop:
|
||||
|
||||
#### Installer Pi Desktop:
|
||||
|
||||
```bash
|
||||
Installer Pi Desktop:
|
||||
# Supprimer l'ancienne version
|
||||
$ sudo dpkg -r pidesktop-base
|
||||
# Installer
|
||||
$ sudo dpkg -i pidesktop-base-1.1.0.deb
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Bouton du Pi Desktop:
|
||||
Le RPi 3+ peut nativement booter depuis un disque USB.
|
||||
|
||||
Il y a 2 méthodes:
|
||||
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/README.md
|
||||
|
||||
1. **Avec une carte une SD:**
|
||||
Cloner la carte SD sur le mSSD avec SD Carte Copier
|
||||
Dans `/boot/cmdline.txt`, changer `root=/dev/mmcblk0p2 par root=/dev/sdx2`.
|
||||
|
||||
2. **Sans carte SD:**
|
||||
|
||||
Dans ce cas, pour le RPi 3, il faut que le bit USB boot soit mis dans le OTP:
|
||||
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md
|
||||
|
||||
On vérifie si le boot USB est actif:
|
||||
|
||||
```bash
|
||||
$ vcgencmd otp_dump | grep 17:
|
||||
17:1020000a
|
||||
La valeur doit être 3020000a
|
||||
```
|
||||
|
||||
On active le boot USB:
|
||||
|
||||
```bash
|
||||
$ echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt
|
||||
$ sudo reboot
|
||||
```
|
||||
|
||||
On vérifie que le boot USB est actif:
|
||||
|
||||
```bash
|
||||
$ vcgencmd otp_dump | grep 17:
|
||||
17:3020000a
|
||||
```
|
||||
|
||||
On peut supprimer la ligne `program_usb_boot_mode=1` dans le config.txt pour
|
||||
éviter de l'activer par inadvertance si on insère la carte dans un autre Raspberry.
|
||||
L'activation du bit USB boot dans le OTP est définitive (mais n'empêche pas de démarrer sur la SD ultérieurement).
|
||||
|
||||
Cloner la carte SD sur le mSSD avec SD Carte Copier (la commande pd-clonessd ouvre bien SD Carte Copier mais ce dernier reste grisé)
|
||||
Lancer la commande pd-bootssd
|
||||
|
||||
On peut retirer la SD et démarrer sur le mSSD. Perso, j'ai laissé la SD en place qui me sert de backup.
|
||||
|
||||
<u>config.txt (mSSD)</u>
|
||||
`dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=4ad391be-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait`
|
||||
<u>config.txt (SD)</u>
|
||||
`dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/sda2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait`
|
||||
|
||||
|
||||
|
||||
#### Bouton du Pi Desktop:
|
||||
|
||||
- Lorsque vous appuyez **une fois rapidement (plus de 150mS)** sur le bouton A/M, le Raspberry Pi **démarre**
|
||||
- Lorsque vous appuyez **plus longuement (plus de 2 secondes)** sur le bouton A/M, le programme de gestion **arrête proprement le Raspberry Pi** (le système s’arrête normalement) puis **coupe l’alimentation**.
|
||||
|
||||
@@ -1,33 +1,105 @@
|
||||
# Réseau et partage
|
||||
|
||||
|
||||
|
||||
#### Configurer le réseau wifi:
|
||||
|
||||
```bash
|
||||
$ nano /etc/wpa_supplicant/wpa_supplicant.conf
|
||||
|
||||
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
|
||||
update_config=1
|
||||
country=FR
|
||||
|
||||
network={
|
||||
ssid="Bart_nomap"
|
||||
psk="ma_clef_wifi"
|
||||
key_mgmt=WPA-PSK
|
||||
}
|
||||
```
|
||||
|
||||
#### Encoder le mot de passe:
|
||||
|
||||
```bash
|
||||
$ wpa_passphrase "Bart_nomap"
|
||||
|
||||
# reading passphrase from stdin
|
||||
|
||||
ma_clef_wifi
|
||||
network={
|
||||
ssid="Bart_nomap"
|
||||
#psk="ma_clef_wifi"
|
||||
psk=40e6467b0ab3569a63dfe33001abb3a6b8757989937091f3edf7c9d9bd508ede7
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ nano /etc/network/interfaces
|
||||
### (ne pas changer !!!) ###
|
||||
|
||||
# interfaces(5) file used by ifup(8) and ifdown(8)
|
||||
# Please note that this file is written to be used with dhcpcd
|
||||
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
|
||||
# Include files from /etc/network/interfaces.d:
|
||||
source-directory /etc/network/interfaces.d
|
||||
```
|
||||
|
||||
#### Adresses IP:
|
||||
|
||||
```bash
|
||||
$ ip -4 addr | grep global
|
||||
inet 192.168.1.254/24 brd 192.168.1.255 scope global eth0
|
||||
inet 192.168.1.21/24 brd 192.168.1.255 scope global wlan0
|
||||
```
|
||||
|
||||
#### Adresse du routeur (gateway):
|
||||
|
||||
```bash
|
||||
$ ip route | grep default | awk '{print $3}'
|
||||
192.168.1.1
|
||||
192.168.1.1
|
||||
```
|
||||
|
||||
#### Adresse du serveur DNS:
|
||||
|
||||
```bash
|
||||
$ cat /etc/resolv.conf
|
||||
|
||||
# Generated by resolvconf
|
||||
|
||||
domain home
|
||||
nameserver 192.168.1.1
|
||||
nameserver fe80::4265:a3ff:fec3:8132%eth0
|
||||
nameserver fe80::4265:a3ff:fec3:8132%wlan0
|
||||
```
|
||||
|
||||
#### Liste des noms d'interface
|
||||
|
||||
```bash
|
||||
$ ls /sys/class/net
|
||||
eth0 lo wlan0
|
||||
```
|
||||
|
||||
#### Mettre en IP fixe:
|
||||
|
||||
```bash
|
||||
$ sudo nano /etc/dhcpcd.conf
|
||||
|
||||
à rajouter à la fin du fichier:
|
||||
# à rajouter à la fin du fichier:
|
||||
|
||||
interface eth0
|
||||
|
||||
static ip_address=192.168.1.254/24
|
||||
|
||||
static routers=192.168.1.1
|
||||
|
||||
static domain_name_servers=8.8.8.8
|
||||
|
||||
interface wlan0
|
||||
|
||||
static ip_address=192.168.1.253/24
|
||||
|
||||
static routers=192.168.1.1
|
||||
|
||||
static domain_name_servers=8.8.8.8
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### VNC:
|
||||
|
||||
*VNC Server (Pi):*
|
||||
@@ -51,6 +123,27 @@ Port 5900
|
||||
|
||||
|
||||
|
||||
#### SSH:
|
||||
|
||||
Changer le port par défaut (22):
|
||||
|
||||
```bash
|
||||
$ sudo nano sshd_config
|
||||
|
||||
#Décommenter la ligne # Port 22 et modifier le port
|
||||
Port 39517
|
||||
|
||||
$ sudo service ssh restart
|
||||
```
|
||||
|
||||
#### Ajouter la clé ssh:
|
||||
|
||||
```bash
|
||||
bruno@silverbook:~/.ssh$ ssh pi@framboise.local 'mkdir -p ~/.ssh; chmod 0700 ~/.ssh; echo ' $(< ~/.ssh/id_ed25519.pub) ' >> ~/.ssh/authorized_keys ; chmod 0600 ~/.ssh/authorized_keys'
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Installer Samba:
|
||||
|
||||
Installer et créer un répertoire partagé:
|
||||
@@ -62,7 +155,13 @@ $ sudo chown -hR pi:pi /home/pi/share
|
||||
$ sudo chmod 777 /home/pi/share
|
||||
```
|
||||
|
||||
Editer le fichier smb.conf:
|
||||
#### Sauvegarder le fichier de configuration
|
||||
|
||||
```bash
|
||||
$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old
|
||||
```
|
||||
|
||||
#### Editer le fichier smb.conf:
|
||||
|
||||
```bash
|
||||
$ sudo nano /etc/samba/smb.conf
|
||||
@@ -75,6 +174,9 @@ wins support = yes
|
||||
####### Authentication #######
|
||||
security = user
|
||||
|
||||
[homes]
|
||||
read only = no
|
||||
|
||||
[Share]
|
||||
comment = Partage Samba sur Raspberry
|
||||
path=/home/pi/share
|
||||
@@ -86,12 +188,116 @@ directory mask=0777
|
||||
public=no
|
||||
```
|
||||
|
||||
Créer un utilisateur Samba:
|
||||
#### Créer un utilisateur Samba:
|
||||
|
||||
```bash
|
||||
$ sudo smbpasswd –a pi
|
||||
$ sudo smbpasswd -a pi
|
||||
New SMB password:
|
||||
Retype new SMB password:
|
||||
Added user pi.
|
||||
```
|
||||
|
||||
#### Tester la config Samba:
|
||||
|
||||
```bash
|
||||
$ testparm
|
||||
Load smb config files from /etc/samba/smb.conf
|
||||
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
|
||||
WARNING: The "syslog" option is deprecated
|
||||
Processing section "[homes]"
|
||||
Processing section "[printers]"
|
||||
Processing section "[print$]"
|
||||
Processing section "[Share]"
|
||||
Loaded services file OK.
|
||||
Server role: ROLE_STANDALONE
|
||||
|
||||
Press enter to see a dump of your service definitions
|
||||
|
||||
# Global parameters
|
||||
[global]
|
||||
log file = /var/log/samba/log.%m
|
||||
max log size = 1000
|
||||
syslog = 0
|
||||
panic action = /usr/share/samba/panic-action %d
|
||||
usershare allow guests = Yes
|
||||
map to guest = Bad User
|
||||
obey pam restrictions = Yes
|
||||
pam password change = Yes
|
||||
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
|
||||
passwd program = /usr/bin/passwd %u
|
||||
server role = standalone server
|
||||
unix password sync = Yes
|
||||
dns proxy = No
|
||||
wins support = Yes
|
||||
idmap config * : backend = tdb
|
||||
|
||||
|
||||
[homes]
|
||||
comment = Home Directories
|
||||
browseable = No
|
||||
create mask = 0700
|
||||
directory mask = 0700
|
||||
valid users = %S
|
||||
|
||||
|
||||
[printers]
|
||||
comment = All Printers
|
||||
path = /var/spool/samba
|
||||
browseable = No
|
||||
printable = Yes
|
||||
create mask = 0700
|
||||
|
||||
|
||||
[print$]
|
||||
comment = Printer Drivers
|
||||
path = /var/lib/samba/printers
|
||||
|
||||
|
||||
[Share]
|
||||
comment = Partage Samba sur Raspberry
|
||||
path = /home/pi/share
|
||||
create mask = 0777
|
||||
directory mask = 0777
|
||||
read only = No
|
||||
|
||||
```
|
||||
|
||||
**Messages d'erreurs:**
|
||||
|
||||
`rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)`
|
||||
|
||||
```bash
|
||||
# Global files limit:
|
||||
|
||||
$ cat /proc/sys/fs/file-max
|
||||
88603
|
||||
|
||||
# Local files limit:
|
||||
|
||||
$ ulimit -Hn
|
||||
1048576
|
||||
$ ulimit -Sn
|
||||
1024
|
||||
|
||||
# Modifier temporairement les limites:
|
||||
|
||||
ulimit -Hn n
|
||||
ulimit -Sn m
|
||||
|
||||
# Modifier les limites:
|
||||
|
||||
Editer /etc/security/limits.conf et ajouter:
|
||||
samba soft nofile 16384
|
||||
samba hard nofile 32768
|
||||
```
|
||||
|
||||
`WARNING: The "syslog" option is deprecated`
|
||||
commenter la ligne syslog: `#syslog = 0`
|
||||
|
||||
#### Redémarrer Samba:
|
||||
|
||||
```bash
|
||||
$ sudo /etc/init.d/samba restart
|
||||
```
|
||||
|
||||
|
||||
|
||||
163
docs/Raspberry/send_mail.md
Normal file
163
docs/Raspberry/send_mail.md
Normal file
@@ -0,0 +1,163 @@
|
||||
#### Configurer un compte Gmail:
|
||||
|
||||
Sécurité -> Allow less secure apps
|
||||
|
||||
#### Installer SSMTP
|
||||
|
||||
```bash
|
||||
$ sudo apt-get install ssmtp
|
||||
Installer mpack (pour envoyer des PJ)
|
||||
$ sudo apt-get install mpack
|
||||
```
|
||||
|
||||
#### Configurer SSMTP
|
||||
|
||||
https://wiki.archlinux.org/index.php/SSMTP
|
||||
|
||||
```bash
|
||||
$ sudo nano /etc/ssmtp/ssmtp.conf
|
||||
```
|
||||
|
||||
et ajouter ces lignes:
|
||||
|
||||
```bash
|
||||
root=username@gmail.com
|
||||
mailhub=smtp.gmail.com:465
|
||||
rewriteDomain=gmail.com
|
||||
AuthUser=username
|
||||
AuthPass=password
|
||||
FromLineOverride=YES
|
||||
UseTLS=YES
|
||||
```
|
||||
|
||||
```bash
|
||||
$ sudo nano /etc/ssmtp/revaliases
|
||||
```
|
||||
|
||||
#### Vérifier le log:
|
||||
|
||||
```bash
|
||||
$ tail -f /var/log/mail.log
|
||||
$ tail -f /var/log/syslog
|
||||
```
|
||||
|
||||
#### Sécuriser ssmtp.conf
|
||||
|
||||
Ajouter le groupe ssmtp
|
||||
|
||||
```bash
|
||||
$ sudo groupadd ssmtp
|
||||
```
|
||||
|
||||
Donner le groupe ssmtp au fichier ssmtp.conf
|
||||
|
||||
```bash
|
||||
$ sudo chown :ssmtp /etc/ssmtp/ssmtp.conf
|
||||
```
|
||||
|
||||
Donner le groupe ssmtp au fichier à l'exécutable ssmtp
|
||||
|
||||
```bash
|
||||
$ sudo chown :ssmtp /usr/sbin/ssmtp
|
||||
```
|
||||
|
||||
S'assurer que juste root et le group ssmtp ont accès au fichier ssmtp.conf
|
||||
|
||||
```bash
|
||||
$ sudo chmod 640 /etc/ssmtp/ssmtp.conf
|
||||
```
|
||||
|
||||
Mettre le bit SGID à l'exécutable ssmtp
|
||||
|
||||
```bash
|
||||
$ sudo chmod g+s /usr/sbin/ssmtp
|
||||
```
|
||||
|
||||
Envoyer un email:
|
||||
|
||||
```bash
|
||||
$ echo 'Test text' | mail -s 'Test Mail' username@domaine.com
|
||||
$ ssmtp username@domaine.com
|
||||
subject: ceci est un test !
|
||||
hello world !
|
||||
<CTRL>+D pour envoyer
|
||||
```
|
||||
|
||||
```bash
|
||||
$ echo "Hello world email body" | mail -s "Test Subject" username@gmail.com
|
||||
```
|
||||
|
||||
Envoyer un fichier:
|
||||
|
||||
```bash
|
||||
$ mpack -s 'Test image en PJ' o.jpg username@domaine.com
|
||||
```
|
||||
|
||||
Envoyer un mail et une PJ:
|
||||
|
||||
```bash
|
||||
$ nano mail_template.txt
|
||||
Bonjour,
|
||||
|
||||
Ci-joint la photo demandée.
|
||||
|
||||
Cordialement.
|
||||
|
||||
$ mpack -s 'Test image en PJ' -d mail_template.txt image.jpg username@gmail.com
|
||||
```
|
||||
|
||||
Changer le from name = 'root'
|
||||
|
||||
```bash
|
||||
$ sudo nano /etc/passwd
|
||||
# Remplacer
|
||||
root:x:0:0:root:/root:/bin/bash
|
||||
# par
|
||||
root:x:0:0:RPi3:/root:/bin/bash
|
||||
```
|
||||
|
||||
|
||||
Envoyer un message avec PHP:
|
||||
|
||||
1. Editer le fichier de conf de PHP
|
||||
|
||||
```
|
||||
$ nano /etc/php/apache/php.ini
|
||||
```
|
||||
|
||||
2. Vérifier la ligne sendmail_path
|
||||
|
||||
```
|
||||
sendmail_path = /usr/sbin/sendmail -t -i
|
||||
```
|
||||
|
||||
3. Créer un fichier mailtest.php
|
||||
```php
|
||||
<?php
|
||||
$to = “targetperson@example.com”;
|
||||
$subject = “PHP Test mail”;
|
||||
$message = “This is a test email”;
|
||||
$from = “you@your.domain”;
|
||||
$headers = “From:” . $from;
|
||||
mail($to,$subject,$message,$headers);
|
||||
echo “Mail Sent.”;
|
||||
?>
|
||||
```
|
||||
|
||||
4. puis
|
||||
|
||||
```bash
|
||||
$ php mailtest.php
|
||||
```
|
||||
|
||||
|
||||
|
||||
Envoyer un message avec Python:
|
||||
|
||||
```bash
|
||||
import smtplib
|
||||
```
|
||||
|
||||
|
||||
|
||||
https://myhydropi.com/send-email-with-a-raspberry-pi-and-python
|
||||
59
docs/Raspberry/siri_control.md
Normal file
59
docs/Raspberry/siri_control.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# SiriControl
|
||||
|
||||
|
||||
|
||||
https://github.com/theraspberryguy/SiriControl-System
|
||||
https://medium.com/@thesanjeetc/want-to-control-something-with-siri-heres-how-bae98aceb586
|
||||
|
||||
|
||||
|
||||
#### Configurer un compte gmail
|
||||
|
||||
- IMAP
|
||||
- Votre compte Google -> Sécurité -> Accès moins sécurisé des applications
|
||||
- Ajouter le compte gmail à Notes (iOS)
|
||||
|
||||
#### Installer SiriControl:
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/theraspberryguy/SiriControl-System.git
|
||||
```
|
||||
|
||||
Ouvrir siricontrol.py et renseigner les username et password du compte gmail.
|
||||
|
||||
Rendre le script exécutable (sinon 'compte IMAP inexistant')
|
||||
|
||||
```bash
|
||||
$ chmod +x siricontrol.py
|
||||
```
|
||||
|
||||
#### Créer un module:
|
||||
|
||||
```bash
|
||||
$ nano photo.py
|
||||
|
||||
# You can import any required modules here
|
||||
# This can be anything you want
|
||||
moduleName = "photo"
|
||||
|
||||
# All of the words must be heard in order for this module to be executed
|
||||
commandWords = ["prendre","photo"]
|
||||
|
||||
def execute(command):
|
||||
# Write anything you want to be executed when the commandWords are heard
|
||||
# The 'command' parameter is the command you speak
|
||||
|
||||
scrot
|
||||
return
|
||||
|
||||
|
||||
```
|
||||
|
||||
#### Utilisation:
|
||||
|
||||
Dis Siris
|
||||
|
||||
> Oui
|
||||
|
||||
Note **Prendre** une **photo**
|
||||
|
||||
42
docs/Raspberry/tools.md
Normal file
42
docs/Raspberry/tools.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# Tools
|
||||
|
||||
|
||||
|
||||
### Prendre une copie d'écran
|
||||
|
||||
- Appuyer sur la touch ImprimEcran ouvre **Scrot**
|
||||
|
||||
- Installer GNOME Screenshot
|
||||
|
||||
```bash
|
||||
sudo apt update && sudo apt upgrade
|
||||
sudo apt install gnome-screenshot
|
||||
```
|
||||
|
||||
- Depuis le terminal, taper la commande `scrot`
|
||||
|
||||
```bash
|
||||
pi@framboise:~ $ scrot
|
||||
pi@framboise:~ $ ls
|
||||
2019-01-19-070157_656x416_scrot.png Git Public Videos
|
||||
Desktop Music python_games
|
||||
Documents oldconffiles share
|
||||
Downloads 2019-01-19-070157_656x416_scrot.jpg
|
||||
|
||||
# avec un délai de 4s (le temps de masquer le terminal ou de dérouler un menu)
|
||||
pi@framboise:~ $ scrot -d 4
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
### Connaitre le modèle de RPi
|
||||
|
||||
```bash
|
||||
cat /proc/cpuinfo
|
||||
|
||||
Hardware : BCM2708
|
||||
Revision : 0003
|
||||
```
|
||||
|
||||
Voir le modèle correspondant à la révision [ici](https://elinux.org/RPi_HardwareHistory).
|
||||
Reference in New Issue
Block a user