Live test

This commit is contained in:
tilman
2017-01-22 13:59:14 +01:00
parent bac8fb003a
commit 6f823e94a2
3 changed files with 56 additions and 30 deletions
BIN
View File
Binary file not shown.
+56 -30
View File
@@ -245,7 +245,7 @@ h2, h3 {
<h3 id="system">System Installation</h3> <h3 id="system">System Installation</h3>
<p> <p>
Before installing anything additionally, <a href="https://www.raspberrypi.org/downloads/raspbian/">Raspbian Lite</a> has to be <a href="https://www.raspberrypi.org/documentation/installation/installing-images/README.md">installed on the SD card</a>. From there on, it's all on the command line. Before installing anything additionally, <a href="https://www.raspberrypi.org/downloads/raspbian/">Raspbian Lite</a> has to be <a href="https://www.raspberrypi.org/documentation/installation/installing-images/README.md">installed on the SD card</a>. When the SD card is ready, it is necessary to at least once connect a monitor and a keyboard to the RasPi for the initial setup since SSH is disabled by default. As soon as wi-fi is configured, we can remove all the cables and continue to work remotely over ssh.
</p> </p>
<p> <p>
@@ -253,9 +253,9 @@ h2, h3 {
</p> </p>
<pre class="pre-scrollable"> <pre class="pre-scrollable">
# Make sure that the latest versions are installed # Make sure that the latest versions are installed (this might take some time) (<a href="https://www.raspberrypi.org/documentation/raspbian/updating.md">https://www.raspberrypi.org/documentation/raspbian/updating.md</a>)
sudo apt update sudo apt update
sudo apt upgrade sudo apt dist-upgrade
# Basic setup: password, keyboard layout, wi-fi channels, hostname, ssh # Basic setup: password, keyboard layout, wi-fi channels, hostname, ssh
sudo raspi-config sudo raspi-config
@@ -269,6 +269,9 @@ lsusb
# 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>) # 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
# If not done yet, plug in wi-fi adapter and reboot
sudo reboot
# Scan networks and add wi-fi network to configuration # 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
@@ -277,11 +280,25 @@ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
# psk="Your_wifi_password" # psk="Your_wifi_password"
# } # }
# Restart wi-fi
sudo ifdown wlan0 sudo ifdown wlan0
sudo ifup wlan0 sudo ifup wlan0
# 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>) # Check if wi-fi is connected
ifconfig wlan0
# Turn off
sudo shutdown -h now
</pre>
<p>
From here on you can connect via SSH over wi-fi. Unplug monitor, keyboard and the ethernet cable. It might also be helpful to configure a static IP for the wi-fi adapter in your router, before continuing. Then restart the RasPi, <a href="https://www.raspberrypi.org/documentation/remote-access/ssh/">connect via SSH</a> from a different computer and go on with the setup procedure.
</p>
<pre>
# Now that remote connection is available, 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
# # disable HDMI
# /usr/bin/tvservice -o # /usr/bin/tvservice -o
# Disable the ACT LED # Disable the ACT LED
@@ -292,14 +309,15 @@ sudo nano /boot/config.txt
# Configure NTP # Configure NTP
sudo apt install ntp sudo apt install ntp
sudo nano /etc/ntp.conf sudo nano /etc/ntp.conf
# add time server to /etc/ntp.conf # add time server to /etc/ntp.conf (line 16)
# server de.pool.ntp.org # server de.pool.ntp.org
sudo /etc/init.d/ntp restart sudo /etc/init.d/ntp restart
date date
sudo reboot # Turn off
sudo shutdown -h now
</pre> </pre>
<p> <p>
After the basic installation is done, it's time to bring everything together in the case. All components are connected but we'll wait using the glue gun until everything is tested thoroughly. Especially the webcam might need some in-place live adjustment. The easiest way to do this is by connecting the webcam to another computer while it is already in the case (see bash history below). After the basic installation is done, it's time to bring everything together in the case. All components are connected but we'll wait using the glue gun until everything is tested thoroughly. Especially the webcam might need some in-place live adjustment. The easiest way to do this is by connecting the webcam to another computer while it is already in the case (see bash history below).
</p> </p>
@@ -312,15 +330,24 @@ 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
# As a first test turn the LED on and off
python3 ~/test/lighton.py
python3 ~/test/lightoff.py
# We can also test the buttons and the sensor (press buttons, hold a card on the sensor to see if it switches from 'LOW' to 'HIGH') - stop with Ctrl-C
python3 ~/test/buttons.py
python3 ~/test/sensor.py
# 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>) # 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
dmesg dmesg
# Plug in headphones or JBL connector cable, start mocp and test audio output via the PHAT DAC # Plug in headphones or JBL connector cable, start mocp and test audio output via the PHAT DAC (Don't forget to turn on the speaker!)
mocp -S mocp -S
mocp -l ~/piplayer2/sounds/scanning.mp3 mocp -l ~/sounds/scanning.mp3
mocp -x mocp -x
# 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>) # 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>)
@@ -329,17 +356,18 @@ lsusb -s 001:006 -v | egrep "Width|Height"
# Webcam test: turn on the LED, take a photo and turn the LED off # Webcam test: turn on the LED, take a photo and turn the LED off
# (The focus of the webcam should be adjusted before on another computer with a live picture) # (The focus of the webcam should be adjusted before on another computer with a live picture)
python3 ~/piplayer2/test/lighton.py python3 ~/test/lighton.py
sudo fswebcam -r 320x240 -d /dev/video0 -v ~/webcam-test.jpg sudo fswebcam -r 320x240 -d /dev/video0 -v ~/webcam-test.jpg
python3 ~/piplayer2/test/lightoff.py python3 ~/test/lightoff.py
# Copy ~/webcam-test.jpg to another computer and have a look at it # Copy ~/webcam-test.jpg to another computer and have a look at it
# If needed, adjust the webcam and repeat the step until the QR code recognition is reliable # If needed, adjust the webcam and repeat the step until the QR code recognition is reliable
# QR-Test: Hold a QR code card above the webcam then turn on the LED, decode the QR code and turn the LED off # QR-Test: Hold a QR code card above the webcam then turn on the LED, decode the QR code and turn the LED off
python3 ~/piplayer2/test/lighton.py # (Stop scanning for codes with Ctrl-C)
python3 ~/test/lighton.py
zbarcam --quiet --nodisplay --raw -Sdisable -Sqrcode.enable --prescale=320x240 /dev/video0 zbarcam --quiet --nodisplay --raw -Sdisable -Sqrcode.enable --prescale=320x240 /dev/video0
python3 ~/piplayer2/test/lightoff.py python3 ~/test/lightoff.py
# Enable lirc in /boot/config.txt and add parameters # Enable lirc in /boot/config.txt and add parameters
sudo nano /boot/config.txt sudo nano /boot/config.txt
@@ -398,7 +426,7 @@ sudo reboot
ps -ef | grep python ps -ef | grep python
# Watch the log output while testing with QR code cards # Watch the log output while testing with QR code cards
tail -f /home/pi/piplayer2/piplayer2.log tail -f /home/pi/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>) # 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>)
@@ -428,7 +456,7 @@ sudo nano /etc/rc.local
# # make /tmp on RAM disk writable # # make /tmp on RAM disk writable
# chmod 777 /tmp # chmod 777 /tmp
# #
# # disable hdmi # # disable HDMI
# /usr/bin/tvservice -o # /usr/bin/tvservice -o
# #
# # start piplayer # # start piplayer
@@ -440,11 +468,10 @@ sudo reboot
</pre> </pre>
<p> <p>
We can make the filesystem writeable again for maintenance by remounting it like this: We can make the filesystem writeable again (until reboot) for maintenance by remounting it like this:
</p> </p>
<pre> <pre>
# 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> </pre>
@@ -454,24 +481,23 @@ sudo mount -o rw,remount /boot
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: 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>
<p>
HIER WEITER: Test-MP3 zu Template und Repository hinzufügen
</p>
<pre> <pre>
# make SD writable
sudo mount -o rw,remount /
sudo mount -o rw,remount /boot
# create mount point
mkdir /home/pi/share
# 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
# via /etc/fstab HAT NICHT FUNKTIONIERT
sudo nano /etc/fstab
# tmpfs /media/share tmpfs defaults,size=10% 0 0
# //192.168.1.125/hidrive/Media /media/share cifs guest,ro
</pre> </pre>
<p>
HIER WEITER:
- Test-MP3 zu Template und Repository hinzufügen
</p>
<h3 id="python">Python Script</h3> <h3 id="python">Python Script</h3>

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB