documentation

This commit is contained in:
2017-01-16 17:18:44 +01:00
parent 9a7b00d7a4
commit bb8d496bba
+44 -14
View File
@@ -266,10 +266,10 @@ dmesg
# Check for connected USB devices # Check for connected USB devices
lsusb lsusb
# Install wi-fi client (https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md) # Install wi-fi client (<a href="https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md">https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md</a>)
sudo apt install iw sudo apt install iw
# Scan networks and add wi-fi network to configuration (https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md) # Scan networks and add wi-fi network to configuration
sudo iwlist wlan0 scan sudo iwlist wlan0 scan
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
# network={ # network={
@@ -280,7 +280,7 @@ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
sudo ifdown wlan0 sudo ifdown wlan0
sudo ifup wlan0 sudo ifup wlan0
# disable HDMI (http://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-zero-conserve-energy) # disable HDMI (<a href="http://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-zero-conserve-energy">http://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-zero-conserve-energy</a>)
sudo nano /etc/rc.local sudo nano /etc/rc.local
# /usr/bin/tvservice -o # /usr/bin/tvservice -o
@@ -312,7 +312,7 @@ sudo reboot
# Install additional software # Install additional software
sudo apt install lirc zbar-tools mc moc fswebcam python3 python-rpi.gpio python3-rpi.gpio sudo apt install lirc zbar-tools mc moc fswebcam python3 python-rpi.gpio python3-rpi.gpio
# Configure PHAT DAC (https://learn.pimoroni.com/tutorial/phat/raspberry-pi-phat-dac-install) # Configure PHAT DAC (<a href="https://learn.pimoroni.com/tutorial/phat/raspberry-pi-phat-dac-install">https://learn.pimoroni.com/tutorial/phat/raspberry-pi-phat-dac-install</a>)
curl -sS get.pimoroni.com/phatdac | bash curl -sS get.pimoroni.com/phatdac | bash
# Check for errors # Check for errors
@@ -323,7 +323,7 @@ mocp -S
mocp -l ~/piplayer2/sounds/scanning.mp3 mocp -l ~/piplayer2/sounds/scanning.mp3
mocp -x mocp -x
# Determine the webcams USB ID and the available resolutions (http://askubuntu.com/questions/214977/how-can-i-find-out-the-supported-webcam-resolutions) # Determine the webcams USB ID and the available resolutions (<a href="http://askubuntu.com/questions/214977/how-can-i-find-out-the-supported-webcam-resolutions">http://askubuntu.com/questions/214977/how-can-i-find-out-the-supported-webcam-resolutions</a>)
lsusb lsusb
lsusb -s 001:006 -v | egrep "Width|Height" lsusb -s 001:006 -v | egrep "Width|Height"
@@ -372,11 +372,21 @@ irsend SEND_ONCE JBLIIIP KEY_MUTE
</pre> </pre>
<p> <p>
When everything works as expected, use hot glue to fix the components together. In particular I glued the webcam, the circuit board and the USB hub in place so that nothing will fall out of place anymore, even if the player is moved around roughly. When everything works as expected, everything is fixed together using hot glue. I glued the webcam, the circuit board and the USB hub in place so that nothing will fall out of place anymore, even if the player is moved around roughly.
</p>
<p>
<em>
While I really like hot glue, it's got its limits: I thought I could skip soldering the buttons to their wires by just twirling the cable ends to the contacts and then fix everything down with the hot pistol - bad idea. While being hot, the glue gets in between the wire ends and the contacts and perfectly isolates them. None of the buttons worked anymore. I had to peel the glue off the contacts with a cutter knife before soldering them properly back on again...
</em>
</p>
<p>
Now that everything is in place, we are ready for the final adjustments: Configure autostart for the player script and mount the SD card in read-only mode which makes the player robust against sudden loss of power. For that, we redirect the write access to a RAM disk.
</p> </p>
<pre> <pre>
# Autostart for piplayer2.py with log output redirection (http://raspberrypi.stackexchange.com/questions/8169/run-startup-application-as-a-specific-user) # Autostart for piplayer2.py with log output redirection (<a href="http://raspberrypi.stackexchange.com/questions/8169/run-startup-application-as-a-specific-user">http://raspberrypi.stackexchange.com/questions/8169/run-startup-application-as-a-specific-user</a>)
sudo nano /etc/rc.local sudo nano /etc/rc.local
# ... # ...
# su pi -c 'python3 /home/pi/piplayer2.py >> /home/pi/piplayer2.log 2>&1 &' # su pi -c 'python3 /home/pi/piplayer2.py >> /home/pi/piplayer2.log 2>&1 &'
@@ -384,14 +394,13 @@ sudo nano /etc/rc.local
sudo reboot sudo reboot
# check if running after restart # Check if running after restart
ps -ef | grep python ps -ef | grep python
# Tests mit QR-Code-Karten # Watch the log output while testing with QR code cards
tail -f /home/pi/piplayer2/piplayer2.log tail -f /home/pi/piplayer2/piplayer2.log
# Switch to RAM disk and set the filesystem read-only (<a href="https://www.heise.de/ct/ausgabe/2016-21-Den-Raspi-als-Bluetooth-Empfaenger-einsetzen-3330683.html">https://www.heise.de/ct/ausgabe/2016-21-Den-Raspi-als-Bluetooth-Empfaenger-einsetzen-3330683.html</a>)
# SD-Karte read-only nach https://www.heise.de/ct/ausgabe/2016-21-Den-Raspi-als-Bluetooth-Empfaenger-einsetzen-3330683.html
sudo nano /etc/fstab sudo nano /etc/fstab
# proc /proc proc defaults 0 0 # proc /proc proc defaults 0 0
@@ -411,7 +420,9 @@ sudo ln -s /tmp /var/spool
sudo ln -s /tmp /var/lock sudo ln -s /tmp /var/lock
sudo ln -s /tmp/resolv.conf /etc/resolv.conf sudo ln -s /tmp/resolv.conf /etc/resolv.conf
sudo nano /etc/rc.local (hier nochmal mit allen Ergänzungen aus den vorherigen Schritten) # make /tmp on RAM disk writable
# shown here with the former additions to rc.local - note that the log redirect for the player script is changed also
sudo nano /etc/rc.local
# ... # ...
# #
# # make /tmp on RAM disk writable # # make /tmp on RAM disk writable
@@ -421,18 +432,37 @@ sudo nano /etc/rc.local (hier nochmal mit allen Ergänzungen aus den vorherigen
# /usr/bin/tvservice -o # /usr/bin/tvservice -o
# #
# # start piplayer # # start piplayer
# su pi -c 'python3 /home/pi/piplayer2/piplayer2.py >> /tmp/piplayer2.log 2>&1 &' # su pi -c 'python3 /home/pi/piplayer2.py >> /tmp/piplayer2.log 2>&1 &'
# #
# exit 0 # exit 0
sudo reboot sudo reboot
</pre>
<p>
We can make the filesystem writeable again for maintenance by remounting it like this:
</p>
<pre>
# Dateisystem temporär beschreibbar machen # Dateisystem temporär beschreibbar machen
sudo mount -o rw,remount / sudo mount -o rw,remount /
sudo mount -o rw,remount /boot sudo mount -o rw,remount /boot
</pre>
<p>
Until now, we can only play local files from the SD card (and audiostreams from the Internet). The final step is to connect the local share that stores all of our MP3 files. How this is done depends upon the type of share you would like to use. The most common type should be a SMB share that can be connected like this:
</p>
<p>
HIER WEITER: Test-MP3 zu Template und Repository hinzufügen
</p>
<pre>
# Share einbinden # Share einbinden
sudo nano /etc/rc.local sudo nano /etc/rc.local
# sudo mount -t cifs -o user=guest,password= //192.168.1.125/media /home/pi/share # sudo mount -t cifs -o user=guest,password= //192.168.1.125/media /home/pi/share
@@ -441,7 +471,7 @@ sudo nano /etc/rc.local
sudo nano /etc/fstab sudo nano /etc/fstab
# tmpfs /media/share tmpfs defaults,size=10% 0 0 # tmpfs /media/share tmpfs defaults,size=10% 0 0
# //192.168.1.125/hidrive/Media /media/share cifs guest,ro # //192.168.1.125/hidrive/Media /media/share cifs guest,ro
</pre> </pre>
<h3 id="python">Python Script</h3> <h3 id="python">Python Script</h3>