Software apps and online services
Hand tools and fabrication machines
While making travel plans for the year, I thought it would be really nice to have the single, smallest possible music player to take along. Something that does it all - play from NAS or all my music direct from the device; be able to play on a long flight or walking around; hook up to a powered speaker for a (semi-) stationary player. You can even play Spotify! And do AirPlay!
Yep, you can do all this from a phone. But, I had about 100GB of music, and I enjoy total control of it.
So, the Volumio Mini Player was born. Well, "started gestation"... It took a while to think through what I really wanted. I gradually settled on the following features.
- Run on a Raspberry Pi Zero W
- Use the popular and powerful Volumio, open-source media software
- Be able to use headphones or line-out
- Have a nice screen to show Now Playing, Volume, Play Duration
- Buttons for volume up/down
- 5-way navigation switch to offer Prev-Next Song, Pause-Play, Shutdown
Cost: About $60 USD, not including 3D print. Does not include the cost of microSD card.
SkillLevel: Easy! Some soldering is required for long stacking headers on an un-populated raspberry pi zero W
Effort: About 3 hours for assembly and configuration. 3D print times about 2.5 hours for top/case/button extenders
The contributions from the Volumio and NanoMesher teams were critical to this project. Please support these folks!
The stacking headers, JustBoom DAC and Adafruit OLED Bonnet work together well, keeping the whole stack compact. This works because both the JustBoom DAC and OLED Bonnet have pass-through SMD female headers. Solder the long, male stacking headers onto an unpopulated raspberry pi Zero W. Make sure the headers are level to the board and straight up-and-down. Once the long male headers are soldered, no other soldering is required! Merely push down the DAC followed by the Bonnet onto the stacking headers.
3D Print Files: download from thingiverse
I printed the 3D components of the case in 3 separate prints, Top/Cover (1 hr), Bottom (1.5 hr) and Button Extensions (15 min). The Top & Bottom I printed with no supports, only a skirt. The Button Extensions, because they were so small, printed on a Raft.
You may have to do a little clean-up work with the hole for the 5-way switch, to enlarge it so it doesn't bind when mounted in the Top/Cover. Also, there's a tiny pin-hole on the front of the case next to the power micro USB connector. This is a port to the ACT LED. This shows when the raspberry pi Zero is completely shutdown (10 blinks, then out), so you can remove power. However, it's verysmall, so you may want to enlarge it a bit. On each of the 5-way and ACT hole, touch up with an Xacto knife or similar sharp/pointed object. The Headphone and Line-Out holes may also need a little touch-up. Because these holes are printed vertically, they tend to be oblate, a little squashed at top and bottom.
Test fit the Top/Cover to make sure it snaps on well. This may take a little work. If it doesn't snap on easily, try pushing the Bottom/Case side in and push the Top/Cover down firmly at the same time.
- Thread short screws into mount holes
- Press stack into case holes firmly
- Screw long screws through board stack into mounts. DON'T over-tighten, especially if using 20mm screws - that will break the mounts. For 20mm screws, leave about 2mm high.
- Insert button extensions into holes from inside the Cover. Hold extensions in place, flip the Cover over and apply tape to hold the extensions in place.
- Slide Cover over 5-way switch and snap that end into place. Continue snapping down all sides.
- Remove button extension tape when done.
Check that the button extensions move freely, don't bind. You may have to clean up either the shaft of the extension, or the hole, to get good movement. Don't remove too much!
Download the software from the Volumio Getting Started page. Use the instructions for Flashing, choosing your favorite operating system. Follow along on the Getting Started page to the "Prepare It" section. But, you won't be using an Ethernet cable to connect to Volumio as it says. Once the software is loaded on your microSD card, insert into the pi Zero and boot up.
On boot, Volumio will start a WiFi hotspot/hostap. This can take about 6-8 minutes, so be patient! You then connect to the hotspot from a WiFi enabled computer, tablet or phone. On your device connected to the hotspot, go to the volumio.local web page, as described in the "Connect to It" section, to complete set up. You can connect to your own LAN later on in the setup from the web page.
Once you connect, Volumio will walk you through the remaining setup via a "first time wizard". There are 6 steps to get started. Additional required plugin configuration steps follow after the setup is complete.
- Select your Language
- Name your player/device
- Choose "NanoSound DAC" from the pull-down list. That's correct - Nanosound DAC. This will work with the JustBoom DAC as well as the NanoSound Plugin set up later.
- Set up your local WiFi Credentials
- Optional: Add your local music source/NAS
- Done with inital Setup!
Volumio has optional 3rd-party tools, called plugins, that allow more customization. The user interface for the Volumio Mini Player requires the NanoSound and GPIO plugins. These power the screen and buttons/5-way navigation switch, respectively.
To install the NanoSound Plugin:
- Click on the Settings (gear) in the upper-right corner
- Choose Plugins
- Choose Accessories/Search Plugins
- Click Install on NanoSound by Nanomesher
Then, you call follow along from the NanoSound Support page/Method1 to complete the installation. Most important: remember to Enable the plugin! Go to System/Plugins/Installed and set the switch ON.
To configure the GPIO buttons:
- Click on Settings/Plugins
- Choose System Tools/Search Plugins
- Click on GPIO Buttons
Enter and save the following values:
- Play/pause: 22
- Volume +: 6
- Volume -: 5
- Prev: 27
- Next: 23
- Shutdown: 4
Also remember to Save the GPIO Plugin values.
Go to volumio System/Shutdown/Restart. If all is correct when the system completes reboot, you will see a screen similar to above, displaying volumio's local IP address from your WiFi system (not the volumio hotspot). Make note of this address, needed for more configuration changes. We'll use ssh for that.
To enable an ssh connection on volumio:
- in your computer browser, enter: volumio.local/dev
- click the enable button under SSH
If you are running Windows, download the putty terminal emulator to connect to volumio with SSH. Use the IP address you saved from the NanoSound startup screen. In either Windows, Linux or Mac, connect to volumio using:
userid: volumio password: volumio
Next, do this to set the pullup on the GPIO pins that are being used for buttons/5-way Navigation:
#To set required GPIO pins: sudo nano /etc/rc.local #Insert the following before exit 0 # Set GPIO needed for 5-way Navigation Switch gpio -g mode 22 up # Down: Pause/Play gpio -g mode 23 up # Right: Next Song gpio -g mode 27 up # Left: Prev Song # The following GPIO are needed but are set Up by default # gpio 4: Center 5-way switch pushed straight down = SHUTDOWN # gpio 5: Button 5 (lower button "A") = Volume Down # gpio 6: Button 6 (upper button "B") = Volume Up
Reboot again, to run the pullups.
Note: The pullups will be effective immediately if you run each one from the command line, saving you a reboot:
gpio -g mode 22 up
...and so on, for 22, 23 and 27
The photo above shows the positions and functions of the 5-way Navigation switch and Volume buttons.
You can plug in headphones to the black jack or an audio line out to the green jack from the JustBoom DAC.
To check that the user interface is working properly, go to volumio.local from a browser. Use the Browse tab to pick a music source. If you don't have one set up, try a Web Radio.
Here, I searched for a Classical radio station called KDFC, clicking on it's 3-dot control to add it to the play queue. Alternatively, you could just click on Play to start playing. Click on the Playback tab to see the volume controls. Try the physical up/down volume control buttons and watch the volume indicator change on the Playback screen.
The Playback browser screen updates almost instantly. The OLED screen can take up to 2-3 seconds to react to a change, such as volume up or down.
To change the Volume Steps, how much the volume changes at one time, go to Settings/Playback and scroll down to Volume Options. Change the value for "One Click Volume Steps".
Of course, you can still control volumio through its web page, too! Just point your browser at the IP address from the startup screen or volumio.local. It may take a moment to refresh.
You can also use AirPlay. Volumio makes AirPlay available automatically. On your IOS device (using IOS 11 here):
- Thumb-up the Control Center
- Click on your music source; click on the AirPlay icon in the upper-right corner
- Pick your volumio device
Large Music Collection
On first boot, volumio will resize the file system to use the available space on the micro-SD card. All available space will be added to partition #3, the data partition which has the INTERNAL folder for local music. I used a 128GB microSD card. Resizing this large a card will take a very long time.
For the Impatient: Gparted
I originally installed volumio on a 16GB card. I then created a disk image backup file on my computer, using that as the source. I restored that *.img file to my target 128GB card using a USB card reader. This step does take a long time, mine was 50 minutes - be patient. Finally, I expanded partition #3 with the gparted tool. While that sounds like a lot of work, it only took about 15 minutes to expand.
The following shows how to do this in Linux. For Windows, Pi Hut has a good set of instructions.
- Create an *.img backup of the volumio install disk, where sdX is the device name of the SD card in your USB card reader
- Restore it to a larger (128gb) card
Note: There's no number after sdX, which means it writes from/to the entire SD card. Also, you need to have enough disk space on your computer to hold the file (*,img).
# From your source microSD card: sudo # sudo
- use gparted on your computer to expand the data partition to use the unallocated space - see the gallery above for gparted steps to expand file space
Volumio exposes a folder called Internal Storage as a Windows share. You can browse to this folder and save music to it over the network.
However, for moving a large number of songs, that can be quite slow. If you have your music on a computer with a USB-3 port and a USB-3 micro-SD card reader, it is faster to move it from computer to SD card. In Linux, the mount point would be something like:
It took about 50 minutes to load 100GB of music onto the microSD card using a USB-3 card reader connected to my computer with the music library.
Take it on the Road
Early in the project, I considered an all-in-one case that would house the board stack, a LiPo battery and battery charger. That would be nice for an "everyday carry" device. But, it would also make the device very thick and not that "pocketable". Besides that, adding a battery charger and LiPo battery could increase the project cost by as much as $35 USD more, and I wanted to keep the cost down.
Keeping the device as thin as possible and using a mass-produced battery bank seemed like a better alternative. I settled on the Anker PowerCore+ Mini, as of this writing about $16.99 USD for black, 3350mAh. This was more versatile for my use case - I could hook it up to the Volumio Mini Music Player when I wanted to carry/take it around, or I could just throw it in my messenger bag and use it for recharging my other devices.
I did a run-down test of the PowerCore+ by continuously playing a very large playlist, while hooked up to a portable speaker. The PowerCore+ uses different colored LEDs to indicate power remaining on the unit. It played for about 7.5 hours before the LEDs indicated between 50% to 20% power. I likely could have played much longer without recharging. Good enough!
And, though two pieces and not all that small, the Music Player and PowerCore+ combination fits in my pants pocket.
In the end, I achieved my goal of a small, versatile device that I can take on a hike or an airplane; play by the pool; take camping; play on the commuter train; quickly set up in a hotel room, connected to WiFi or not; play my music collection or stream.