{"id":580,"date":"2019-06-06T17:45:16","date_gmt":"2019-06-06T16:45:16","guid":{"rendered":"https:\/\/notiz.comanet.xyz\/?p=580"},"modified":"2019-06-06T18:36:01","modified_gmt":"2019-06-06T17:36:01","slug":"linux-raspberry-pi-pirate-radio","status":"publish","type":"post","link":"https:\/\/notiz.comanet.xyz\/?p=580","title":{"rendered":"Linux \u2013 Raspberry Pi \u2013 Pirate Radio"},"content":{"rendered":"<section id=\"main\" class=\"ember-application\">\n<div id=\"ember4\" class=\"ember-view\">\n<div class=\"application-main \" data-commit-hovercards-enabled=\"\">\n<div class=\"\">\n<div class=\"container-lg new-discussion-timeline experiment-repo-nav p-responsive\">\n<div class=\"repository-content \">\n<div class=\"Box mt-3 position-relative\">\n<div id=\"readme\" class=\"Box-body readme blob instapaper_body js-code-block-container\">\n<article class=\"markdown-body entry-content p-3 p-md-6\">\n<div id=\"gallery\" data-featherlight-gallery=\"\" data-featherlight-filter=\"a\">\n<div class=\"pure-g\">\n<div class=\"pure-u-lg-1-1 pure-u-1-1 feature-image\"><a href=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0174\/1800\/products\/zero-w-kits-square-1_1024x1024.jpg?v=1499090662\" data-image=\"\/\/cdn.shopify.com\/s\/files\/1\/0174\/1800\/products\/zero-w-kits-square-1_1024x1024.jpg?v=1499090662\"><img decoding=\"async\" src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0174\/1800\/products\/zero-w-kits-square-1_1024x1024.jpg?v=1499090662\" alt=\"A product image of Pirate Radio - Pi Zero W Project Kit\" \/><\/a><\/div>\n<\/div>\n<\/div>\n<\/article>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/section>\n<div><\/div>\n<h1><strong>pimoroni-dashboard<\/strong><\/h1>\n<div>\n<hr \/>\n<\/div>\n<section id=\"main\" class=\"ember-application\">\n<div id=\"ember4\" class=\"ember-view\">\n<div class=\"application-main \" data-commit-hovercards-enabled=\"\">\n<div class=\"\">\n<div class=\"container-lg new-discussion-timeline experiment-repo-nav p-responsive\">\n<div class=\"repository-content \">\n<div class=\"Box mt-3 position-relative\">\n<div id=\"readme\" class=\"Box-body readme blob instapaper_body js-code-block-container\">\n<article class=\"markdown-body entry-content p-3 p-md-6\">\n<div id=\"gallery\" data-featherlight-gallery=\"\" data-featherlight-filter=\"a\">\n<div class=\"pure-g\">\n<div class=\"pure-hidden-sm pure-u-md-1-6 pure-u-1-1 thumbnails\">\n<div>\n<p>On Raspbian, you can download the <code>pimoroni-dashboard<\/code> and install your product by browsing to the relevant entry:<\/p>\n<div class=\"highlight highlight-source-shell\">\n<pre>sudo apt-get install pimoroni<\/pre>\n<\/div>\n<p>(you will find the Dashboard under &#8216;Accessories&#8217; too, in the Pi menu &#8211; or just run <code>pimoroni-dashboard<\/code> at the command line)<\/p>\n<p>If you choose to download examples you&#8217;ll find them in <code>\/home\/pi\/Pimoroni\/phatbeat\/<\/code>.<\/p>\n<\/div>\n<\/div>\n<div class=\"pure-hidden-sm pure-u-md-1-6 pure-u-1-1 thumbnails\">\n<div><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<hr \/>\n<article>\n<h2>Pirate Radio &#8211; Pi Zero W Project Kit<\/h2>\n<div class=\"description\">\n<p>Build your very own internet-connected radio with the Pirate Radio Kit!<\/p>\n<p>This kit has everything* you&#8217;ll need, including a <a href=\"https:\/\/shop.pimoroni.com\/products\/raspberry-pi-zero-w\" target=\"_blank\" rel=\"noopener noreferrer\">Pi Zero W<\/a>, our flash new <a href=\"https:\/\/shop.pimoroni.com\/products\/phat-beat\" target=\"_blank\" rel=\"noopener noreferrer\">pHAT BEAT<\/a> DAC and stereo amp, a <a href=\"https:\/\/shop.pimoroni.com\/products\/3-speaker-4-3w\" target=\"_blank\" rel=\"noopener noreferrer\">5W speaker<\/a>, and a beautifully retro acrylic enclosure to make it look the business. It&#8217;ll take you around 30 minutes to assemble everything** (check out our <a href=\"https:\/\/learn.pimoroni.com\/tutorial\/sandyj\/assembling-pirate-radio\" target=\"_blank\" rel=\"noopener noreferrer\">assembly guide<\/a> for details).<\/p>\n<h2>Kit contents*<\/h2>\n<ul>\n<li>Pi Zero W<\/li>\n<li>pHAT BEAT DAC and stereo amp. with VU meter and six buttons<\/li>\n<li>Male and female 2&#215;20 pin headers<\/li>\n<li>Single 5W 4\u03a9 speaker<\/li>\n<li>Blue acrylic enclosure***<\/li>\n<li>50cm USB A to micro-B cable<\/li>\n<li>USB A (female) to micro B (male) adaptor<\/li>\n<li>Mini to full-size HDMI adaptor<\/li>\n<li>Sticker sheet (personalise your Pirate Radio!)<\/li>\n<li>Comes in a reusable kit box<\/li>\n<\/ul>\n<p><em>*Just add your own <a href=\"https:\/\/shop.pimoroni.com\/products\/noobs-8gb-sd-card\" target=\"_blank\" rel=\"noopener noreferrer\">micro-SD card<\/a><\/em><\/p>\n<p><em>**Note that this is a soldering project,\u00a0although you could use one of <a href=\"https:\/\/shop.pimoroni.com\/products\/gpio-hammer-header\" target=\"_blank\" rel=\"noopener noreferrer\">no-solder hammer headers<\/a>!<\/em><\/p>\n<p><em>***We&#8217;ve tweaked the design of the back layer and legs recently, and have updated\u00a0the <a href=\"https:\/\/learn.pimoroni.com\/tutorial\/sandyj\/assembling-pirate-radio\">build guide<\/a> with extra instructions for these new pieces.<\/em><\/p>\n<p>Pirate Radio uses our new pHAT BEAT DAC and stereo amp. to drive the single speaker (left and right channels are mixed when you flip the DIP switch on the underside to mono mode). pHAT BEAT uses the same I2S mono DAC and amplifier that we use on Speaker pHAT and Picade HAT and&#8230; adds a second one for stereo goodness! The two rows of 8 APA102 RGB LEDs make the perfect VU meter, and there are 6 buttons along the edges to control your audio.<\/p>\n<p>This kit takes advantage of the built-in wireless LAN and Bluetooth on the Pi Zero W, meaning that there&#8217;s no longer any need for a USB Wi-Fi dongle.<\/p>\n<p>We&#8217;ve put together three different software projects for your Pirate Radio: an <a href=\"https:\/\/github.com\/pimoroni\/phat-beat\/tree\/master\/projects\/vlc-radio\">internet radio<\/a>, a <a href=\"https:\/\/learn.pimoroni.com\/tutorial\/sandyj\/streaming-spotify-to-your-pi\">Spotify streaming box<\/a>, or an <a href=\"https:\/\/learn.pimoroni.com\/tutorial\/sandyj\/streaming-airplay-to-your-pi\">AirPlay speaker<\/a>.<\/p>\n<h2>Features<\/h2>\n<ul>\n<li>Dual I2S DAC\/amplifiers (MAX98357A)<\/li>\n<li>3W per channel<\/li>\n<li>2x push fit speaker terminals<\/li>\n<li>DIP switch to select blended mono or stereo modes<\/li>\n<li>16 RGB LED pixels (APA102) in 2 rows of 8<\/li>\n<li>6 edge-mounted push buttons<\/li>\n<li><a href=\"https:\/\/github.com\/pimoroni\/phat-beat#full-install-recommended\">Software installer<\/a> and ALSA VU meter plugin<\/li>\n<li>5W 4\u03a9 speaker with pre-soldered wires<\/li>\n<li>3-layer blue acrylic enclosure<\/li>\n<li>Pi Zero W with single core CPU and built-in wireless LAN and Bluetooth<\/li>\n<li>Adaptor kit<\/li>\n<li>50cm USB A to micro-B cable (power your Pi from an existing charger or computer)<\/li>\n<li><a href=\"https:\/\/github.com\/pimoroni\/phat-beat\" target=\"_blank\" rel=\"noopener noreferrer\">Python library<\/a><\/li>\n<li><strong>Female and male headers require soldering<\/strong><\/li>\n<\/ul>\n<h2>Software<\/h2>\n<p>Our nifty <a href=\"https:\/\/github.com\/pimoroni\/phat-beat#full-install-recommended\">one-line installer<\/a> will get your pHAT BEAT configured and install our VU meter plugin for ALSA that uses the RGB LEDs on pHAT BEAT to display sound levels.<\/p>\n<p>We&#8217;ve also put together a <a href=\"https:\/\/github.com\/pimoroni\/phat-beat\">Python library<\/a> to allow you to control the LEDs independently, if you wish, and to program the buttons to do whatever you wish.<\/p>\n<h2>Notes<\/h2>\n<p>Assembled size of Pirate Radio is 135x85x70mm (WxHxD).<\/p>\n<\/div>\n<hr \/>\n<\/article>\n<\/div>\n<\/article>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><a href=\"https:\/\/github.com\/pimoroni\/phat-beat\/blob\/master\/phat-beat-logo.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/github.com\/pimoroni\/phat-beat\/raw\/master\/phat-beat-logo.png\" alt=\"pHAT BEAT\" \/><\/a> <a href=\"https:\/\/shop.pimoroni.com\/products\/phat-beat\" rel=\"nofollow\">https:\/\/shop.pimoroni.com\/products\/phat-beat<\/a><\/p>\n<p>Stereo amplifier, buttons and dual RGB VU meter for your Pi.<\/p>\n<h2><\/h2>\n<h2>Installing<\/h2>\n<h3><\/h3>\n<h3>Full install (recommended):<\/h3>\n<p>We&#8217;ve created an easy installation script that will install all pre-requisites and get your pHAT BEAT up and running with minimal efforts. To run it, fire up Terminal which you&#8217;ll find in Menu -&gt; Accessories -&gt; Terminal on your Raspberry Pi desktop, as illustrated below:<\/p>\n<p><a href=\"https:\/\/camo.githubusercontent.com\/1ecd511d9d39bd4624b1207a791aef25357d7e02\/687474703a2f2f6765742e70696d6f726f6e692e636f6d2f7265736f75726365732f6769746875622d7265706f2d7465726d696e616c2e706e67\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/camo.githubusercontent.com\/1ecd511d9d39bd4624b1207a791aef25357d7e02\/687474703a2f2f6765742e70696d6f726f6e692e636f6d2f7265736f75726365732f6769746875622d7265706f2d7465726d696e616c2e706e67\" alt=\"Finding the terminal\" data-canonical-src=\"http:\/\/get.pimoroni.com\/resources\/github-repo-terminal.png\" \/><\/a><\/p>\n<p>In the new terminal window type the command exactly as it appears below (check for typos) and follow the on-screen instructions:<\/p>\n<div class=\"highlight highlight-source-shell\">\n<pre>curl https:\/\/get.pimoroni.com\/phatbeat <span class=\"pl-k\">|<\/span> bash<\/pre>\n<\/div>\n<p>Alternatively, on Raspbian, you can download the <code>pimoroni-dashboard<\/code> and install your product by browsing to the relevant entry:<\/p>\n<div class=\"highlight highlight-source-shell\">\n<pre>sudo apt-get install pimoroni<\/pre>\n<\/div>\n<p>(you will find the Dashboard under &#8216;Accessories&#8217; too, in the Pi menu &#8211; or just run <code>pimoroni-dashboard<\/code> at the command line)<\/p>\n<p>If you choose to download examples you&#8217;ll find them in <code>\/home\/pi\/Pimoroni\/phatbeat\/<\/code>.<\/p>\n<h3><\/h3>\n<h3>Manual install:<\/h3>\n<h4><\/h4>\n<h4>Library install for Python 3:<\/h4>\n<p>on Raspbian:<\/p>\n<div class=\"highlight highlight-source-shell\">\n<pre>sudo apt-get install python3-phatbeat<\/pre>\n<\/div>\n<p>other environments:<\/p>\n<div class=\"highlight highlight-source-shell\">\n<pre>sudo pip3 install phatbeat<\/pre>\n<\/div>\n<h4><\/h4>\n<h4>Library install for Python 2:<\/h4>\n<p>on Raspbian:<\/p>\n<div class=\"highlight highlight-source-shell\">\n<pre>sudo apt-get install python-phatbeat<\/pre>\n<\/div>\n<p>other environments:<\/p>\n<div class=\"highlight highlight-source-shell\">\n<pre>sudo pip2 install phatbeat<\/pre>\n<\/div>\n<h3><\/h3>\n<h3>Development:<\/h3>\n<p>If you want to contribute, or like living on the edge of your seat by having the latest code, you should clone this repository, <code>cd<\/code> to the library directory, and run:<\/p>\n<div class=\"highlight highlight-source-shell\">\n<pre>sudo python3 setup.py install<\/pre>\n<\/div>\n<p>(or <code>sudo python setup.py install<\/code> whichever your primary Python environment may be)<\/p>\n<h2><\/h2>\n<h2>Documentation &amp; Support<\/h2>\n<ul>\n<li>Guides and tutorials &#8211; <a href=\"https:\/\/learn.pimoroni.com\/phat-beat\" rel=\"nofollow\">https:\/\/learn.pimoroni.com\/phat-beat<\/a><\/li>\n<li>Function reference &#8211; <a href=\"http:\/\/docs.pimoroni.com\/phatbeat\/\" rel=\"nofollow\">http:\/\/docs.pimoroni.com\/phatbeat\/<\/a><\/li>\n<li>GPIO Pinout &#8211; <a href=\"https:\/\/pinout.xyz\/pinout\/phat_beat\" rel=\"nofollow\">https:\/\/pinout.xyz\/pinout\/phat_beat<\/a><\/li>\n<li>Get help &#8211; <a href=\"http:\/\/forums.pimoroni.com\/c\/support\" rel=\"nofollow\">http:\/\/forums.pimoroni.com\/c\/support<\/a><\/li>\n<\/ul>\n<h2><\/h2>\n<h2>Third Party Libraries<\/h2>\n<ul>\n<li>Node JS &#8211; <a href=\"https:\/\/github.com\/eminentspoon\/phatbeat-node\">https:\/\/github.com\/eminentspoon\/phatbeat-node<\/a><\/li>\n<\/ul>\n<div class=\"container-lg new-discussion-timeline experiment-repo-nav p-responsive\">\n<div class=\"repository-content \">\n<div class=\"Box mt-3 position-relative\">\n<div id=\"readme\" class=\"Box-body readme blob instapaper_body js-code-block-container\">\n<article class=\"markdown-body entry-content p-3 p-md-6\">\n<hr \/>\n<h2>Easy VLC Radio<\/h2>\n<p>The easy VLC Radio set up is a small pre-built image with all the things needed to make your pHAT BEAT-powered Pirate Radio work out of the box.<\/p>\n<p>It&#8217;s not designed to be highly interactive or customisable, but is great if you want to get a simple radio up and running quickly.<\/p>\n<p>It&#8217;s still in beta testing, but it works well in many cases. Read more about it, and find the latest download link here: <a href=\"https:\/\/forums.pimoroni.com\/t\/piratepython-pirate-radio\/7058\" rel=\"nofollow\">https:\/\/forums.pimoroni.com\/t\/piratepython-pirate-radio\/7058<\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>Raspbian VLC Radio<\/h2>\n<p>This project rolls a VLC radio onto your Pi, complete with controls via the buttons on pHAT BEAT.<\/p>\n<p><a href=\"https:\/\/learn.pimoroni.com\/tutorial\/sandyj\/internet-radio-on-your-pirate-radio\" rel=\"nofollow\">Check out the full tutorial on our learning portal!<\/a><\/p>\n<p><strong>Installing:<\/strong><\/p>\n<p>The recommended way to install this project is using our one-line-installer, as this will ensure the pHAT BEAT is properly set up for playback:<\/p>\n<div class=\"highlight highlight-source-shell\">\n<pre>curl https:\/\/get.pimoroni.com\/vlcradio <span class=\"pl-k\">|<\/span> bash<\/pre>\n<\/div>\n<p>Alternatively, if you are sure you have a working setup and just want to refresh this project to get all the latest improvements, you can run:<\/p>\n<div class=\"highlight highlight-source-shell\">\n<pre>setup.sh<\/pre>\n<\/div>\n<p><strong>Using:<\/strong><\/p>\n<p>After install you should be asked to reboot. If not, reboot \ud83d\ude42<\/p>\n<p>When the VLC Radio is ready to rock, the VU should flash once briefly. Press FF or REV to start playback.<\/p>\n<p>You can also access the VLC server via http on port 8080 if you&#8217;d like to add streams or control playback and volume if you are not right next to the radio (leave username blank and use password <code>raspberry<\/code>).<\/p>\n<p><strong>Playlist:<\/strong><\/p>\n<p>A default playlist is supplied with the project, but you can (and probably will want to) tune in your favorite stations, of course.<\/p>\n<p>You can either create a <code>playlist.m3u<\/code> and drop it in your home folder (in <code>\/home\/pi\/.config\/vlc\/<\/code>), or if you don&#8217;t feel like logging in via ssh you may also drop the <code>playlist.m3u<\/code> in the <code>\/boot<\/code> partition of your SD from another computer and the VLC daemon will copy it in place for your convenience.<\/p>\n<p>Reboot (or restart the <code>vlcd<\/code> service) after editing or creating the file for it to take effect.<\/p>\n<\/article>\n<\/div>\n<p><a href=\"https:\/\/github.com\/pimoroni\/phat-beat\/tree\/master\/projects\/vlc-radio\">https:\/\/github.com\/pimoroni\/phat-beat\/tree\/master\/projects\/vlc-radio<\/a><\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/section>\n<hr \/>\n<p>&nbsp;<\/p>\n<div class=\"col-md-8 article\">\n<h1>Streaming Airplay to your Pi<\/h1>\n<p>We&#8217;ve put together a really easy little installer to set up your Pi as an Airplay speaker, letting you stream music from your iPhone (sorry Android users). The installer gives you the choice of setting it up with support for three of our pHATS &#8211; <a href=\"https:\/\/shop.pimoroni.com\/products\/phat-beat\" target=\"_blank\" rel=\"noopener noreferrer\">pHAT BEAT<\/a>, <a href=\"https:\/\/shop.pimoroni.com\/products\/phat-dac\" target=\"_blank\" rel=\"noopener noreferrer\">pHAT DAC<\/a>, or <a href=\"https:\/\/shop.pimoroni.com\/products\/speaker-phat\" target=\"_blank\" rel=\"noopener noreferrer\">Speaker pHAT<\/a> &#8211; or just with the standard audio through the Pi&#8217;s 3.5mm stereo jack.<\/p>\n<p>This tutorial is perfect for the <a href=\"http:\/\/shop.pimoroni.com\/products\/pirate-radio-pi-zero-w-project-kit\">Pirate Radio Kit<\/a>, or if you want to use our <a href=\"http:\/\/shop.pimoroni.com\/products\/speaker-phat\">Speaker pHAT<\/a> board to give new life to an old radio by wiring it up to the radio&#8217;s existing speaker.<\/p>\n<p>We&#8217;ll cover preparation that&#8217;s needed for each device, and then go through how to run the installer. Note that you&#8217;ll need a keyboard, mouse, and display connected to your Pi for this.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/learn.pimoroni.com\/static\/repos\/learn\/sandyj\/pi-airplay-hires.jpg\" alt=\"\" \/><\/p>\n<h2>Installing Raspbian<\/h2>\n<p>We recommend using the very latest version of Raspbian <strong>Lite<\/strong>, and you&#8217;ll need an internet connection to install the Mopidy packages later. We&#8217;d recommend using either the NOOBS installer, which you can find <a href=\"https:\/\/www.raspberrypi.org\/downloads\/noobs\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> (ensure that you select Raspbian Stretch <strong>Lite<\/strong> when installing), or downloading Stretch Lite from <a href=\"https:\/\/www.raspberrypi.org\/downloads\/raspbian\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> and then using the <a href=\"https:\/\/etcher.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">Etcher<\/a> tool to burn the image to your SD card.<\/p>\n<p>Currently, our airdac installer is best supported by Stretch Lite, and may not work properly in the full version of Raspbian. Because Stretch Lite is&#8230; liter (<em>sic<\/em>) it should also run a bit more snappily than the full Raspbian.<\/p>\n<h2>Using the Pi&#8217;s built-in 3.5mm stereo jack<\/h2>\n<p>If you&#8217;re using the built-in audio on your Pi model B+, 2, or 3, then there&#8217;s no other preparation needed other than popping in your SD card and making sure that you have an internet connection, either from wired ethernet or by connecting to Wi-Fi (more on how to connect to Wi-Fi in Stretch Lite below).<\/p>\n<h2>Using pHAT DAC<\/h2>\n<p>If you&#8217;re using our pHAT DAC board, then you need to solder the 2&#215;20 pin female header (that comes with it) to your pHAT DAC (and also solder a 2&#215;20 pin male header to your Pi Zero or Pi Zero W, if you&#8217;re using one). We have a guide on how to solder headers to pHATs <a href=\"https:\/\/learn.pimoroni.com\/tutorial\/sandyj\/soldering-phats\">here<\/a>.<\/p>\n<h2>Using pHAT BEAT or the Pirate Radio Kit<\/h2>\n<p>If you&#8217;re using the Pirate Radio Kit and haven&#8217;t already built it, then follow our guide <a href=\"https:\/\/learn.pimoroni.com\/tutorial\/sandyj\/assembling-pirate-radio\">here<\/a> to learn how to put it all together.<\/p>\n<p>If you&#8217;re just using pHAT BEAT, then make sure that you&#8217;ve soldered the 2&#215;20 pin female header to it. Again, you can follow our <a href=\"https:\/\/learn.pimoroni.com\/tutorial\/sandyj\/soldering-phats\">guide<\/a> to soldering pHATs. Connect a couple of speakers (or just one) to your pHAT BEAT&#8217;s push fit speaker terminals.<\/p>\n<h2>Using Speaker pHAT<\/h2>\n<p>If you&#8217;re using Speaker pHAT, then follow our guide to soldering it <a href=\"https:\/\/learn.pimoroni.com\/tutorial\/sandyj\/assembling-speaker-phat\">here<\/a>.<\/p>\n<h2>Running the installer<\/h2>\n<p>Just to reiterate, you&#8217;ll need an internet connection to run this installer. Pop the SD card into your Pi, make sure that the audio board that you&#8217;re using is attached to your Pi (on its GPIO pins) if you&#8217;re using one, and then plug in the power and boot up your Pi. Because you&#8217;re using Stretch Lite, your Pi will boot straight to a terminal, but don&#8217;t be scared!<\/p>\n<p>You&#8217;ll need to connect to Wi-Fi. To do this, you need to edit a file called <code>wpa_supplicant.conf<\/code>. Type the following:<\/p>\n<div class=\"codehilite\">\n<pre><code>sudo nano \/etc\/wpa_supplicant\/wpa_supplicant.conf\r\n<\/code><\/pre>\n<\/div>\n<p>Use the arrow keys to move to the bottom of the file, and add the following, replacing the parts that say &#8220;YOUR<em>SSID&#8221; and &#8220;YOUR<\/em>PASSWORD&#8221; with the SSID and password for the Wi-Fi network to which you&#8217;d like to connect.<\/p>\n<div class=\"codehilite\">\n<pre><code><span class=\"n\">country<\/span><span class=\"o\">=<\/span><span class=\"n\">GB<\/span>\r\n<span class=\"n\">ctrl_interface<\/span><span class=\"o\">=<\/span><span class=\"kt\">DIR<\/span><span class=\"o\">=\/<\/span><span class=\"n\">var<\/span><span class=\"o\">\/<\/span><span class=\"n\">run<\/span><span class=\"o\">\/<\/span><span class=\"n\">wpa_supplicant<\/span> <span class=\"n\">GROUP<\/span><span class=\"o\">=<\/span><span class=\"n\">netdev<\/span>\r\n<span class=\"n\">update_config<\/span><span class=\"o\">=<\/span><span class=\"mi\">1<\/span>\r\n\r\n<span class=\"n\">network<\/span><span class=\"o\">=<\/span><span class=\"p\">{<\/span>\r\n<span class=\"n\">ssid<\/span><span class=\"o\">=<\/span><span class=\"s\">\"YOUR_SSID\"<\/span>\r\n<span class=\"n\">psk<\/span><span class=\"o\">=<\/span><span class=\"s\">\"YOUR_PASSWORD\"<\/span>\r\n<span class=\"p\">}<\/span><\/code><\/pre>\n<\/div>\n<p>Once you&#8217;ve made those changes, press <code>control<\/code> and <code>x<\/code>, then <code>y<\/code>, and then <code>enter<\/code> to save and close the file.<\/p>\n<p>Now, type <code>sudo reboot<\/code> and press <code>enter<\/code> to reboot. Your Pi should now be connected to Wi-Fi.<\/p>\n<p>To run the installer, type the following:<\/p>\n<div class=\"codehilite\">\n<pre><code>curl -sS get.pimoroni.com\/airdac <span class=\"p\">|<\/span> bash\r\n<\/code><\/pre>\n<\/div>\n<p>The installer will prompt you several times, and you should type <code>y<\/code> for all of these, with the exception of the device selection. When it prompts you to select a device, then type the number of the device that you&#8217;d like to install. Note that if you&#8217;re using the built-in audio through the 3.5mm jack then you should select option 0 here.<\/p>\n<p>The installer should also ask if you&#8217;d like to reboot once the installation is complete. If it doesn&#8217;t, then restart by typing <code>sudo reboot<\/code> again.<\/p>\n<h2>What the installer does<\/h2>\n<p>The installer will do several things, that you don&#8217;t necessarily have to worry about, so stop reading this section now if that&#8217;s the case!<\/p>\n<p>First, if you&#8217;re using one of our audio boards like pHAT DAC, pHAT BEAT, or Speaker pHAT, then the installer will configure your Pi&#8217;s ALSA audio to route audio out through I2S, the interface used by these boards.<\/p>\n<p>Second, it will install any additional software required, like the software that controls the LEDs on Speaker pHAT and pHAT BEAT. These both use an ALSA audio plugin that actually processes the audio data (using FFT) and displays it on the LEDs. It&#8217;s called <a href=\"https:\/\/github.com\/pimoroni\/pivumeter\" target=\"_blank\" rel=\"noopener noreferrer\">pivumeter<\/a>.<\/p>\n<p>Third and last, it will install the <a href=\"https:\/\/github.com\/mikebrady\/shairport-sync\" target=\"_blank\" rel=\"noopener noreferrer\">shairport-sync<\/a> software that allows you to stream via Airplay to your Pi. This will be set to run at boot, so as soon as the installer is finished and your Pi has rebooted it should automagically appear as an Airplay device.<\/p>\n<h2>Streaming Airplay<\/h2>\n<p>Assuming that worked, you should now be able to stream to your Pi from your iPhone. Start your music playing, and then tap on the Airplay icon and select the device that will have the name &#8220;Raspberrypi&#8221;, unless you have changed the hostname on your Pi.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/learn.pimoroni.com\/static\/repos\/learn\/sandyj\/airplay-renders.jpg\" alt=\"\" \/><\/p>\n<p><em>Note that if you&#8217;re using on of our I2S devices with an amp. (Speaker pHAT or pHAT BEAT), you may hear a slight pop when the device connects and disconnects the audio stream. This is due to the way that the Raspberry Pi and ALSA cut the audio stream when audio is not being output, to prevent overheating of your connected speaker.<\/em><\/p>\n<\/div>\n<hr \/>\n<p>&nbsp;<\/p>\n<div class=\"col-md-8 article\">\n<h1>Streaming Spotify to your Pi<\/h1>\n<p>This tutorial will guide you through all the steps necessary to stream Spotify to your Pi, using <a href=\"https:\/\/docs.mopidy.com\/en\/latest\/\" target=\"_blank\" rel=\"noopener noreferrer\">Mopidy<\/a>, <a href=\"https:\/\/github.com\/mopidy\/mopidy-spotify\" target=\"_blank\" rel=\"noopener noreferrer\">Mopidy-Spotify<\/a>, and the <a href=\"https:\/\/github.com\/jaedb\/iris\" target=\"_blank\" rel=\"noopener noreferrer\">Iris<\/a> web interface. The end result will be a streaming Spotify box that you can control remotely from another computer in your house or from your phone (Android or iOS) or tablet.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/learn.pimoroni.com\/static\/repos\/learn\/sandyj\/streaming-spotify-to-your-pi-1.jpeg\" alt=\"\" \/><\/p>\n<p>We&#8217;ve put together a neat little one-line-installer to make this whole process really easy, but we&#8217;ll also explain what it does later, because you wouldn&#8217;t be learning otherwise, huh?<\/p>\n<p>It will work either with the built-in 3.5mm stereo jack on your Pi model B+, 2, or 3, or with our audio boards &#8211; <a href=\"https:\/\/shop.pimoroni.com\/products\/phat-beat\" target=\"_blank\" rel=\"noopener noreferrer\">pHAT BEAT<\/a>, <a href=\"https:\/\/shop.pimoroni.com\/products\/phat-dac\" target=\"_blank\" rel=\"noopener noreferrer\">pHAT DAC<\/a>, or <a href=\"https:\/\/shop.pimoroni.com\/products\/speaker-phat\" target=\"_blank\" rel=\"noopener noreferrer\">Speaker pHAT<\/a>. It&#8217;s also perfect for the <a href=\"https:\/\/shop.pimoroni.com\/products\/pirate-radio-pi-zero-w-project-kit\" target=\"_blank\" rel=\"noopener noreferrer\">Pirate Radio Kit<\/a>, turning it into a neat little streaming audio box.<\/p>\n<p>Note that you&#8217;ll need a <a href=\"https:\/\/www.spotify.com\/uk\/premium\/?checkout=false\" target=\"_blank\" rel=\"noopener noreferrer\">Spotify Premium<\/a> account for this, although you <em>can<\/em> use this setup to play local music files, like MP3s, as well.<\/p>\n<p>We recommend using the very latest version of Raspbian <strong>Lite<\/strong>, and you&#8217;ll need an internet connection to install the Mopidy packages later (we&#8217;ll explain how to do that in Raspbian Lite below). We&#8217;d recommend using either the NOOBS installer, which you can find <a href=\"https:\/\/www.raspberrypi.org\/downloads\/noobs\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> (ensure that you select Raspbian Stretch <strong>Lite<\/strong> when installing), or downloading Stretch Lite from <a href=\"https:\/\/www.raspberrypi.org\/downloads\/raspbian\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> and then using the <a href=\"https:\/\/etcher.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">Etcher<\/a> tool to burn the image to your SD card.<\/p>\n<p>Currently, our spotipy installer is best supported by Stretch Lite, and may not work properly in the full version of Raspbian. Because Stretch Lite is&#8230; liter (<em>sic<\/em>) it should also run a bit more snappily than the full Raspbian.<\/p>\n<h2>Using the Pi&#8217;s built-in 3.5mm stereo jack<\/h2>\n<p>If you&#8217;re using the built-in audio on your Pi model B+, 2, or 3, then there&#8217;s no other preparation needed.<\/p>\n<h2>Using pHAT DAC<\/h2>\n<p>If you&#8217;re using our pHAT DAC board, then you need to solder the 2&#215;20 pin female header (that comes with it) to your pHAT DAC (and also solder a 2&#215;20 pin male header to your Pi Zero or Pi Zero W, if you&#8217;re using one). We have a guide on how to solder headers to pHATs <a href=\"https:\/\/learn.pimoroni.com\/tutorial\/sandyj\/soldering-phats\">here<\/a>.<\/p>\n<p>Pop the pHAT DAC onto your Pi&#8217;s GPIO pins.<\/p>\n<h2>Using pHAT BEAT or the Pirate Radio Kit<\/h2>\n<p>If you&#8217;re using the Pirate Radio Kit and haven&#8217;t already built it, then follow our guide <a href=\"https:\/\/learn.pimoroni.com\/tutorial\/sandyj\/assembling-pirate-radio\">here<\/a> to learn how to put it all together.<\/p>\n<p>If you&#8217;re just using pHAT BEAT, then make sure that you&#8217;ve soldered the 2&#215;20 pin female header to it. Again, you can follow our <a href=\"https:\/\/learn.pimoroni.com\/tutorial\/sandyj\/soldering-phats\">guide<\/a> to soldering pHATs. Connect a couple of speakers (or just one) to your pHAT BEAT&#8217;s push fit speaker terminals.<\/p>\n<p>Pop the pHAT BEAT onto your Pi&#8217;s GPIO pins, if you haven&#8217;t already.<\/p>\n<h2>Using Speaker pHAT<\/h2>\n<p>If you&#8217;re using Speaker pHAT, then follow our guide to soldering it <a href=\"https:\/\/learn.pimoroni.com\/tutorial\/sandyj\/assembling-speaker-phat\">here<\/a>.<\/p>\n<p>Pop the Speaker pHAT onto your Pi&#8217;s GPIO pins.<\/p>\n<h2>Running the installer<\/h2>\n<p>Just to reiterate, you&#8217;ll need an internet connection to run this installer. Pop the SD card into your Pi, make sure that the audio board that you&#8217;re using is attached to your Pi (on its GPIO pins) if you&#8217;re using one, and then plug in the power and boot up your Pi. Because you&#8217;re using Stretch Lite, your Pi will boot straight to a terminal, but don&#8217;t be scared!<\/p>\n<p>You&#8217;ll need to connect to Wi-Fi. To do this, you need to edit a file called <code>wpa_supplicant.conf<\/code>. Type the following:<\/p>\n<div class=\"codehilite\">\n<pre><code>sudo nano \/etc\/wpa_supplicant\/wpa_supplicant.conf\r\n<\/code><\/pre>\n<\/div>\n<p>Use the arrow keys to move to the bottom of the file, and add the following, replacing the parts that say &#8220;YOURSSID&#8221; and &#8220;YOURPASSWORD&#8221; with the SSID and password for the Wi-Fi network to which you&#8217;d like to connect.<\/p>\n<div class=\"codehilite\">\n<pre><code><span class=\"n\">country<\/span><span class=\"o\">=<\/span><span class=\"n\">GB<\/span>\r\n<span class=\"n\">ctrl_interface<\/span><span class=\"o\">=<\/span><span class=\"kt\">DIR<\/span><span class=\"o\">=\/<\/span><span class=\"n\">var<\/span><span class=\"o\">\/<\/span><span class=\"n\">run<\/span><span class=\"o\">\/<\/span><span class=\"n\">wpa_supplicant<\/span> <span class=\"n\">GROUP<\/span><span class=\"o\">=<\/span><span class=\"n\">netdev<\/span>\r\n<span class=\"n\">update_config<\/span><span class=\"o\">=<\/span><span class=\"mi\">1<\/span>\r\n\r\n<span class=\"n\">network<\/span><span class=\"o\">=<\/span><span class=\"p\">{<\/span>\r\n<span class=\"n\">ssid<\/span><span class=\"o\">=<\/span><span class=\"s\">\"YOURSSID\"<\/span>\r\n<span class=\"n\">psk<\/span><span class=\"o\">=<\/span><span class=\"s\">\"YOURPASSWORD\"<\/span>\r\n<span class=\"p\">}<\/span>\r\n<\/code><\/pre>\n<\/div>\n<p>Once you&#8217;ve made those changes, press <code>control<\/code> and <code>x<\/code>, then <code>y<\/code>, and then <code>enter<\/code> to save and close the file.<\/p>\n<p>Now, type <code>sudo reboot<\/code> and press <code>enter<\/code> to reboot. Your Pi should now be connected to Wi-Fi.<\/p>\n<p>To run the installer, type the following:<\/p>\n<div class=\"codehilite\">\n<pre><code>curl https:\/\/get.pimoroni.com\/spotipy <span class=\"p\">|<\/span> bash\r\n<\/code><\/pre>\n<\/div>\n<p>You&#8217;ll need you Spotify username and password handy for this part. The installer will ask you to enter your username and password and will use this to configure the Mopidy-Spotify plugin. Note that your username and password will be stored in plain text so it&#8217;s a good idea, for safety&#8217;s sake, to have a unique password (i.e. to make sure it isn&#8217;t the same as any other passwords that you use), and that you don&#8217;t have any open, insecure ports on your local area network.<\/p>\n<p>The installer will prompt you several times, and you should type <code>y<\/code> for all of these, with the exception of the device selection. When it prompts you to select a device, then type the number of the device that you&#8217;d like to install. Note that if you&#8217;re using the built-in audio through the 3.5mm jack then you should select option 0 here.<\/p>\n<p>The installer should also ask if you&#8217;d like to reboot once the installation is complete. If it doesn&#8217;t, then restart by typing <code>sudo reboot<\/code> again.<\/p>\n<h2>What the installer does<\/h2>\n<p>If you&#8217;re not concerned with what the installer does, then stop reading this section now! If you are, then read on! It&#8217;s good to know exactly what it does in case you want to pull down our installer script and modify it for your own purposes (which you&#8217;re very welcome to do!)<\/p>\n<p>Our installer installs Mopidy, and a bunch of plugins to add functionality to it. Mopidy is a network music server, that allows you to stream music over your local network or, in this case, from internet music sources like Spotify.<\/p>\n<p>Here, we&#8217;re using Spotify as our music source, so we&#8217;re installing the Mopidy-Spotify plugin, which allows you to play songs, albums, playlists, and your own saved music on Spotify.<\/p>\n<p>The Mopidy-ALSAMixer plugin allows you to control the system volume level straight from Mopidy, and will also allow us to hook it into our physical buttons on pHAT BEAT (if you&#8217;re using it).<\/p>\n<p>The physical buttons on pHAT-BEAT are hooked up straight to the GPIO on your Pi. There&#8217;s a handy Mopidy plugin called Mopidy-TTSGPIO that lets you assign functions to buttons connected to GPIO pins; functions like play\/pause, forward, back, volume up and down, and shutdown. Fortunately, the buttons on pHAT BEAT and the front panel on Pirate Radio are labelled up with those exact functions!<\/p>\n<p>As well as allowing the use of GPIO-linked buttons, this plugin also allows text-to-speech to announce track and playlist names, and to confirm button presses, amongst other things, although we don&#8217;t enable this as part of the installer script.<\/p>\n<p>The Iris web front-end provides a really slick-looking interface to control your Pi running Mopidy. It caters specifically for Spotify, so it&#8217;s set up with menu options for playlists and latest releases, etc. If you&#8217;re not using Spotify and instead are using local music, then it might be best to look into one of the other Mopidy web front-ends.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/learn.pimoroni.com\/static\/repos\/learn\/sandyj\/streaming-spotify-to-your-pi-2.jpeg\" alt=\"\" \/><\/p>\n<p>Our installer will also install and configure the software for your chosen music output device, be it pHAT DAC, pHAT BEAT, Speaker pHAT, or just the Pi&#8217;s built-in audio.<\/p>\n<p>As we mentioned previously, the installer adds your Spotify credentials to the Mopidy configuration file (<code>\/etc\/mopidy\/mopidy.conf<\/code>). It also enables the appropriate plugins mentioned earlier, sets up the correct functions for the buttons on pHAT BEAT (if you&#8217;re using it), and makes the Pi&#8217;s IP address visible on your local area network, so that you can control it remotely on your PC\/Mac\/phone\/tablet via the web front-end.<\/p>\n<p>Lastly, it runs Mopidy as a system service, meaning that it will fire everything up automatically when your Pi boots.<\/p>\n<h2>Booting for the first time, and using Mopidy<\/h2>\n<p>As we said, now that everything is installed and set up, Mopidy should fire itself up when your Pi boots. If your Pi rebooted after the installer ran, then Mopidy may well be running already! It takes a couple of minutes to fire everything up, and maybe a little longer on a Pi Zero or Pi Zero W, so once you&#8217;ve plugged the power into your Pi, or rebooted it, then wait for a few minutes before following the steps below.<\/p>\n<p>You&#8217;ll need to know your Pi&#8217;s IP address to access the web front-end remotely. If you have a display and keyboard attached to your Pi (we&#8217;ll assume you do, since you ran the installer), then type <code>ifconfig<\/code> in the terminal to find your IP address. If this is the only Raspberry Pi on your network, and you haven&#8217;t changed the hostname of your Pi, then you will be able to use <code>raspberrypi.local<\/code> instead of the IP address.<\/p>\n<p>Open a browser window on your PC\/Mac\/phone\/tablet and enter the following URL:<\/p>\n<pre><code>http:\/\/192.168.0.2:6680\/iris\/\r\n<\/code><\/pre>\n<p>where <code>192.168.0.2<\/code> is the IP address of your Pi, or if you&#8217;re going to use <code>raspberrypi.local<\/code> then enter:<\/p>\n<pre><code>http:\/\/raspberrypi.local:6680\/iris\/\r\n<\/code><\/pre>\n<p>Your browser should have loaded up the Iris web interface. It&#8217;s fairly self- explanatory to navigate, but one <strong>important<\/strong> thing you&#8217;ll have to do is to go to the settings page and log in to Spotify, to authorise it, if it&#8217;s the first time you&#8217;re using it.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/learn.pimoroni.com\/static\/repos\/learn\/sandyj\/streaming-spotify-to-your-pi-3.jpeg\" alt=\"\" \/><\/p>\n<p>Click &#8220;log in&#8221;, and it should pop up a new window to authorise Spotify. If it doesn&#8217;t, then you might need to switch off any pop-up blockers that might be active. Now that you&#8217;ve authorised Spotify, you should have access to your playlists, and saved albums and artists, featured Spotify playlists, and more.<\/p>\n<p>Because Iris is responsive, it looks really good on mobile as well, resizing and changing context to work on smaller displays. And because it&#8217;s just a regular web front-end it will work equally well in iOS or Android.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/learn.pimoroni.com\/static\/repos\/learn\/sandyj\/streaming-spotify-to-your-pi-4.jpeg\" alt=\"\" \/><\/p>\n<p>With the Mopidy-TTSGPIO installed and active, you should be able to use the buttons along the side of pHAT BEAT to control your music. Try them!<\/p>\n<h2>Taking it further<\/h2>\n<p>Why not try some of the Mopidy web <a href=\"https:\/\/docs.mopidy.com\/en\/latest\/ext\/web\/\" target=\"_blank\" rel=\"noopener noreferrer\">front-ends<\/a>, or some of the <a href=\"https:\/\/docs.mopidy.com\/en\/latest\/ext\/backends\/\" target=\"_blank\" rel=\"noopener noreferrer\">other plugins<\/a> to use services like Google Play Music, SoundCloud, TuneIn radio, and YouTube. Or try to add an <a href=\"https:\/\/shop.pimoroni.com\/search?type=product&amp;q=oled\" target=\"_blank\" rel=\"noopener noreferrer\">OLED display<\/a> to show track and artist information? You could try to make your Pi music player Twitter or Slack controlled, turning it into a collaborative music player!<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>pimoroni-dashboard On Raspbian, you can download the pimoroni-dashboard and install your product by browsing to the relevant entry: sudo apt-get install pimoroni (you will find the Dashboard under &#8216;Accessories&#8217; too, in the Pi menu &#8211; or just run pimoroni-dashboard at the command line) If you choose to download examples you&#8217;ll find them in \/home\/pi\/Pimoroni\/phatbeat\/. Pirate&#8230;<\/p>\n","protected":false},"author":1,"featured_media":586,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6],"tags":[],"class_list":["post-580","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-to-s","category-linux"],"_links":{"self":[{"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/posts\/580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=580"}],"version-history":[{"count":6,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/posts\/580\/revisions"}],"predecessor-version":[{"id":587,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/posts\/580\/revisions\/587"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/media\/586"}],"wp:attachment":[{"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=580"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}