documentation

This commit is contained in:
2017-01-12 16:13:02 +01:00
parent 0711f0fdc9
commit bb72df77ce
9 changed files with 162 additions and 36 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
# piplayer2 # piplayer2 - The AudioSphere
# http://www.tilman.de/piplayer2 # http://www.tilman.de/piplayer2
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
import logging import logging
Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 KiB

+115 -35
View File
@@ -1,7 +1,7 @@
<!doctype html> <!doctype html>
<html lang="de"> <html lang="de">
<head> <head>
<title>piPlayer</title> <title>PiPlayer 2: The AudioSphere</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta property="og:image" content="http://www.tilman.de/projekte/piplayer/photos/02.jpg" /> <meta property="og:image" content="http://www.tilman.de/projekte/piplayer/photos/02.jpg" />
@@ -86,52 +86,132 @@ h2, h3 {
<body> <body>
<div id="content" class="container"> <div id="content" class="container">
<p class="timestamp">2017-01-08</p> <p class="timestamp">2017-01-14</p>
<h1>Music Ball</h1> <h1>AudioSphere</h1>
<p id="subtitle">An mp3 player for children based on the Raspberry Pi Zero and the JBL OnStage IIIp</p> <p id="subtitle">An MP3 player for children based on the Raspberry Pi Zero and the JBL On Stage IIIp</p>
<!-- <p style="font-weight: 700;">In spring 2016 I finalized the <a href="http://tilman.de/projekte/musikrakete/">Musikrakete</a>, an MP3 player that our boys could use without assistance. This is the second version: Not a rocket anymore, but with many improvements.</p>
Gliederung:
- Motivation
- Ergebnis
- Hardware
- Software
- Misc
-->
<p style="font-weight: 700;">Der CD-Player im Kinderzimmer war zwar beliebt, aber nicht wirklich praktisch: Die CDs waren so
schnell zerkratzt, dass ich mit dem nachbrennen kaum hinterherkam und auch das Gerät selbst schien schon nach einem dreiviertel
Jahr seinem Ende entgegen zu gehen. Deshalb sollte eine neue Lösung her. Möglichst robust, ohne CDs und auf jeden Fall ohne
Hilfe der Eltern bedienbar.</p>
<p class="gallery" style="float:right;"> <p class="gallery" style="float:right;">
<a href="photos/02.jpg" class="fancybox"><img src="photos/02.jpg" <a href="photos/02.jpg" class="fancybox"><img src="photos/02.jpg"
width="480" alt="Die Musikrakete. Durch den Schlitz in der Mitte werden Karten mit QR-Codes eingesteckt, der Player spielt dann das entsprechende Album ab. Mit den roten Schaltern kann man zwischen den Titeln springen und stoppen." /></a> width="480" alt="The AudioSphere. The QR cards are placed on the window on top, where they are detected by a photo sensor that triggers the recognition process. After the code has been read by the webcam, the respective playlist is loaded via network and played directly." /></a>
</p> </p>
<h2 id="toc">Contents</h2>
<ol>
<li><a href="#idea">The Idea</a></li>
<li><a href="#piplayer2">PiPlayer, version 2.0: AudioSphere</a></li>
<li><a href="#case">3D Printed Case</a></li>
<li><a href="#hardware">Hardware</a></li>
<li><a href="#software">Software</a></li>
<li><a href="#manual">User Manual</a></li>
</ol>
<h2 id="idea">The Idea</h2>
<p> <p>
Es fing damit an, dass Anica mich mit Begeisterung auf den <a href="https://de-de.hoerbert.com/">hörbert</a> aufmerksam This project started about a year ago, when Anica asked me if buying a <a href="https://de-de.hoerbert.com/">hörbert</a> mp3 player would be a good idea. After all our boys wasted two to three CDs every week, trying to get some music out of the small player in their room. And the CD player in the living room also seemed to reach its end of life pretty soon. Nevertheless, I wasn't too sure about the device. In order to get new files on the SD card of the player, the case had to be opened, the navigation with 11 buttons also seemed a little confusing and a single speaker operated with four batteries also did not seem promising to me.
machte. Das ist ein mp3-Player für Kinder, genauer gesagt ein Mono-Lautsprecher im Holzgehäuse mit einem SD-Slot und vier </p>
AA-Batterien. An der Vorderseite können bis zu neun Tracks über bunte Tasten direkt ausgewählt werden.
<p>
I had seen a <a href="http://www.die-schembergs.de/index.php?page=qr-music">project description of an mp3 player for small children</a> shortly before: A Raspberry Pi, connected to a webcam and speakers reads QR codes and plays the respective track or playlist. So this was what I suggested and to my surprise it was considered a better solution right away. And I had a project.
</p>
<p>
As good as the description seemed to be - I wanted to make some improvements on the original design: The player should detect the QR cards on its own, all components should be put together in a single case and, most important, the mp3 should be delivered directly from our home server. No SD card replacement needed.
</p>
<p>
Since we had an old <a href="https://www.amazon.com/JBL-OnStage-30-Pin-iPhone-Speaker/dp/B0017XMN7C">JBL OnStage IIIp</a> speaker lying around that wasn't used anymore due to its outdated 30 pin iPhone dock connector, I decided to use this as a base. After playing around with <a href="https://www.onshape.com/">Onshape</a>, soldering and programming for three months, I had the <a href="http://tilman.de/projekte/musikrakete/">Musikrakete</a> ready by end of March 2016. It's been a huge success with the boys and has been in heavy use ever since.
</p>
<p>
But there were still some open ends on the technical side and I knew that we might need a second player, once the boys have both a room of their own. So when Anica was searching for a good gift to her best friend's son we decided that an updated version would be a good idea.
</p>
<h2 id="piplayer2">PiPlayer, version 2.0: AudioSphere</h2>
<p>
The major improvement in handling was switching from a QR card slot to a window on top where the QR cards are placed on. I had seen that especially the smaller one had problems getting the cards into the narrow slot. Unfortunately, this also meant that a rocket shape was not an option anymore. At first I tried to put only a hemisphere on top of the JBL speaker which would make it look like a UFO. But the webcam needed at least 10 cm distance to the card in order have the entire QR code covered. Technically, it would be possible to further reduce the size of the ball but fitting all the components in there is hard enough as it is. Also, I wanted to be able to use the cards from the first player in the new one as well.
</p>
<p>
Also, an ethernet port is now available (since we had problems with the Wi-Fi connection in the boy's room) and thanks to switching to the Raspberry Pi Zero, the Apple dock port is now able to provide power for all the components. No additonal power source needed. By incorporating a <a href="https://shop.pimoroni.com/products/phat-dac">Pimoroni PHAT DAC</a> I removed all the audio-related headaches.
</p>
<p>
On the software side there's two major improvements: The SD card is now mounted read-only by default. This makes unplugging the AudioSphere (by accident or for reboot) unproblematic. And the Python script that operates the player now uses interrupts instead of polling for checking the input sources. This removes unnecessary overhead from the CPU and also reduces power-consumption.
</p>
<p>
OK, so much for the overview - let's build this, step by step.
</p>
<h2 id="case">3D Printed Case</h2>
<p>
First step was the design of the new case. Like the first <a href="https://cad.onshape.com/documents/56f3cf83e4b02f6312a93771/w/785ccf8684baed006305bb0d/e/c68592f13fbf9a2c69b8dd05">rocket case</a> it's public, you can find it <a href="https://cad.onshape.com/documents/584e7d080f617710a60fc5d3/w/28f44a0afe402320fa3f3faa/e/765c3d5ab7a1032836866ac8">here on Onshape</a>. (You will need to create an account to open the document.) Or you can <a href="misc/audiosphere-stl.zip">directly download the STL files for printing if you are using the very same components</a>. (Please note that you will need to rotate the top of the sphere 180° for printing.)
</p> </p>
<p class="gallery"> <p class="gallery">
<a href="fotos/2016-03-25_08-25-01.jpg" class="fancybox" rel="strecke02"><img src="fotos/2016-03-25_08-25-01.jpg" width="320" <a href="images/piplayer-04-04.png" class="fancybox" rel="collection01"><img src="images/piplayer-04-04.png"
alt="Der Player wurde gut angenommen. Das Bedienprinzip war sofort klar und wurde ausgiebig erprobt." /></a> <a width="320" alt="The base with the three main electronic components: The Raspberry Pi Zero with the PHAT DAC (blue), the USB hub with the ethernet port (green) and the camera with a representation of its viewport (black)." /></a>
href="fotos/IMG_0449_cut_rot.JPG" class="fancybox" rel="strecke02"><img src="fotos/IMG_0449_cut_rot.JPG" width="320" <a href="images/piplayer-02-500.gif" class="fancybox" rel="collection01"><img src="images/piplayer-02-500.gif" width="320"
alt="Großer Andrang: Auch dem Einjährigen war schnell klar, dass die Karte die Musik macht. Der Player würde seine Begeisterung wahrscheinlich sogar aushalten, aber die QR-Karten sollten möglichst nicht gekaut werden, außerdem möchte der große Bruder seine Hörspiele gerne bis zum Schluss hören. Deshalb wurde das Gerät erstmal außer Reichweite positioniert. Dafür hat der Kleine jetzt Exklusiv-Zugriff auf den alten CD-Player." /></a> alt="Animation of the assembly" /></a>
<a href="fotos/2016-04-02 09-36-39.jpg" class="fancybox" rel="strecke02"><img src="fotos/2016-04-02 09-36-39.jpg" <a href="images/piplayer-02-07.png" class="fancybox"
width="320" rel="collection01"><img src="images/piplayer-02-07.png" width="320"
alt="Die QR-Codes sind streifenweise auf DIN A4 gedruckt und danach einmal gefaltet, so dass der QR-Code auf der Unterseite und das Album-Cover auf der Oberseite ist." /></a> alt="The assembled case" /></a>
</p> </p>
<hr />
<p style="margin-top: 3em; font-style: italic;">Für alle, die es genau wissen wollen und als Dokumentation noch der <h2 id="hardware">Hardware and Assembly</h2>
Projektverlauf mit allen Details:</p>
<h3 id="parts">Parts list</h3>
<ul>
<li>JBL On Stage IIIP (used via ebay for less than 20 €)</li>
<li><a href="#case">The case</a>. Printed via <a href="https://www.3dhubs.com/">3dhubs.com</a></li>
<li>3 &times; M3 screws with nuts for mounting the case on the speaker (add some nylon washers, if available)</li>
<li>Raspberry Pi Zero</li>
<li>Pimoroni PHAT DAC</li>
<li>ultra-cheap <a href="images/micro-usb-hub.jpg">Micro USB HUB with ethernet port</a></li>
<li>even cheaper <a href="http://www.penguin.cz/~utx/hardware/USB_Camera_AX2311/">USB webcam</a></li>
<li>Round Acrylic glass 2 mm, 75 mm diameter. You can order these on ebay.</li>
<li>5 &times; M2.5 screws for the Raspberry Pi and the case</li>
<li>
Electronic components:
<ul>
<li>3 &times; 12 mm momentary push buttons</li>
<li><a href="http://www.vishay.com/docs/83751/cny70.pdf">CNY70 reflective optical sensor</a></li>
<li>Resistors: 2 &times; 100 &#8486;, 4.7 k&#8486;, 10k&#8486;</li>
<li>2 &times; NPN transistor</li>
<li>White LED</li>
<li>Infrared LED (904 nm)</li>
<li>Infrared LED (904 nm)</li>
<li>Jumper wires</li>
<li>0.5 mm copper wire</li>
</ul>
<li>
Tools:
<li>Soldering iron</li>
<li>Glue gun</li>
<li>Screwdriver</li>
<li>Cutting knife</li>
<li>Power drill</li>
<li>Superglue (for the window)</li>
</li>
</ul>
<h3 id="jblpreparation">Preparing the JBL IIIp Speaker</h3>
<h3 id="electronics">Electronics</h3>
<h2 id="software">Software</h2>
<h3 id="system">System Installation</h3>
<h3 id="python">Python Script</h3>
<h2 id="manual">User Manual</h2>
<h3 id="wi-fi"></h3>
<h3 id="qr-cards">QR Cards</h3>
<h2 id="planung">Planung und erste Schritte</h2>
</div> </div>
</body> </body>
Binary file not shown.
+46
View File
@@ -0,0 +1,46 @@
# Please make this file available to others
# by sending it to <lirc@bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.9.0-pre1(default) on Sun Dec 11 19:02:32 2016
#
# contributed by
#
# brand: JBL
# model no. of remote control: JBL 10-Button Remote
# devices being controlled by this remote: JBL IIIP
#
begin remote
name JBLIIIP
bits 16
flags SPACE_ENC|CONST_LENGTH
eps 30
aeps 100
header 9059 4509
one 565 1694
zero 565 564
ptrail 567
repeat 9062 2252
pre_data_bits 16
pre_data 0x2F5
gap 108487
toggle_bit_mask 0x0
begin codes
KEY_VOLUMEDOWN 0x807F
KEY_VOLUMEUP 0xC03F
KEY_MUTE 0x9867
KEY_PLAYPAUSE 0x40BF
KEY_PREVIOUS 0x48B7
KEY_NEXT 0xA05F
KEY_SCROLLUP 0x7887
KEY_SCROLLDOWN 0xF00F
KEY_MENU 0x58A7
KEY_ENTER 0x609F
end codes
end remote