Software Installation | Configure Kiosk mode | Configure RFID playback control | Parts list & Links
DIY Audio Player project based on Raspberry PI and Volumio using Touch Display and RFID tags for playback control.
What I wanted to achieve:
- Easy handling
- Good audio playback
- Great Kid Acceptance Factor (because this thing is going to be placed in our kids’ room)
Why I decided to make, not buy:
- Operating without smartphone or tablet is mandatory
- Fun
Features:
- Play music stored on Audio Player
- Play music stored on Network Attached Storage
- Web Radio playback
- Playback control using RFID tags
- ...
The player consists of these components:
- Raspberry Pi 3
- Raspberry Pi Touch Display
- Adafruit Stereo Audio Amplifier
- USB-DAC
- USB-RFID Reader
- External power supply unit (PSU)
- Internal voltage regulator module (VRM)
- Mass separation filter (ground loop isolator)
For the player’s enclosure I recycled a mini-computer case and added some wood.
- Flash Volumio to SD Card
- Prepare Volumio
- Attach Ethernet to Raspberry Pi
- Insert SD Card into Raspberry Pi
- Power on
- Open Volumio using Webbrowser
http://volumio.local/
- Configure Playback/Output
- Select 'USB: Codec'
- Configure Network
- Select Wireless Network
- Disable Hotspot
- Install Software
- Open Volumio/Dev using Webbrowser
http://volumio.local:3000/dev/
- Enable ssh
- Connect to Volumio using SSH
ssh -l volumio volumio.local
- Install System
- Install LXDE
- Install Chromium
- Install unclutter
- Install volumio-hid
- Install volumio-diy
- Configure System
- Reboot system
reboot
- Open Volumio/Dev using Webbrowser
- Configure Kiosk mode
- Configure Desktop
- Configure Autostart
- Reboot system
reboot
- Configure RFID playback control
Update packages list:
root@volumio.local:~#
apt-get update
apt-get -y install apt-utils apt-show-versions
Install additional locales (if needed):
root@volumio.local:~#
apt-get -y install locales
dpkg-reconfigure locales
Install essential tools:
root@volumio.local:~#
apt-get -y install man-db vim screen
Install packages needed to build from source:
root@volumio.local:~#
apt-get -y install build-essential
apt-get -y install libx11-dev libxi-dev libev-dev
apt-get -y install --no-install-recommends asciidoc libxml2-utils xsltproc docbook-xsl
Add Raspberry Pi Foundation APT repository for Raspbian:
root@volumio.local:~#
vim /etc/apt/sources.list
deb http://archive.raspberrypi.org/debian/ jessie main
deb-src http://archive.raspberrypi.org/debian/ jessie main
root@volumio.local:~#
wget http://archive.raspberrypi.org/debian/raspberrypi.gpg.key -O - | sudo apt-key add -
apt-get update
LXDE is a desktop environment build upon the X Window System. This uses LightDM as X display manager. LXDE will be used to run a web browser to present the user interface of Volumio in Kiosk mode.
Install xserver, lxde, lightdm:
root@volumio.local:~#
apt-get -y install --no-install-recommends xserver-xorg xutils
apt-get -y install --no-install-recommends lxde-core lxappearance
apt-get -y install --no-install-recommends lightdm
Configure display manager for autologin:
root@volumio.local:~#
vim /etc/lightdm/lightdm.conf
autologin-user=volumio
Chromium is a web browser. Chromium will be used to present the user interface of Volumio in Kiosk mode.
Install fake packages for kernel, bootloader and pi lib:
root@volumio.local:~#
wget http://repo.volumio.org/Volumio2/Binaries/arm/libraspberrypi0_0.0.1_all.deb
wget http://repo.volumio.org/Volumio2/Binaries/arm/raspberrypi-bootloader_0.0.1_all.deb
wget http://repo.volumio.org/Volumio2/Binaries/arm/raspberrypi-kernel_0.0.1_all.deb
dpkg -i libraspberrypi0_0.0.1_all.deb
dpkg -i raspberrypi-bootloader_0.0.1_all.deb
dpkg -i raspberrypi-kernel_0.0.1_all.deb
echo "libraspberrypi0 hold" | dpkg --set-selections
echo "raspberrypi-bootloader hold" | dpkg --set-selections
echo "raspberrypi-kernel hold" | dpkg --set-selections
Fake packages are needed because Volumio forbids to install packages which will modify firmware files on boot partition.
Install chromium-browser:
root@volumio.local:~#
apt-get -y install --no-install-recommends chromium-browser
unclutter is a utility to hide the mouse cursor (which is not needed for the touch display). unclutter-fixes is a rewrite of the original unclutter.
This installs unclutter-fixes build from source.
Clone unclutter-fixes:
root@volumio.local:~#
git clone https://github.com/Airblader/unclutter-xfixes
Install unclutter-fixes:
root@volumio.local:~/unclutter-xfixes#
make
make install
volumio-hid is a python script for integration of the rfid reader with Volumio.
Install Python 3:
root@volumio.local:~#
apt-get -y install python3 python3-setuptools python3-venv python3-dev
easy_install3 pip
Create virtual environment for volumio-hid:
volumio@volumio.local:~$
mkdir /home/volumio/.pyenv
python3 -m venv /home/volumio/.pyenv/volumio-hid
source /home/volumio/.pyenv/volumio-hid/bin/activate
pip3 install evdev
pip3 install pyyaml
pip3 install socketIO-client
Clone volumio-hid:
volumio@volumio.local:~$
git clone https://github.com/edmw/volumio-hid.git
volumio-diy is this documentation and a set of configuration files to run this audio player.
Clone volumio-diy:
root@volumio.local:~#
git clone https://github.com/edmw/volumio-diy.git
Install volume-hid service:
root@volumio.local:~#
cp /root/volumio-diy/FILES/HID.service /lib/systemd/system/volumio-hid.service
chmod 664 /lib/systemd/system/volumio-hid.service
root@volumio.local:~#
vim /boot/config.txt
gpu_mem=128
NOOP
This sets the screensaver to go blank after 3 minutes and turn off the display after 5 minutes, disables the desktop panel and the file manager application, starts unclutter to hide the mouse cursor and, finally, starts the web browser in kiosk mode.
volumio@volumio.local:~$
mkdir -p .config/lxsession/LXDE
vim ~/.config/lxsession/LXDE/autostart
xset s blank
xset s 180
xset dpms 0 0 300
@unclutter --timeout 0
@chromium-browser --kiosk --no-first-run --noerrdialogs --enable-touch-events --disable-touch-editing --disable-3d-apis --disable-breakpad --disable-crash-reporter --disable-infobars --disable-session-crashed-bubble --disable-translate http://localhost:3000/
RFID playback control works with RFID readers which present themselves as USB HID keyboard device. That is, it just types out the characters it reads.
volumio-hid uses a configuration which has to be adapted for the specific RFID reader and the specific RFID tags used. Some RFID tags can be mapped to playback control commands like play, stop, next and more. All other RFID tags will be used to try start playing a playlist named exactly after the serial of the tag.
- Connect USB-RFID reader
- Find the correct device file for the reader
/dev/input/by-id/usb-13ba_Barcode_Reader-event-kbd
- Adapt service configuration to use correct device file
vim ~/volumio-hid/HID.conf
Configure volume-hid service:
root@volumio.local:~#
usermod -a -G input volumio
systemctl daemon-reload
systemctl enable volumio-hid.service
systemctl start volumio-hid.service
Check status of volumio-hid service:
root@volumio.local:~#
systemctl status volumio-hid.service
● volumio-hid.service - volumio-hid Service
Loaded: loaded (/lib/systemd/system/volumio-hid.service; enabled)
Active: active (running) since Thu 2016-12-29 18:42:26 UTC; 12s ago
Docs: https://github.com/edmw/volumio-hid
Main PID: 2016 (python)
CGroup: /system.slice/volumio-hid.service
└─2016 /home/volumio/.pyenv/volumio-hid/bin/python /home/volumio/volumio-hid/HID.py
Dec 29 18:42:26 volumio systemd[1]: Started volumio-hid Service.
Dec 29 18:42:28 volumio <1031>VOLUMIO-HID[2016]: [Volumio] Connect to 'localhost:3000'
Dec 29 18:42:28 volumio <1031>VOLUMIO-HID[2016]: [RFID] Get HID device at '/dev/input/by-id/usb-13ba_Barcode_Reader-event-kbd'
Dec 29 18:42:28 volumio <1031>VOLUMIO-HID[2016]: [RFID] Grab HID device 'Barcode Reader '
Dec 29 18:42:28 volumio <1030>VOLUMIO-HID[2016]: Clearance ...
Adapt for specific RFID tags:
volumio-hid uses specific RFID tags to perform playback control commands like play, stop, next and more. The serials of these tags must be specified in the configuration of the service.
- Ensure service is running with debugging enabled
vim ~/volumio-hid/HID.conf
- Restart service
sudo systemctl restart volumio-hid.service
- Watch syslog for debugging output of service
sudo journalctl -f | grep "VOLUMIO-HID"
- Scan specific RFID tags and read the serials from syslog
[RFID] Received serial 'XXXXXXXXX' from reader
- Adapt service configuration to use specific RFID tags (and disable debug mode)
vim ~/volumio-hid/HID.conf
- Restart service
sudo systemctl restart volumio-hid.service
List of used parts
- Raspberry Pi 3 Model B
- Raspberry Pi Touch Display
- Behringer U-Control UCA222 USB Audio Interface
- Adafruit Stereo 20W Class D Audio Amplifier
- PAC SNI-1/3.5 Ground Loop Noise Isolator
- RFID Card Reader and Cards
- Toggle Switch and Missile Switch Cover
- Speaker Connector
- Cables
- Power Supply Micro USB Cable (for Raspberry Pi)
- Power Supply Micro USB Cable (for Raspberry Touch Display)
- Morex 80W AC Adapter
- Morex 80W DC-DC Converter
- Morex Cubid 3688 Mini-ITX case