Small Python program for Pi MusicBox to use with Adafruit PiTFT - 2.8"
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
pmb-pitft Fixed coverart fetching Mar 12, 2015 Update Mar 21, 2015

PMB-PiTFT (Pi MusicBox PiTFT) is small Python program/script/whatever that uses mopidy's mpd-api to show controlling ui on Raspberry Pi's screen.


Shows following details of currently playing track:

  • Cover art (From Last.FM)
  • Artist, Album and Track title
  • Track time total and elapsed

Shows and let user control:

  • Repeat
  • Random
  • Volume
  • Playback status

Let user control:

  • Screen backlight

Also haves sleep function to turn screen of and stop music after certain time.

Things you need:

Known issues:

  • PiTFT touchscreen is not working with Pi2, yet.
  • Capacitive PiTFT does not work with Pi1 B rev1. (Model B rev 1 have an older layout for the I2C pins and won't be able to use the touch screen.)


Current installing guide is tested and working with: Resistive PiTFT + Raspberry Pi 1 Model B rev1 + Pi MusicBox v.0.53 . Resistive PiTFT should work fine with all Pi1 B models. I haven't had time and equipment to test capacitive PiTFT yet, but it should work also, except that you need to do small changes to make backlight work (

First you need to install and configure Pi MusicBox(PMB). Instructions and everything else you need for this can be found on their website Make sure you enable ssh and set root password.

After installing and configuring PMB its time to take ssh connection to you PMB using ssh and root account. Use your favorite ssh program. I am using putty. After logging in enter following commands:

apt-get install rpi-update
echo insecure >> ~/.curlrc
REPO_URI= rpi-update 4815829b3f98e1b9c2648d9643dfe993054923ce

Wait until your PMB is booted and log back in using ssh. Next you will need your favorite file-editor on pi. I use nano.

Open file: /etc/modprobe.d/raspi-blacklist.conf
Change line: blacklist spi-bcm2708
     To: #blacklist spi-bcm2708
and save the file
Open file: /etc/modules
add following lines end of file and save it.
Make file: /etc/modprobe.d/pitft.conf
add following lines to that file and save it.
options fbtft_device name=pitft rotate=270 frequency=32000000
options stmpe_device cs=1 chip=stmpe610 blocks=gpio,ts irq-pullup irq-gpio=24 irq-base=330 sample-time=4 mod-12b=1 ref-sel=0 adc-freq=2 ave-ctrl=3 touch-det-delay=4 settling=2 fraction-z=7 i-drive=0
options gpio_backlight_device gpio=252

After that editing and creating files its time to give some commands to pi.

apt-get update
apt-get install fbi
apt-get install python-pygame
pip install python-mpd2
apt-get install evtest tslib libts-bin

We need to make symlink for touchscreen.

Open file: /etc/udev/rules.d/95-stmpe.rules
and add following line there and save it.
SUBSYSTEM=="input", ATTRS{name}=="stmpe-ts", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen" 

Time to reboot pi one more time. Give command: reboot

Once pi is booted again log back in. Lets verify that your screen is working. Enter following commands and you should see image on your pi's screen. If so everything is ok.

fbi -T 2 -d /dev/fb1 -noverbose -a adapiluv320x240.jpg

Calibrate touch screen using adafruits tutorial:

Download pmb-pitft files from github. To be sure to start in the home directory do

cd ~

Then download the following for cloning the git:

apt-get install git-core

After installing clone the git:

git clone

From you need to change font if you are using something else than Helvetica Neue Bold and check that path is correct.

To change font edit /root/pmb-pitft/pmb-pitft/ file line 26 and replace "helvetica-neue-bold.ttf" with your own font name. example "OpenSans-Bold.ttf". You can download Open Sans from Transfer ttf file to /root/pmb-pitft/pmb-pitft/ folder.

This is now daemon and it has three commands: start, restart and stop Use following command to start ui:

sudo python /root/pmb-pitft/pmb-pitft/ start


  • Easy option to switch between capasitive and resistive PiTFTs
  • Gestures
  • Playlist selector
  • Got other ideas? Post issue and tell me about it

Author notes:

There is probably better way doing somethings that I have done. It would have been awesome to have this as mopidy extension, but I couldn't find way to pull that out. Since pygame screen things need root account/access. This took lot of trial and error. I have installed pi musicbox again and again counteless time before I managed to audio work with screen.

There might be some bugs left, but don't worry we can fix those, hopefully. Feel free to give any improvement ideas.


Pi MusicBox Team
For making this great audio system
Notro and other people on project FBTFT
For making drivers for screen
project pylast @ github
For their Last.FM Python library
project python-mpd2 @ github
For their MPD-client Python library
Matt Gentile @ Icon Deposit
For his awesome Black UI Kit
Petite Icons