Music https://tech.feedyourhead.at/ en How to build a music-box for children https://tech.feedyourhead.at/content/how-to-build-a-music-box-for-children <span class="field field--name-title field--type-string field--label-hidden">How to build a music-box for children</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p><span>The <a href="https://tonies.com/en-gb/toniebox/">Tonibox</a> is a music player for children. They can simply place figures on the box and depending on the figure, a corresponding audio book is then played. I like this concept and since my child loves audio books, I am going to build such a box.</span></p> <p><em><span>Note: I never had an original Tonibox in my hands. So I don’t know about it’s exact features and also don’t know how it really works. This article simply describes how I would build such a device.</span></em></p> <h2>Overview</h2> <p>In this article I am going to build a "Tonibox-like" device with the following components:</p> <ul><li>wooden box (160x160mm)</li> <li>PN532 NFC-Reader</li> <li>3 Watt audio speakers</li> <li>PAM8403 amplifier</li> <li>Raspberry PI 4</li> <li>Spotify(premium account)</li> <li>Local Audio Files</li> <li>Pink LEDs + resistors</li> </ul><h2>Near-field communication</h2> <figure role="group" class="caption caption-img"><img alt="Picture of a pn532 nfc-reader module" data-entity-type="file" data-entity-uuid="ea38c063-f279-48bc-82c7-c5977a8e6509" height="456" src="/sites/default/files/inline-images/pn532-unboxed.png" width="608" /><figcaption>Figure 1: PN532 NFC-Reader and equipment</figcaption></figure><p><span>Let’s think how the original Tonibox might work. I believe that the figures might have built-in NFC-tags. As soon as they are placed on the reader, it reads the ID of the tag and plays the audio book. That’s why I bought the <a href="http://wiki.sunfounder.cc/index.php?title=PN532_NFC_RFID_Module">PN532</a>-reader(see Figure 1). It's very cheap and works perfect for my purposes. This chip can be controlled via SPI, UART or I2C. After some research, it seam that I2C needs just view cables, but might be not very stable. UART has a quite slow bitrate. I2C is faster but more unstable. So I decided to use SPI. According to https://www.schnatterente.net/technik/nfc-raspberry-pi-pn532-breakout-board/5 SPI works rather fast and stable with the PN532 chip. In order to use SPI, a jumper must be set. The following diagram shows how to connect the chip to the Raspberry PI and how to set the jumpers for SPI.</span></p> <figure role="group" class="caption caption-img"><img alt="Wiring schema of the PN532 with the Raspberry PI" data-entity-type="file" data-entity-uuid="9a9f0ef8-eaf8-431e-9876-da3daf6b72e8" height="389" src="/sites/default/files/inline-images/PN532-wiring.png" width="692" /><figcaption>Figure 2: Wiring the PN532 to the Raspberry PI(Image-Source for the Raspberry PI: Raspberry Pi Foundation)</figcaption></figure><p><span>After connecting the nfc-reader it's time for the software. The easiest way to access the reader is by using the libnfc(link). It can easily installed via apt:</span></p> <span class="geshifilter"><code class="bash geshifilter-bash"> apt <span style="color: #c20cb9; font-weight: bold;">install</span> libnfc-bin libnfc-dev libnfc-examples libnfc-pn53x-examples libnfc5:armhf </code></span> <p><span>I use the following configuration to use the PN532 chip via SPI:</span></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;">allow_autoscan = <span style="color: #c20cb9; font-weight: bold;">true</span>   allow_intrusive_scan = <span style="color: #c20cb9; font-weight: bold;">false</span>   log_level = <span style="color: #000000;">1</span>   device.name = <span style="color: #ff0000;">"_PN532_SPI"</span> device.connstring = <span style="color: #ff0000;">"pn532_spi:/dev/spidev0.0:500000"</span></pre></div> <p><span>Now let' try to access it. The libnfc comes with a tool "nfc-poll". We will use it to read the ID of the nfc-tag with the following command:</span></p> <p><span class="geshifilter"><code class="bash geshifilter-bash"> <span style="color: #c20cb9; font-weight: bold;">sudo</span> nfc-poll </code></span></p> <p><span>I modified the source code of nfc-poll and made a nfc-daemon(https://github.com/whotwagner/nfc-daemon) that executes events when a nfc-tag is detected and when it is removed. Installation is rather simple:</span></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git clone</span> https:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>whotwagner<span style="color: #000000; font-weight: bold;">/</span>nfc-daemon <span style="color: #7a0874; font-weight: bold;">cd</span> nfc-daemon <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> docs<span style="color: #000000; font-weight: bold;">/</span>nfc-daemon.service <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>systemd<span style="color: #000000; font-weight: bold;">/</span>system<span style="color: #000000; font-weight: bold;">/</span>nfc-daemon.service <span style="color: #c20cb9; font-weight: bold;">sudo</span> systemctl <span style="color: #7a0874; font-weight: bold;">enable</span> nfc-daemon.service <span style="color: #c20cb9; font-weight: bold;">sudo</span> systemctl start nfc-daemon.service</pre></div> <p><span>We can test the nfc-daemon by editing "/usr/local/share/nfc-daemon/run_script":</span></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">"hello world: "</span> <span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #000000; font-weight: bold;">@</span></pre></div> <p><span>We also need a stop_script "/usr/local/share/nfc-daemon/end_script":</span></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"Goodbye World"</span></pre></div> <h2><span>Music-Daemon: Mopidy</span></h2> <p><span>By using the nfc-daemon, we can now execute scripts. Finally it's time to play music. I decided to use the music-daemon mopidy to do the playback. <a href="https://mopidy.com/">Mopidy</a> plays music from local disk, Spotify, SoundCloud, TuneIn, and more. You can edit the playlist from any phone, tablet, or computer using a variety of MPD and web clients. The installation is straight forward. I followed the guide in the <a href="https://docs.mopidy.com/en/latest/installation/pypi/#installing-extensions">mopidy-documentation</a> and installed the mopidy-server via pip3. In addition I also installed the following modules:</span></p> <ul><li>Mopidy-Mopify</li> <li>Mopidy-MPD</li> <li>Mopidy-MPRIS</li> <li>Mopidy-Spotify</li> <li>Mopidy-Spotify-Web</li> </ul><p><span>For <a href="https://www.spotify.com/">Spotify</a> we also have to create credentials. We need a spotify premium account for that. I just followed the guide at https://mopidy.com/ext/spotify/. The client_id and client_secret must be used in the configuration. I experienced some strange problems, therefor I also added the spotify-username and spotify-password to the config. I actually don't know if it also works somehow without the spotify credentials. I also believe that Mopidy-Spotify-Web is not necessary to install.</span></p> <p><span><em>/etc/mopidy/mopidy.conf</em>:</span></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">[</span>audio<span style="color: #7a0874; font-weight: bold;">]</span> output = alsasink   <span style="color: #7a0874; font-weight: bold;">[</span>spotify<span style="color: #7a0874; font-weight: bold;">]</span> enabled = <span style="color: #c20cb9; font-weight: bold;">true</span> username = SPOTIFY_USER password = SPOTIFY_PASS client_id = CLIENT_ID client_secret = CLIENT_SECRET   <span style="color: #7a0874; font-weight: bold;">[</span>spotify_web<span style="color: #7a0874; font-weight: bold;">]</span> client_id = CLIENT_ID client_secret = CLIENT_SECRET     <span style="color: #7a0874; font-weight: bold;">[</span>mopify<span style="color: #7a0874; font-weight: bold;">]</span> enabled = <span style="color: #c20cb9; font-weight: bold;">true</span> debug = <span style="color: #c20cb9; font-weight: bold;">false</span>   <span style="color: #7a0874; font-weight: bold;">[</span>http<span style="color: #7a0874; font-weight: bold;">]</span> enabled = <span style="color: #c20cb9; font-weight: bold;">true</span> <span style="color: #c20cb9; font-weight: bold;">hostname</span> = 0.0.0.0 port = <span style="color: #000000;">6680</span> zeroconf = Mopidy HTTP server on <span style="color: #007800;">$hostname</span> allowed_origins = csrf_protection = <span style="color: #c20cb9; font-weight: bold;">true</span> default_app = mopidy</pre></div> <p> </p> <p><span>If you want to test the sound-server, you can do that by using mpc (command-line-client) or by using the ncurses based client "<a href="https://github.com/ncmpcpp/ncmpcpp">ncmpcpp</a>".</span></p> <h2>WIFI</h2> <p><span>I do not want any cables but the loading cable on the Tonibox. So I configured wifi. I configured the raspberry pi to connect to two networks. One is my home-wifi, and one is a non-existent network. The latter one I create with my mobile phone when we are not at home.</span></p> <p><em><span>/etc/wpa_supplicant/wpa_supplicant.conf:</span></em></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #007800;">ctrl_interface</span>=<span style="color: #007800;">DIR</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>wpa_supplicant <span style="color: #007800;">GROUP</span>=netdev <span style="color: #007800;">update_config</span>=<span style="color: #000000;">1</span> <span style="color: #007800;">country</span>=AT   <span style="color: #007800;">network</span>=<span style="color: #7a0874; font-weight: bold;">{</span> <span style="color: #007800;">ssid</span>=<span style="color: #ff0000;">"home-net"</span> <span style="color: #007800;">psk</span>=<span style="color: #ff0000;">"home-net-password"</span> <span style="color: #007800;">key_mgmt</span>=WPA-PSK <span style="color: #007800;">id_str</span>=<span style="color: #ff0000;">"home"</span> <span style="color: #007800;">priority</span>=<span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">}</span>   <span style="color: #007800;">network</span>=<span style="color: #7a0874; font-weight: bold;">{</span> <span style="color: #007800;">ssid</span>=<span style="color: #ff0000;">"mobile-hotspot"</span> <span style="color: #007800;">psk</span>=<span style="color: #ff0000;">"mobile-hotspot-password"</span> <span style="color: #007800;">key_mgmt</span>=WPA-PSK <span style="color: #007800;">id_str</span>=<span style="color: #ff0000;">"mobile"</span> <span style="color: #007800;">priority</span>=<span style="color: #000000;">2</span> <span style="color: #7a0874; font-weight: bold;">}</span></pre></div> <h2><span>Bootsound</span></h2> <p><span>In order to play a sound if the box is booted, I also want to have a nice sound that indicates that it is up and running. I downloaded a nice wav-file from <a href="http://soundbible.com/1795-Electrical-Sweep.html">soundbible.com</a> and configured a boot-script "/usr/local/bin/bootsound.sh":</span></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sleep</span> 15s <span style="color: #666666; font-style: italic;"># dirty hack to be sure that it is booted</span> mpc <span style="color: #c20cb9; font-weight: bold;">clear</span> mpc add file:<span style="color: #000000; font-weight: bold;">///</span>home<span style="color: #000000; font-weight: bold;">/</span>pi<span style="color: #000000; font-weight: bold;">/</span>SoundEffects<span style="color: #000000; font-weight: bold;">/</span>boot.wav mpc play</pre></div> <p><span>A systemd-service will execute this script. So let's create the systemd-service "/etc/systemd/system/bootsound.service":</span></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">[</span>Unit<span style="color: #7a0874; font-weight: bold;">]</span> <span style="color: #007800;">Description</span>=Boot Sound <span style="color: #007800;">After</span>=avahi-daemon.service <span style="color: #007800;">After</span>=dbus.service <span style="color: #007800;">After</span>=network.target <span style="color: #007800;">After</span>=nss-lookup.target <span style="color: #007800;">After</span>=pulseaudio.service <span style="color: #007800;">After</span>=remote-fs.target <span style="color: #007800;">After</span>=sound.target <span style="color: #007800;">After</span>=mopidy.service <span style="color: #007800;">After</span>=mopidy.service   <span style="color: #7a0874; font-weight: bold;">[</span>Service<span style="color: #7a0874; font-weight: bold;">]</span> <span style="color: #007800;">Type</span>=oneshot <span style="color: #007800;">RemainAfterExit</span>=no <span style="color: #007800;">ExecStart</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>bootsound.sh   <span style="color: #7a0874; font-weight: bold;">[</span>Install<span style="color: #7a0874; font-weight: bold;">]</span> <span style="color: #007800;">WantedBy</span>=default.target</pre></div> <p><span>Now we just have to set the permissions and enable the systemd-service:</span></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chown</span> root.root <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>bootsound.sh <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>bootsound.sh systemctl <span style="color: #7a0874; font-weight: bold;">enable</span> bootsound.service</pre></div> <h2><span>Audio Hardware</span></h2> <figure role="group" class="caption caption-img"><img alt="Image of the PAM8403 Module" data-entity-type="file" data-entity-uuid="b3aa8596-b5cf-48a5-be45-3e2862696ed7" height="210" src="/sites/default/files/inline-images/pam8403.png" width="210" /><figcaption>Figure 3: PAM8403 Module (Image-Source: https://bdspeedytech.com/image/cache/catalog/PAM8403-750x750.png)</figcaption></figure><p>I want to keep things simple. In order to avoid a special power adapter, I simply use an amplifier that works with low power and connect it to the 5V Raspberry PI power-pins. I found the <a href="https://www.makershop.de/module/audio/pam8403-2/">PAM8403</a> amplifier module. It works with 5Volt and allows to connect two 3 Watt audio speakers. By soldering a cable to the amplifier, it is possible to connect it to the sound output of the Raspberry PI</p> <p>Finally I also need 3 Watt speakers and I will use the <a href="https://www.reichelt.at/at/de/index.html?ACTION=446&amp;LA=446&amp;nbc=1&amp;q=vis%202242">Visaton 2242</a><span>. They are not very special, work with 2 Watt and 8 Ohm and might be enough for a “toy”.</span></p> <figure role="group" class="caption caption-img"><img alt="Image of a Visaton 2242 audio speaker" data-entity-type="file" data-entity-uuid="e5c4528e-d26f-460d-bee1-8eac279d5592" height="163" src="/sites/default/files/inline-images/visaton2242.png" width="163" /><figcaption>Figure 4: Visaton 2242 ( Image-Source: reichelt.at)</figcaption></figure><figure role="group" class="caption caption-img"><img alt="Image of the wiring: raspberry pi connected to the amplifier that has the two speakers connected" data-entity-type="file" data-entity-uuid="fa62bd39-32ee-4c5a-8f1d-e2b42f9bd15e" height="380" src="/sites/default/files/inline-images/audio-cabeling.png" width="507" /><figcaption>Figure 5: Wiring the amplifier</figcaption></figure><p> <video controls="" height="360" width="480"><source src="/sites/default/files/DateiUploads/musicbox-wiring-video.mp4" type="video/mp4"></source></video></p> <h2 class="western"><span style="page-break-before:always">Joni – Connecting NFC and Mopidy</span></h2> <p><span style="line-height:100%">The final component is the script that identifies the UID of the nfc-card and looks it up in a database in order to play it using the Mopidy server. I want to make this script as simple as possible. That's why I didn't use any database at all and use a simple yaml-file instead. Since I don't expect too many entries, it might be okay. The outcome is a script called "<a href="https://github.com/whotwagner/joni.git">joni</a>".</span></p> <p><span style="line-height:100%">Installation:</span></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git clone</span> https:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>whotwagner<span style="color: #000000; font-weight: bold;">/</span>joni.git <span style="color: #7a0874; font-weight: bold;">cd</span> joni <span style="color: #c20cb9; font-weight: bold;">sudo</span> pip3 <span style="color: #c20cb9; font-weight: bold;">install</span> . <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> bin<span style="color: #000000; font-weight: bold;">/</span>jon.py <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>jon.py <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>jon.py <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>joni <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>joni.log <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> pi.pi <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>joni.log</pre></div> <p><span style="line-height:100%">Now create the config-file <em>/etc/joni/config.yml</em>:</span></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;">volume: <span style="color: #000000;">45</span> timeout: <span style="color: #000000;">10</span>   tracks: - id: 029i2939392a description: <span style="color: #ff0000;">"Petronella Apfelmus - Zaubertricks und Maulwurfshuegel"</span> play: - spotify:album:3HJSMsKWgmP5OCss1UD2p5   - id: 0298383219f volume: <span style="color: #000000;">20</span> <span style="color: #666666; font-style: italic;"># you can set a volume per playlist</span> description: <span style="color: #ff0000;">"Das Beste ueberhaupt"</span> play: - file:<span style="color: #000000; font-weight: bold;">///</span>home<span style="color: #000000; font-weight: bold;">/</span>pi<span style="color: #000000; font-weight: bold;">/</span>Kindercds<span style="color: #000000; font-weight: bold;">/</span>Geschichten<span style="color: #000000; font-weight: bold;">/</span>Track01.wav - file:<span style="color: #000000; font-weight: bold;">///</span>home<span style="color: #000000; font-weight: bold;">/</span>pi<span style="color: #000000; font-weight: bold;">/</span>Kindercds<span style="color: #000000; font-weight: bold;">/</span>Geschichten<span style="color: #000000; font-weight: bold;">/</span>Track02.wav - file:<span style="color: #000000; font-weight: bold;">///</span>home<span style="color: #000000; font-weight: bold;">/</span>pi<span style="color: #000000; font-weight: bold;">/</span>Kindercds<span style="color: #000000; font-weight: bold;">/</span>Geschichten<span style="color: #000000; font-weight: bold;">/</span>Track03.wav - file:<span style="color: #000000; font-weight: bold;">///</span>home<span style="color: #000000; font-weight: bold;">/</span>pi<span style="color: #000000; font-weight: bold;">/</span>Kindercds<span style="color: #000000; font-weight: bold;">/</span>Geschichten<span style="color: #000000; font-weight: bold;">/</span>Track04.wav - file:<span style="color: #000000; font-weight: bold;">///</span>home<span style="color: #000000; font-weight: bold;">/</span>pi<span style="color: #000000; font-weight: bold;">/</span>Kindercds<span style="color: #000000; font-weight: bold;">/</span>Geschichten<span style="color: #000000; font-weight: bold;">/</span>Track05.wav</pre></div> <p><span style="line-height:100%">In order to run joni we have to edit the run- and end-script.</span></p> <p><em><span style="line-height:100%">/usr/local/share/nfc-daemon/run_script:</span></em></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span> <span style="color: #666666; font-style: italic;"># concats the id:</span> <span style="color: #007800;">VAR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #000000; font-weight: bold;">@</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ gsub (" ", "", $0); print}'</span><span style="color: #000000; font-weight: bold;">`</span>   <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>jon.py <span style="color: #660033;">-d</span> <span style="color: #660033;">-L</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>joni.log <span style="color: #660033;">--start</span> <span style="color: #007800;">$VAR</span></pre></div> <p><em><span style="line-height:100%">/usr/local/share/nfc-daemon/end_script:</span></em></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>   <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>jon.py <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>joni<span style="color: #000000; font-weight: bold;">/</span>config.yml <span style="color: #660033;">--stop</span></pre></div> <h2 class="western"><span style="page-break-before:always">The Wooden Box</span></h2> <p>It’s rather difficult to make a toy for a child. It has to be “unbreakable”, but must not be too heavy. Choose the wood wisely and make the “walls” rather thick! I made the mistake that I used beech wood. It’s much to heavy and very hard. On the other hand, it’s a very beautiful wood.</p> <p>Since I am not very good at working with wood, my uncle helped me out and made the box(160x160x160mm) with walls that are about 30mm thick.</p> <figure role="group" class="caption caption-img"><img alt="Empty wooden box" data-entity-type="file" data-entity-uuid="2310955c-70ea-46f6-8f54-d16e9815ca88" src="/sites/default/files/inline-images/wooden-box1.png" /><figcaption>Figure 6: empty wooden box. open</figcaption></figure><figure role="group" class="caption caption-img"><img alt="empty wooden box without any electronics" data-entity-type="file" data-entity-uuid="67f6b2a9-f1c1-4461-a4cf-1fbd33ee3ac7" src="/sites/default/files/inline-images/wooden-box2.png" /><figcaption>Figure 6: empty wooden box. closed</figcaption></figure><figure role="group" class="caption caption-img"><img alt="Wooden box with built-in raspberry pi" data-entity-type="file" data-entity-uuid="005626ae-6fc6-4e6b-98f7-094d1963583a" height="482" src="/sites/default/files/inline-images/wooden-box4.png" width="642" /><figcaption>Figure 7: Builtin Raspberry PI</figcaption></figure><figure role="group" class="caption caption-img"><img alt="Music-Box with speakers and transparent plastic on top" data-entity-type="file" data-entity-uuid="b42e57cb-6195-4f5d-8436-1719277addff" height="587" src="/sites/default/files/inline-images/wooden-box5.png" width="440" /><figcaption>Figure 8: Almost finished. The music-box with speakers and a transparent plattform for the NFC-tags on top</figcaption></figure><h2 class="western"><span style="page-break-before:always">Pink LED Indicator</span></h2> <p><span style="line-height:100%">My box is a massive box made of wood. I want to place the nfc-reader on the top of it and want to have a small distance between card and reader. That's why I bought a simple pocket-mirror and used just one half of it. Since it is made of transparent plastic, it would be beautiful to place LED's there. They light up when a card is placed. I use 4 LED's. That's too much current for one GPIO-pin. As far as I know the Raspberry PI 4 GPIO-pins support up to 16mA. So I connect the LED’s with 4 GPIO-pins. One <a href="https://www.conrad.at/de/p/thomsen-184541-led-bedrahtet-pink-rund-5-mm-1120-mcd-60-20-ma-3-4-v-184541.html">LED</a> with a resistor per pin. I picked a 330Ohm resistory so that I have 10mA per GPIO-pin. In order to initialize the GPIO-pins, I placed the code in <em>/usr/local/bin/bootsound.sh:</em></span></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>   <span style="color: #c20cb9; font-weight: bold;">sleep</span> 10s <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"26"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"out"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio26<span style="color: #000000; font-weight: bold;">/</span>direction <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"0"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio26<span style="color: #000000; font-weight: bold;">/</span>value   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"19"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"out"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio19<span style="color: #000000; font-weight: bold;">/</span>direction <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"0"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio19<span style="color: #000000; font-weight: bold;">/</span>value   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"13"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"out"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio13<span style="color: #000000; font-weight: bold;">/</span>direction <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"0"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio13<span style="color: #000000; font-weight: bold;">/</span>value   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"6"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"out"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio6<span style="color: #000000; font-weight: bold;">/</span>direction <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"0"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio6<span style="color: #000000; font-weight: bold;">/</span>value   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"5"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"out"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio5<span style="color: #000000; font-weight: bold;">/</span>direction <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"0"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio5<span style="color: #000000; font-weight: bold;">/</span>value   mpc <span style="color: #c20cb9; font-weight: bold;">clear</span> mpc add file:<span style="color: #000000; font-weight: bold;">///</span>home<span style="color: #000000; font-weight: bold;">/</span>pi<span style="color: #000000; font-weight: bold;">/</span>SoundEffects<span style="color: #000000; font-weight: bold;">/</span>boot.wav mpc play</pre></div> <p><em><span style="line-height:100%">/usr/local/share/nfc-daemon/run_script:</span></em></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span> <span style="color: #007800;">VAR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #000000; font-weight: bold;">@</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ gsub (" ", "", $0); print}'</span><span style="color: #000000; font-weight: bold;">`</span>   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"1"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio26<span style="color: #000000; font-weight: bold;">/</span>value <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"1"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio19<span style="color: #000000; font-weight: bold;">/</span>value <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"1"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio13<span style="color: #000000; font-weight: bold;">/</span>value <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"1"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio6<span style="color: #000000; font-weight: bold;">/</span>value <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"1"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio5<span style="color: #000000; font-weight: bold;">/</span>value   <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>jon.py <span style="color: #660033;">-d</span> <span style="color: #660033;">-L</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>joni.log <span style="color: #660033;">--start</span> <span style="color: #007800;">$VAR</span></pre></div> <p><em><span style="line-height:100%">/usr/local/share/nfc-daemon/end_script:</span></em></p> <p></p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>   <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>jon.py <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>joni<span style="color: #000000; font-weight: bold;">/</span>config.yml <span style="color: #660033;">--stop</span>   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"0"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio26<span style="color: #000000; font-weight: bold;">/</span>value <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"0"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio19<span style="color: #000000; font-weight: bold;">/</span>value <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"0"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio13<span style="color: #000000; font-weight: bold;">/</span>value <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"0"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio6<span style="color: #000000; font-weight: bold;">/</span>value <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">"0"</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>gpio<span style="color: #000000; font-weight: bold;">/</span>gpio5<span style="color: #000000; font-weight: bold;">/</span>value</pre></div> <figure role="group" class="caption caption-img"><img alt="Image shows the nfc-reader module that is placed on top of the wooden box" data-entity-type="file" data-entity-uuid="786ad7de-89f4-4aba-ae92-d04157f59f70" height="649" src="/sites/default/files/inline-images/placing-nfcreader.png" width="487" /><figcaption>Figure 9: Placing the NFC-module on top of the wooden box</figcaption></figure><p> <video controls="" height="700" width="500"><source src="/sites/default/files/DateiUploads/music-box-final.mp4" type="video/mp4"></source></video></p> <h2 class="western">Special Thanks</h2> <p>This box wouldn’t be as perfect as it is now if there weren’t some friends who helped me. I want to thank “Jumpy” and his friends who made most of the wooden box. I also want to thank “Brother Patrick” with his super-cool soldering station, who showed me how to solder properly and who helped me making the electronics just perfect. And last but not least to my neighbor who printed all the labels for the NFC-cards.</p> <h2 class="western">Final words</h2> <p>It was very easy to create a Spotify-powered homemade Tonibox and it was a lot of fun for me. My child was more than delighted and listens to the audio books every day.</p> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/users/hoti" typeof="schema:Person" property="schema:name" datatype="">Hoti</span></span> <span class="field field--name-created field--type-created field--label-hidden">Jan 02 2021</span> <div class="field field--name-field-tagies field--type-entity-reference field--label-above"> <div class="field__label">Tags</div> <div class='field__items'> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/hackaday" hreflang="en">HackADay</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/hardware" hreflang="en">Hardware</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/raspberry" hreflang="en">Raspberry</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/music" hreflang="en">Music</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/Programming" hreflang="en">Programming</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/c" hreflang="en">C</a></div> </div> </div> <section class="field field--name-comment-node-blog field--type-comment field--label-hidden comment-wrapper"> </section> <div class="node__links"> <ul class="links inline"><li class="comment-add"><a href="/content/how-to-build-a-music-box-for-children#comment-form" title="Share your thoughts and opinions." hreflang="en">Add new comment</a></li></ul> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title">Comments</h2> <article data-comment-user-id="0" id="comment-291" about="/comment/291" typeof="schema:Comment" class="comment js-comment by-anonymous"> <mark class="hidden" data-comment-timestamp="1609605299"></mark> <footer class="comment__meta"> <article typeof="schema:Person" about="/user/0" class="profile"> </article> <p class="comment__submitted"><span rel="schema:author">Submitted by <span lang="" typeof="schema:Person" property="schema:name" datatype="">Andrei (not verified)</span> on Jan 02 2021</span> <span property="schema:dateCreated" content="2021-01-02T14:33:16+00:00" class="rdf-meta hidden"></span> </p> <a href="/comment/291#comment-291" hreflang="en">Permalink</a> </footer> <div class="content"> <h3 property="schema:name" datatype=""><a href="/comment/291#comment-291" class="permalink" rel="bookmark" hreflang="en">Audio Out</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item"><p>Super nice project!<br /> Thank you for sharing!</p> <p>Is there a way to have an additional audio out, via Bluetooth or 3.5 mm audio jack, so it could also go through home amplifier or audio system if wanted? Spotify has quite good sound quality if opted for.</p> <p>All the best!</p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=291&amp;1=default&amp;2=en&amp;3=" token="y3LrikPfV1pM77ouqb35eB-KM1KkYrBd2w4qR3WlQY8"></drupal-render-placeholder> </div> </article> <div class="indented"> <article data-comment-user-id="1" id="comment-292" about="/comment/292" typeof="schema:Comment" class="comment js-comment by-node-author"> <mark class="hidden" data-comment-timestamp="1609605530"></mark> <footer class="comment__meta"> <article typeof="schema:Person" about="/users/hoti" class="profile"> </article> <p class="comment__submitted"><span rel="schema:author">Submitted by <span lang="" about="/users/hoti" typeof="schema:Person" property="schema:name" datatype="">Hoti</span> on Jan 02 2021</span> <span property="schema:dateCreated" content="2021-01-02T16:38:50+00:00" class="rdf-meta hidden"></span> </p> <p class="parent visually-hidden">In reply to <a href="/comment/291#comment-291" class="permalink" rel="bookmark" hreflang="en">Audio Out</a> by <span lang="" typeof="schema:Person" property="schema:name" datatype="">Andrei (not verified)</span></p> <a href="/comment/292#comment-292" hreflang="en">Permalink</a> </footer> <div class="content"> <h3 property="schema:name" datatype=""><a href="/comment/292#comment-292" class="permalink" rel="bookmark" hreflang="en">Yes, the Raspberry PI has…</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item">Yes, the Raspberry PI has Bluetooth built in. It is possible to use it for Audio output. Another nice built.-in feature is, that this box can be controlled with an App. The music-server Mopidy can be controlled via network ( https://mopidy.com/ext/mobile/ )</div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=292&amp;1=default&amp;2=en&amp;3=" token="PkLnTsrFCod0RAYCW8jC09xjVo5vibC8JhaFlipzoz8"></drupal-render-placeholder> </div> </article> </div> <h2 class='title comment-form__title'> <i class="fa fa-comments-o"></i> Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=294&amp;2=comment&amp;3=comment" token="_8dmtEYvMrzg7f9GTUFmT0L61xh-uUTbizTQ2JIK1zA"></drupal-render-placeholder> </section> Sat, 02 Jan 2021 09:57:54 +0000 Hoti 294 at https://tech.feedyourhead.at Kodi: Autoplay on start-up.. https://tech.feedyourhead.at/content/kodi-autoplay-start <span class="field field--name-title field--type-string field--label-hidden">Kodi: Autoplay on start-up..</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p><img alt="" src="http://tech.feedyourhead.at/sites/tech.feedyourhead.at/files/pictures/kodi.png" /></p> <p>When I get up in the morning I start my Raspberry Pi(OpenElec installed) and listen to the local radio stations. It would be awesome if my pi automatically plays my favourite station after booting. That's why I played a bit with the MediaCenter Kodi.</p> <p>First of all I enabled SSH (OpenElec Settings) and connected via ssh. Then I created a m3u-Playlist under "/storage/.kodi/userdata/playlists/music/superfly.m3u"</p> <p>superfly.m3u:</p> <pre> <code> http://stream01.superfly.fm:8080/live http://stream01.superfly.fm:8080/live http://stream01.superfly.fm:8080/live http://stream01.superfly.fm:8080/live http://stream01.superfly.fm:8080/live http://stream01.superfly.fm:8080/live http://stream01.superfly.fm:8080/live http://stream01.superfly.fm:8080/live http://stream01.superfly.fm:8080/live http://stream01.superfly.fm:8080/live http://stream01.superfly.fm:8080/live http://stream01.superfly.fm:8080/live http://stream01.superfly.fm:8080/live http://stream01.superfly.fm:8080/live </code></pre> <p>I am using the same stream-entry multiple times. If network is not up'n'running at boottime, kodi would just try another entry(and another and another...).</p> <p>Now I just have to make sure that kodi plays this playlist after booting:</p> <p>Under Settings-&gt;Appearance-&gt;Skin-&gt;Settings is a Option for "Enable playlist at startup". As soon as you enable the radio-button "Enable playlist at startup", you'll be able to choose a path for the playlist.</p> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/users/hoti" typeof="schema:Person" property="schema:name" datatype="">Hoti</span></span> <span class="field field--name-created field--type-created field--label-hidden">Aug 23 2015</span> <div class="field field--name-field-tagies field--type-entity-reference field--label-above"> <div class="field__label">Tags</div> <div class='field__items'> <div class="field__item"><i class="fa fa-tags"></i> <a href="/Linux" hreflang="en">Linux</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/kodi" hreflang="en">Kodi</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/media" hreflang="en">Media</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/music" hreflang="en">Music</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/openelec" hreflang="en">OpenElec</a></div> </div> </div> <section class="field field--name-comment-node-blog field--type-comment field--label-hidden comment-wrapper"> </section> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class='title comment-form__title'> <i class="fa fa-comments-o"></i> Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=99&amp;2=comment&amp;3=comment" token="ckwpeAMdlIinC--7gtztwJF3HltnZiNYcGwYBYkfOVc"></drupal-render-placeholder> </section> Sun, 23 Aug 2015 16:48:19 +0000 Hoti 99 at https://tech.feedyourhead.at