====== Raspbian Lite + Witty ====== ===== Préparation ===== Pour installer Raspbian lite sur la carte µSD, nous allons utiliser un logiciel prêt à l'emploi fonctionnant sous windows, mac et linux --- source: https://raspberry-pi.fr/creer-carte-sd-windows-mac-linux-raspberry-pi-imager/ Pour Windows => https://downloads.raspberrypi.org/imager/imager_latest.exe Pour Linux => https://downloads.raspberrypi.org/imager/imager_latest_amd64.deb Après avoir lancer l'appli, cliquez sur "Choose OS" puis "Raspberry Pi OS (other)" puis "Raspberry Pi OS Lite (32-bit)" Ensuite, cliquez sur "Choose SD Card" puis sur votre carte SD dans la liste. Enfin cliquez sur "Write" Dans mon cas, j'ai eu une erreur disant que la carte sd était défectueuse. J'ai lancé un formatage de la carte, ensuite l'installation s'est faite sans problème. Sinon, utilisez la méthode en ligne de commande $ sudo dd bs=1M if=2021-01-11-raspios-buster-armhf-lite.img of=/dev/sdb status=progress conv=fsync 1858076672 bytes (1,9 GB, 1,7 GiB) copied, 162 s, 11,5 MB/s 1776+0 enregistrements lus 1776+0 enregistrements écrits 1862270976 bytes (1,9 GB, 1,7 GiB) copied, 193,276 s, 9,6 MB/s ===== Pré-configuration ===== Avant d'insérer la µSD dans le raspberry, on va pouvoir activer ssh et configurer le wifi afin d'éviter de brancher un écran/clavier/souris --- doc: https://raspberry-pi.fr/raspberry-pi-sans-ecran-sans-clavier/ Créer un fichier **ssh** vide dans la partition boot {{ :raspberry:create_ssh.png?nolink |}} Et pour le wifi, créer un fichier **wpa_supplicant.conf** dans la partition boot avec le contenu suivant country=fr update_config=1 ctrl_interface=/var/run/wpa_supplicant network={ scan_ssid=1 ssid="MaBoxInternet" psk="ClefSecurite" } {{ :raspberry:create_wifi.png?nolink |}} ===== Connexion au raspberry en ssh ===== Sous Windows, j'utilise **Git-Bash** qui permet d'avoir un terminal propre ( https://git-scm.com/download/windows ) Retrouvez l'adresse ip local de votre raspberry en consultant votre box ou votre routeur wifi puis connectez vous avec l'utilisateur **pi** et le mot de passe par défaut **raspberry** $ ssh pi@192.168.0.39 The authenticity of host '192.168.0.39 (192.168.0.39)' can't be established. ECDSA key fingerprint is SHA256:beQ1vm0+YVZwQi2hnXZvESxk7UJ7iQaTKkjiz/0KB6o. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.0.39' (ECDSA) to the list of known hosts. pi@192.168.0.39's password: Linux raspberrypi 5.4.83-v7+ #1379 SMP Mon Dec 14 13:08:57 GMT 2020 armv7l The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. SSH is enabled and the default password for the 'pi' user has not been changed. This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password. Un message invite à vivement changer le mot de passe par défaut avec la commande **passwd**. Avec la commande suivante, on constate bien que tout l'espace de la carte sd a été pris en compte (15G) pi@raspberrypi:~ $ df -h Filesystem Size Used Avail Use% Mounted on /dev/root 15G 1.3G 13G 9% / devtmpfs 183M 0 183M 0% /dev tmpfs 215M 0 215M 0% /dev/shm tmpfs 215M 5.8M 210M 3% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 215M 0 215M 0% /sys/fs/cgroup /dev/mmcblk0p1 253M 46M 207M 18% /boot tmpfs 43M 0 43M 0% /run/user/1000 Si la date n'est pas à jour, configurez le timezone pi@raspberrypi:~ $ date Sun 17 Oct 10:18:21 BST 2021 pi@raspberrypi:~ $ sudo timedatectl set-timezone Europe/Paris pi@raspberrypi:~ $ date Sun 17 Oct 11:19:37 CEST 2021 ===== Installation du Witty ===== Avant d'installer la carte Witty, installez d'abord le soft. --- Doc : http://www.uugear.com/doc/WittyPi3Rev2_UserManual.pdf ==== Installation du soft ==== pi@raspberrypi~ $ wget http://www.uugear.com/repo/WittyPi3/install.sh pi@raspberrypi~ $ sudo sh install.sh ================================================================================ | | | Witty Pi Software Installation Script | | | ================================================================================ >>> Enable I2C File raspi-blacklist.conf does not exist, skip this step. >>> Install i2c-tools ... >>> All done. Please reboot your Pi to have UWI server running :-) With default settings, the web interface URL is http://raspberrypi:8000/ >>> All done. Please reboot your Pi :-) Arrêter le raspberry sudo halt Installez maintenant la carte Witty. Attention, l'alimentation se fait directement sur la carte Witty en **USB Type C** Par défaut le raspberry n'est pas alimenté, il faut appuyer sur le bouton du witty pour l'alimenter. Le soft se trouve dans **wittypi/wittyPi.sh** pi@raspberrypi:~ $ cd wittypi/ pi@raspberrypi:~/wittypi $ ./wittyPi.sh ================================================================================ | | | Witty Pi - Realtime Clock + Power Management for Raspberry Pi | | | | < Version 3.13 > by UUGear s.r.o. | | | ================================================================================ >>> Current temperature: 28.75°C / 83.75°F >>> Your system time is: Fri 19 Feb 2021 20:42:33 GMT >>> Your RTC time is: Fri 19 Feb 2021 20:42:34 GMT >>> Vout=4.97V, Iout=0.21A Now you can: 1. Write system time to RTC 2. Write RTC time to system 3. Synchronize time 4. Schedule next shutdown 5. Schedule next startup 6. Choose schedule script 7. Set low voltage threshold 8. Set recovery voltage threshold 9. View/change other settings... 10. Reset data... 11. Exit What do you want to do? (1~11) 11 On peut y voir la température de la carte, le voltage, l'intensité, l'heure du système et l'heure de la carte. Vous pouvez aussi accéder à une interface web => http://_ip.de.votre.raspberry_:8000 mais le code essaie de se connecter sur une websocket avec comme url ws://raspberrypi:8000 De ce fait, il ne trouve pas car ce hostname ne correspond à rien.\\ Rajouter dans votre fichier /etc/hosts la ligne ip.de.votre.raspberry raspberrypi et ça devrait marcher L'interface permet de gérer les broches du GPIO et de gérer votre carte comme le fait le script wittyPi.sh ===== Désactiver des périphériques ===== ==== Le bluetooth ==== Ajouter dans le fichier **/boot/config.txt** dtoverlay=disable-bt Désactivez les services suivant sudo systemctl disable hciuart.service sudo systemctl disable bluetooth.service ==== Vidéo ==== Configurez le minimum de RAM pour la carte graphique sudo raspi-config Allez dans **Advanced Options** -> **Memory Split** et mettez la valeur minimum de 16. Désactivez le HDMI. Exécutez cette commande au démarrage. /usr/bin/tvservice -o ==== Audio ==== Commenter la ligne suivante dans le fichier /boot/config.txt # Enable audio (loads snd_bcm2835) #dtparam=audio=on