1st version

This commit is contained in:
2019-02-13 15:57:42 +01:00
parent 0e6b416280
commit c74a579d60
+54 -39
View File
@@ -128,7 +128,7 @@ h2, h3, h4 {
</p>
<p>
The main component is now a Raspberry Pi Zero W, that can be run off the dock connector without an additional power source. I replaced the Pimoroni PHAT DAC with a dirt cheap audio module based on the same chip. The IR sensor that detects the QR cards is now a ready-made module which makes assembly easier. The buttons have been replaced by the ubiqitous standard components that come with every Arduino starter kit.
The main component is now a Raspberry Pi Zero W, that can be run off the dock connector without an additional power source. I replaced the Pimoroni PHAT DAC with a dirt cheap audio module based on the same chip. The IR sensor that detects the QR cards is now a ready-made module which makes assembly easier. The buttons have been replaced by the ubiqitous 12 mm standard components that come with every Arduino starter kit.
</p>
<h2 id="parts">Parts list</h2>
@@ -385,11 +385,11 @@ h2, h3, h4 {
<h3 id="volumio">Volumio</h3>
<p>
First of all, you will have to download the <a href="https://volumio.org/get-started/">volumio image for Raspberry Pi</a> and put it on your micro SD card. (I had some problems using <code>dd</code> which I did not follow up on. Instead, I used <a href="https://www.balena.io/etcher/">balenaEtcher</a> which worked fine.) Once you have done that, put it in and start the Raspberry Pi by powering the speaker.
First of all, you will have to download the <a href="https://volumio.org/get-started/">volumio image for Raspberry Pi</a> and put it on your micro SD card. (I use <a href="https://www.balena.io/etcher/">balenaEtcher</a> for that, which works fine.) Once you have done that, put it in and start the Raspberry Pi by powering the speaker.
</p>
<p>
The initial configuration is pretty straight forward. Connect to the WiFi network &quot;volumio&quot; that has been opened up and click through the installation assistant. Set the output to "Generic I2S DAC", activate the software mixer and connect to your network share (if any). You can also already set up plugins for streaming services like Spotify. Finally, activate SSH on the developer page <a href="http://qudio.local/dev">qudio.local/dev</a> (or whatever your hostname was) for the next steps.
The initial configuration is pretty straight forward. Connect to the WiFi network &quot;volumio&quot; that has been opened up and click through the installation assistant. Set the output to "Generic I2S DAC", activate the software mixer and connect your network share (if any). You can also already set up plugins for streaming services like Spotify. Finally, activate SSH on the developer page <a href="http://qudio.local/dev">qudio.local/dev</a> (or whatever your hostname was) for the next steps.
</p>
<p class="gallery">
@@ -411,14 +411,15 @@ h2, h3, h4 {
</p-->
<p>
Before you leave the SD card in the Raspberry Pi for good, you might want to shutdown volumio, put the card back into your computer and copy over the contents of the <a href="https://github.com/tliero/qudio/tree/master/code">/code</a> directory into /data/INTERNAL/qudio. (The data directory is only available after first start, which is why we had to complete the installation assistant first.)
Before you leave the SD card in the Raspberry Pi for good, you might want to shutdown volumio, put the card back into your computer and copy over the contents of the <a href="https://github.com/tliero/qudio/tree/master/code">/code</a> directory to /data/INTERNAL/qudio. (The data directory is only available after first start, which is why we had to complete the installation assistant first.)
</p>
<p>
Alternatively you can copy over the code via ssh, but doing it directly on the SD card might be easier. In addition to that, you can put some music directly on the SD card, if you want to. Everything in the INTERNAL directory will be available in volumio after a <a href="images/Screenshot_20190207-103442.png" data-fancybox data-caption="You can rescan your data sources under &quot;My Music&quot;.">rescan</a>.
</p>
<h3 id="python">Python Script</h3>
<h3 id="configuration">Configuration und Test</h3>
<p>
After putting the SD card back in and booting up the player you can connect to the Raspberry Pi via SSH as user volumio. The initial password is <em>volumio</em> which you might want to change with <code>passwd</code>.
@@ -432,14 +433,14 @@ h2, h3, h4 {
sudo apt-get install fswebcam zbar-tools</code></pre>
<p>
Now look for the camera (it should be available under <code>/dev/video0</code>) and make a test photo. You can check it out at <a href="http://qudio.local/backgrounds/webcam-test.jpg">http://qudio.local/backgrounds/webcam-test.jpg</a> from your computer.
Now look for the camera (it should be available under <code>/dev/video0</code>) and make a test photo. You can check it out from your computer at <a href="http://qudio.local/backgrounds/webcam-test.jpg">http://qudio.local/backgrounds/webcam-test.jpg</a> (if you set <em>Qudio</em> as hostname, like me).
</p>
<pre><code>lsusb && ls /dev/video*
fswebcam -r 320x240 -d /dev/video0 -v /data/backgrounds/webcam-test.jpg</code></pre>
<p>
Before we go on, we need Python 3.6 on the Raspberry Pi. Earlier version have a bug in socketio-client (which we need for remote control of volumio) and the current version 3.7 has a <a href="https://stackoverflow.com/a/34580922/3761783">problem with OpenSSL</a>, so 3.6 it is. Unfortunately, we will have to built it from the source, which takes a while.
Before we go on, we need Python 3.6 on the Raspberry Pi. Earlier versions have a bug in socketio-client (which we need for remote control of volumio) and the current version 3.7 has a <a href="https://stackoverflow.com/a/34580922/3761783">problem with OpenSSL</a>, so 3.6 it is. Unfortunately, we will have to built it from the source, which takes a while.
</p>
<pre><code>sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev
@@ -462,17 +463,55 @@ sudo pip3.6 install socketio-client
sudo pip3.6 install RPi.GPIO
</code></pre>
<p>
Now it the system should be able to run the test scripts:
</p>
<h3 id="configuration">Configuration und Test</h3>
<pre style="background-color:#ffff99">
Test LED, Webcam and QR recognition
</pre>
<pre><code># Turn the LED on and off
python3.6 /data/INTERNAL/qudio/test/led_on.py
python3.6 /data/INTERNAL/qudio/test/led_off.py
</code></pre>
<pre><code># Test the buttons
python3.6 /data/INTERNAL/qudio/test/buttons.py
# Pressing the buttons should now result in an output. After testing, stop the script with Ctrl-C.
</code></pre>
<pre><code># Test the sensor
python3.6 /data/INTERNAL/qudio/test/sensor.py
# Putting a card on the window should make the signal go from LOW to HIGH. After testing, stop the script with Ctrl-C.
</code></pre>
<p>
If everything works fine, we can set up the script that glues everything together as a system service. Create a service description file with <code>sudo nano /lib/systemd/system/qudio.service</code> and put in the following content:
</p>
<pre><code>[Unit]
Description=qudio
After=volumio.service
Requires=volumio.service
[Service]
Type=simple
ExecStart=/bin/bash -c 'exec python3.6 /data/INTERNAL/qudio/qudio.py > /tmp/qudio.log 2>&1'
User=volumio
[Install]
WantedBy=multi-user.target</code></pre>
<p>
For testing purposes you can print <a href="misc/test-cards.pdf">these QR code cards</a>.
Close the nano editor with Ctrl-X, activate the service and restart the system:
</p>
<pre><code>sudo systemctl daemon-reload
sudo systemctl enable qudio.service
sudo reboot</code></pre>
<p>
After rebooting, the player is ready to go. Now you can do a final test with <a href="misc/QR-Card_Template.pdf">example QR code cards</a>
</p>
<h2 id="qr-cards">QR Cards</h2>
@@ -488,46 +527,22 @@ Test LED, Webcam and QR recognition
</p>
<p>
Since the creation of the cards can be a bit of a hassle when the collection grows larger, I have written a card generator for Spotify links. It takes a list of Spotify URIs as input and generates a PDF with the QR codes, the title and the album art. The information is printed both on the front and the back of the cards in order to make sorting of card stacks easier. I will put the generator online as soon as possible.
You can use <a href="misc/QR-Card_Template.odt">this ODT template</a> for creating your own cards. Since the creation of the cards can be a bit of a hassle when the collection grows larger, I have written a card generator for Spotify links. It takes a list of Spotify URIs as input and generates a PDF with the QR codes, the title and the album art. The information is printed both on the front and the back of the cards in order to make sorting of card stacks easier. I will put the generator online as soon as possible.
</p>
<h2>What's Left</h2>
<p>
</p>
<p>
If you have any questions or improvements please send me an e-mail to <a href="mailto:tliero@gmx.net">tliero@gmx.net</a>.
</p>
<pre style="display:none;background-color:#ffff99">
Intro-Video (evtl. mit Jacob)
Komponenten-Fotos:
Jumper-Kabel
Plexiglas
Intro-Video
Live-Bild Kamera-Einstellung
LED im Case
IIIP!!!! noise, power supply
Fritzing-Schema
Test-QR
Druck säubern, insbes. Button holes
Link zu OnShape
deactivate microphone?
deactivate RasPi LED
12 mm caps?
acrylic glass --> size?
Bohrergröße
</pre>
</div>