Ceci est une ancienne révision du document !
−Table des matières
Raspberry PI
Arduino vs. Raspberry Pi
Le faux débat
- Pas de choix magique
- Choisir en fonction de ses besoins et contraintes
- Consommation électrique : ~0.5W pour Arduino, ~3.5W pour Raspberry Pi
- Rapidité de mise en route : quasi instantanée pour l'Arduino, ~30s pour Raspberry Pi
- Connexion au web plus simple avec Raspberry Pi
- Avez-vous vraiment besoin d'un OS? D'un GPU? …
- …
- Donc pas les même usages. D'ailleurs j'ai rangé le Raspberry PI dans Informatique et l'Arduino dans Électronique
La Suite
- R-Pi Hub, http://elinux.org/RaspberryPiBoard, le Wiki de la communauté www.raspberrypi.org
- http://www.raspberrypi-spy.co.uk Raspberry Pi resources, tutorials, help and downloads
- RPi+Debian = http://www.raspbian.org
- Tuning
- WebIOPi a REST framework and webapp to control the Raspberry Pi and its GPIO through the web
- Les prez de Laurent HUET - 3615 Cloud - Minitel on the cloud - Domotique “Low Cost” façon DIY - Quelle JVM pour votre carte ARM - Vive le Hard !
Pour une plate-forme de gestion de données récoltées avec votre RaspberryPI, voir /internet_of_things
voir aussi /informatique/sms pour un sms gateway.
Web security everywhere - Secure your Internet, control your data, fight censorship. Bring your secure and autonomous all in one security device everywhere.
Text to speech (TTS) :
- Port of Android Pico TTS to the Raspberry Pi DougGore/picopi
Les PIs de la maison
PI1
PI2
PI3
PI4
CPU x 4 :
model name : ARMv7 Processor rev 5 (v7l) BogoMIPS : 57.60 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xc07 CPU revision : 5
Mémoire :
MemTotal: 948060 kB
Tips & Tricks
une bonne adresse pour les problèmes électriques, update de firmware et autres trucs particuliers à Raspberry PI:
Maintenant au 1er boot l'outil Raspi-config permet de régler qlqs trucs bien utiles.
Le système sur la carte SD
umount /dev/mmcblk0XX sudo dd bs=1M if=debian6-19-04-2012/debian6-19-04-2012.img of=/dev/mmcblk0
Utiliser toute la SD Card
- Le système debian propose maintenant au 1er boot de redimensionner la partition sur toute la SD-Card.
- ou bien utiliser GParted.
Backup the sd card:
$ sudo dd if=/dev/sdx of=/path/to/image bs=1M
Attention, le fichier aura la taille du support même si les partitions ne le remplissent pas. Voir How to shrink USB clone DD file image output pour créer une image de la taille de partitions.
Alléger le système
Pour un usage en console seulement
$ sudo apt-get remove --purge libx11-6 smbclient samba-common plymouth xserver-xorg-input-synaptics xserver-xorg xserver-xorg-core x11-xkb-utils xdg-utils lxde-core lxde lxappearance lxde-common lxde-icon-theme lxpanel lxpolkit lxrandr lxterminal lxtask lxsession-edit lxshortcut lxsession lxmenu-data openbox xfonts-utils ttf-dejavu-core raspberrypi-artwork qjackctl omxplayer zenity* xpdf xarchiver smartsim timidity netsurf-gtk squeak* scratch supercollider* libopencv* python-pygame $ sudo apt-get autoremove --purge
Après ça :
Filesystem Size Used Avail Use% Mounted on /dev/root 3.7G 889M 2.7G 25% / ...
remove graphics IHM and other:
$ sudo apt-get purge python-pygame scratch omxplayer transmission* libgfortran3 lxde* xarchiver libcairo2 openbox* $ sudo apt-get autoremove
Shrink Debian by removing all graphical features to turn it into a headless server: Debian Headless
le Clavier AZERTY
- Le système debian propose maintenant au 1er boot de sélectionner le type de clavier.
$ sudo dpkg-reconfigure keyboard-configuration
OU
Editer
sudo vi /etc/default/keyboard
remplacer
XKBLAYOUT="en"
par
XKBLAYOUT="fr"
et
sudo reboot
source: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=9148&p=106974
Slow keyboard mapping (boot)
$ sudo setupcon
Heure locale
- L'outil raspi-config permet maintenant de sélectionner la timezone.
Pour configurer la timezone:
$ sudo dpkg-reconfigure tzdata
activer ssh
$ sudo insserv ssh
disable ipv6
Pour économiser de la mémoire, ne pas charger le module ipv6:
- éditer /etc/modprobe.d/blacklist.conf
- ajouter la ligne:
blacklist ipv6
update firmware
Avec l'outil rpi-update
wifi access point (AP)
avec hostadp & dnsmasq
Le problème est la perte de l'ip sur wlan0. La solution trouvée:
dans /etc/default/ifplugd remplacer
INTERFACES="auto" HOTPLUG_INTERFACES="all"
par
INTERFACES="eth0" HOTPLUG_INTERFACES="eth0"
Pour ensuite router les paquets de wlan0 vers eth0 avec iptables
# Les requêtes du réseau wifi sont forwardées vers l’extérieur via une règle “iptables” iptables -A FORWARD -i wlan0 -s 192.168.5.0/255.255.255.0 -o eth0 -j ACCEPT # pour que les requêtes du nouveau réseau ne sorte pas avec des IPs privées, elles sont masqueradées iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Mettre ses lignes dans un fichier, qui est lancé depuis la config de wlan0 dans /etc/network/interfaces
Récap des fichiers
/etc/network/interfaces
auto lo iface lo inet loopback iface eth0 inet dhcp auto wlan0 iface wlan0 inet static address 192.168.5.1 netmask 255.255.255.0 network 192.168.5.0 gateway 192.168.5.1 post-up /etc/network/if-up.d/router.sh
/etc/network/if-up.d/router.sh
# Les requêtes du réseau wifi sont forwardées vers l’extérieur via une règle “iptables” iptables -A FORWARD -i wlan0 -s 192.168.5.0/255.255.255.0 -o eth0 -j ACCEPT # pour que les requêtes du nouveau réseau ne sorte pas avec des IPs privées, elles sont masqueradées iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/etc/default/ifplugd
INTERFACES="eth0" HOTPLUG_INTERFACES="eth0" ARGS="-q -f -u0 -d10 -w -I" SUSPEND_ACTION="stop"
/etc/hostapd/hostapd.conf
interface=wlan0 ssid=bobox hw_mode=g channel=6 auth_algs=1 wmm_enabled=0
storage performances
Test write performance on sd-card PNY 16G class 10 :
pi@raspberrypi ~ $ sync; time ( dd if=/dev/zero of=testing bs=16k count=10000; sync) ... 163840000 bytes (164 MB) copied, 14.6962 s, 11.1 MB/s ...
Pour améliorer (économiser) les accès à la SDCard: voir noatime_nodiratime
Le Wifi
Ralink 802.11 n WLAN
$ lsusb | grep Ralink Bus 003 Device 005: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
$ tail -f /var/log/syslog ... usb 3-3: new high-speed USB device number 3 using xhci_hcd usb 3-3: New USB device found, idVendor=148f, idProduct=5370 usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 3-3: Product: 802.11 n WLAN usb 3-3: Manufacturer: Ralink usb 3-3: SerialNumber: 1.0 ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 5390, rev 0502 detected ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 5370 detected ieee80211 phy1: Selected rate control algorithm 'minstrel_ht' usbcore: registered new interface driver rt2800usb <info> rfkill2: found WiFi radio killswitch (at /sys/devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3:1.0/ieee80211/phy1/rfkill2) (driver rt2800usb) SCPlugin-Ifupdown: devices added (path: /sys/devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3:1.0/net/wlan1, iface: wlan1) SCPlugin-Ifupdown: device added (path: /sys/devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3:1.0/net/wlan1, iface: wlan1): no ifupdown configuration found. <info> (wlan1): using nl80211 for WiFi device control <info> (wlan1): driver supports Access Point (AP) mode <info> (wlan1): new 802.11 WiFi device (driver: 'rt2800usb' ifindex: 5) <info> (wlan1): exported as /org/freedesktop/NetworkManager/Devices/2 <info> (wlan1): device state change: unmanaged -> unavailable (reason 'managed') [10 20 2] <info> (wlan1): bringing up device. ieee80211 phy1: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin' ieee80211 phy1: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.29 <info> (wlan1): preparing device. <info> (wlan1): deactivating device (reason 'managed') [2] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready <info> (wlan1) supports 4 scan SSIDs <info> (wlan1): supplicant interface state: starting -> ready <info> (wlan1): device state change: unavailable -> disconnected (reason 'supplicant-available') [20 30 42] <warn> Trying to remove a non-existant call id. <info> (wlan1): supplicant interface state: ready -> disconnected <info> (wlan1) supports 4 scan SSIDs message repeated 5 times: [ wlan0: CTRL-EVENT-SCAN-STARTED ] wlan1: Reject scan trigger since one is already pending wlan1: CTRL-EVENT-SCAN-STARTED <info> (wlan1): supplicant interface state: disconnected -> inactive <warn> Couldn't find support for device at '/sys/devices/pci0000:00/0000:00:14.0/usb3/3-3': not supported by any plugin wlan1: CTRL-EVENT-SCAN-STARTED ...
D-Link DWL G122
update 2012-11-06 Avec la nouvelle version, le dongle est automatiquement reconnu. Pour la config, établie selon le trhead http://www.raspberrypi.org/phpBB3/viewtopic.php?t=11517
$ sudo vi /etc/wpa_supplicant/wpa_supplicant.conf ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="SSID" scan_ssid=1 psk="CLEAR PASSPHRASE" id_str="home" priority=5 }
ATTENTION: toujours ajouter:
vi /etc/network/interfaces ... wireless-power off ...
Sinon le réseau ne fonctionne pas bien (problème de gestion de power avec le dongle ?)
update 2012-08-15 Sans le powermanagment ça semble aller bien mieux :
vi /etc/network/interfaces ... auto wlan0 iface wlan0 inet dhcp wpa-conf /etc/wpa.conf wireless-power off
bof, marche pas terrible, chuis passé en ethernet. Peut être un problème de porté et/ou conflit avec autres appareils wifi trop proches ?
J'ai branché un dongle usb wifi D-Link DWL G122 et hop:
$ lsmod ... rt2500usb 14480 0 rt2x00usb 6532 1 rt2500usb rt2x00lib 25780 2 rt2500usb,rt2x00usb mac80211 171628 2 rt2x00usb,rt2x00lib cfg20211 123084 2 rt2x00lib,mac80211
puis
wpa_passphrase <SSID> <PassPhrase> > /etc/wpa.conf
puis
vi /etc/network/interfaces auto lo iface lo inet loopback iface eth0 inet dhcp auto wlan0 iface wlan0 inet dhcp wpa-conf /etc/wpa.conf
et
sudo reboot
et hop, le machin se connecte
sources: http://omer.me/2012/04/setting-up-wireless-networks-under-debian-on-raspberry-pi/, http://wiki.debian.org/WiFi#USB_Devices, http://fr.wikipedia.org/wiki/Wpa_supplicant#Commande_Unix
Netgear WG121
Problème: desktop:~# dmesg | grep p54
[ 5.974034] usb 1-3: (p54usb) cannot load firmware isl3886usb (-2)! [ 5.977369] p54usb: probe of 1-3:1.0 failed with error -2 [ 5.977416] usbcore: registered new interface driver p54usb [ 860.944607] usb 1-5: (p54usb) cannot load firmware isl3886usb (-2)! [ 860.953331] p54usb: probe of 1-5:1.0 failed with error -2
il est question de
aptitude install firmware-linux-nonfree
mais ça ne suffit pas.
Pour aller plus loin (mais je n'y suis pas aller): http://wiki.debian.org/prism54
YACY
Le moteur distribué de recherche Yacy sur Raspberry:
ejdk-8u71
Avec ejdk-8u71-linux-armv6-vfp-hflt.tar.gz
$ ./yacy/startYACY.sh -d ****************** YaCy Web Crawler/Indexer & Search Engine ******************* ... >> YaCy started as daemon process. Administration at http://localhost:8090 << Error occurred during initialization of VM Server VM is only supported on ARMv7+ VFP
$ cat /proc/cpuinfo processor : 0 model name : ARMv6-compatible processor rev 7 (v6l) BogoMIPS : 2.28 Features : half thumb fastmult vfp edsp java tls ...
ejre-1_6
ARMv6/7 Linux - Headless EABI, VFP, SoftFP ABI, Little Endian ejre-1_6_0_38-fcs-b05-linux-arm-vfp-eabi-headless-13_nov_2012.tar.gz
shared object libjli.so not found
Et pourtant:
$ sudo find / -name libjli* /usr/lib/ejre1.6.0_38/lib/arm/jli/libjli.so /usr/local/lib/libjli.so -> /usr/lib/ejre1.6.0_38/lib/arm/jli/libjli.so /usr/lib/libjli.so -> /usr/lib/ejre1.6.0_38/lib/arm/jli/libjli.so /usr/lib/jvm/java-7-openjdk-armhf/jre/lib/arm/jli/libjli.so
Plein d'essais avec ldconfig & co mais pas de résultat…
Peut être continuer l'analyse à partir de https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548729 avec l'outil readelf (package elfutils).
openjdk-7-jre
Après quelques minutes (de mise en route ?), ça ne plante suavagement:
... # Internal Error (cppInterpreter_arm.S:2625), pid=6369, tid=2264265824 # fatal error: *** Unimplemented opcode: 232 = <unknown> ...
$ ./yacy/startYACY.sh -d ****************** YaCy Web Crawler/Indexer & Search Engine ******************* **** (C) by Michael Peter Christen, usage granted under the GPL Version 2 **** **** USE AT YOUR OWN RISK! Project home and releases: http://yacy.net/ **** ** LOG of YaCy: DATA/LOG/yacy00.log (and yacy<xx>.log) ** ** STOP YaCy: execute stopYACY.sh and wait some seconds ** ** GET HELP for YaCy: see http://wiki.yacy.net and http://forum.yacy.de ** ******************************************************************************* >> YaCy started as daemon process. Administration at http://localhost:8090 << Asserts are enabled [ YaCy v1.82, build 20150121 by Michael Christen / www.yacy.net ] ------------------------------------------------------------------------------- STARTUP: Trying to load logging configuration from file /home/pi/yacy/DATA/LOG/yacy.logging I 2016/01/29 09:42:25 Domain Init local host address: 127.0.0.1 (local) [Fatal Error] :1:1: Content is not allowed in prolog. [Fatal Error] :1:1: Content is not allowed in prolog. I 2016/01/29 09:42:26 Domain Init local host address: 127.0.1.1 (local) I 2016/01/29 09:42:26 Domain Init local host address: 192.168.0.87 (local) I 2016/01/29 09:42:35 UPNP found device: Netgear CBVG834G I 2016/01/29 09:42:36 UPNP mapped mapped port 8090 to port 8090 on device Netgear CBVG834G, external IP is 89.158.149.192 I 2016/01/29 09:42:43 Word hashCache.size = 20000 I 2016/01/29 09:42:43 SWITCHBOARD Initializing Segment '/home/pi/yacy/DATA/INDEX/freeworld/SEGMENTS. I 2016/01/29 09:42:53 org.apache.solr.core.ConfigSolr Loading container configuration from /home/pi/yacy/defaults/solr/solr.xml I 2016/01/29 09:43:11 org.apache.solr.update.UpdateShardHandler Creating UpdateShardHandler HTTP client with params: socketTimeout=0&connTimeout=0&retry=false I 2016/01/29 09:43:11 org.apache.solr.logging.LogWatcher SLF4J impl is org.slf4j.impl.JDK14LoggerFactory I 2016/01/29 09:43:11 org.apache.solr.logging.LogWatcher Registering Log Listener [JUL (org.slf4j.impl.JDK14LoggerFactory)] # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (cppInterpreter_arm.S:2625), pid=6369, tid=2264265824 # fatal error: *** Unimplemented opcode: 232 = <unknown> # # JRE version: OpenJDK Runtime Environment (7.0_91-b02) (build 1.7.0_91-b02) # Java VM: OpenJDK Zero VM (24.91-b01 mixed mode linux-arm ) # Derivative: IcedTea 2.6.3 # Distribution: Raspbian GNU/Linux 8.0 (jessie), package 7u91-2.6.3-1~deb8u1+rpi1 # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # /home/pi/yacy/hs_err_pid6369.logrror] # An error report file with more information is saved as: # /home/pi/yacy/hs_err_pid6369.log # # If you would like to submit a bug report, please include # instructions on how to reproduce the bug and visit: # http://icedtea.classpath.org/bugzilla # Aborted