Control With buttons or screen?

Hello Musicbox community.
I came across Musicbox today looking for a pi internet radio solution. I love this idea as there isn’t to much programming and ssh’ing involved. The only flaw is that I would like some type of buttons of a little lcd screen on the unit to control it?
Similar to these two

I would rather something more similar to number 2 as in terms of two physical buttons and a small lcd.
Thanks for your help!
Looking forward to make my project a reality

Hey! I assembled my pi into an old radio and already connected the buttons to a piface. However, i didn’t have time to programm the stuff necessary for controlling mopidy (and I never coded python before)

–> we could share our experience here!

will you use a piface as well?

Thats my Pi:

Hi. I have two plugins for mopidy to control it:

It can be used to control mopidy from a touchscreen. I am working to work also with GPIO buttons in case the TFT has no touch.

This one is to control with a keyboard or GPIO buttons. The idea is to use TTS to replace any kind of display. Something similar to 3rd generation Ipod shuffle control.

Maybe you can use one of this extensions or check the code on github to make your own extension.

Hope it helps!

1 Like

@9and3r : thanks for creating these! I’m having a play with Mopidy-TTSGPIO, and I could use your help. I want to make a headless music server for my kids.

I’ve got pimusicbox running, installed your plugin, edited config, got modipy running as root, hooked up the buttons to the GPIO (e.g. 24 for ‘Next’) and… nothing.

Just wondering if you’re able to help with debugging in any way? I’ve no idea where to start.

Appreciate any help you can give.

First of all check that the extension is correctly loaded. You should see the ttsgpio on:

 INFO     Enabled extensions: http, mpd, ttsgpio

If the extension is enabled play a song (using a mpd or web client) and you should hear the name of the song.

Just in case remember that the GPIO has to be connected to the ground. 3.3v and 5v lines are NOT used.

I will make a fresh install of musicbox and try to see if I encounter any problem.

Reply if you still having problems.

Hope you will get it working :smile: !

ah… I didn’t see that on boot. Thanks, it’s working now!

Turns out plugin was disabled when I set the debug_gpio_simulate to true, it was failing to load.

How can I run pi musicbox and mopidy-ttsgpio in simultaneous?
I just want 5 buttons on to play pre-memorize radio stations.
I have no programming experience.
Tanks in advance.

You can install it from pip.

Then you must run mopidy as sudo. In musicbox edit file /etc/init.d/mopidy and change

DAEMON_USER = mopidy



Currently mopidy-ttsgpio can be used to choose playlists. I am not sure if it is possible to make a playlist with radio stations (In general I use mopidy to play spotify songs).


I’m struggling to get the Mopidy-TTSGPIO working, am i right in thinking if I am playing a song, in Musicbox, hit my button wired up to pin 17 it should pause the track, as i cant seem to get it working?

The module seems to be loading as i can see it in Enabled extensions, and i’ve written a little test python script to make sure the button is working, but i cant see to get it to control the playback.

Am i likley to be missing any dependences, and is there any way to get some debug info out of the plugin?

Cheers, Luke

Check if the message “TTSGPIO: Not enough permission to use GPIO. GPIO input will not work” is on the log. If it doesn’t appear the extension should be loading correctly.

If you have internet connection you should also hear the track name when it starts playing.

Remember that the connection must be PINX- Button- Ground (You don’t have to use 3.3v or 5v).

The only dependence that is needed is RPi.GPIO but it should be there by default.

Cant see that message in the log, I’ve kind of ended up writing my own prototype now anyway as I wanted to use a rotary controller on my project as well.

hey beakersoft: using a rotary controller is my next hack! Have you got any code to share? Much appreciated if so.

@rocketchef, kind of a work in progress, i’ve put what i’ve done so far on github. Nothing documented or well tested, but it kind of works

Hi !
I’m complete new to this … are there any pictures or descriptions available how to mount the cables and buttons ? On which GPIO port … ?

Is working now … First buttons are working :slight_smile:

Hi Guys,
Sorry I kind of left this thread but I am interested again. I am new to GPIO on raspberry pi. If I was to install TTS-GPIO what gpio buttons do i use? can you point me to some? So do I just connect GND - Button then the pin specified for say Play/Pause. Thanks!

You have the default pins on github. You can specify what pins to use on config file, but if you do not change the config, default ones will be used.

For example you can connect pin 22->button->ground. When you press the button mopidy should go to the next track.

Hi @9and3r – I’m having some problems setting up your extension. I’ve posted a screenshot of the log above.

Any help would be apprecaited

TTSGPIO does not have output and mixer config. Check your config and remove output and mixer from ttsgpio.

output = X (Remove)
mixer = X (Remove)

Here you can find what config values are accepted by TTSGPIO.


Turns out I had the settings in the wrong part of the config. (it was in the Audio Settings section) I moved it up, under the spotify/soundcloud/etc settings and it seems to be working.

I’m trying to use Adafruit’s capacitive buttons but I’m having a few problems.

  1. tapping Next advances 2 songs
  2. tapping Previous advances 1 song
  3. tapping Play/Pause does nothing
  4. tapping Vol + says the title
  5. tapping Vol - says the title

I know you say to use a pin - button - then ground config, but when I try that there is no reaction from, say Play/Pause.

That capacitive buttons seem to work in a different way. So in your case pin- button- ground is not valid.

I have almost 0 knowledge in hardware :disappointed_relieved: .

I have made a small python script to test how ttsgpio detects the buttons. (I could not test it on my raspberry pi. Hope it works)

To use it simply copy to raspberry pi and run sudo python
You should see “X button pressed” when pushing and “X button released: Long/press” when you release it.

My first idea is that maybe that the bouncetime is not adequate for that type of touchpad. So try changing the value of the bouncetime in the script.

The second thing could be that those pads does not need any pull up resistor, so you could also try without.
For example change
GPIO.setup(pins['pin_button_previous'], GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(pins['pin_button_previous'], GPIO.IN)

Just let me know how it goes. If it is working I will update the extension to support them.