SqueezePi: The Joy of lite Jive, and custom controls

Community Power

There’s a great community that has grown up around Slim Device’s Squeezebox products. I think that stems from the company’s very open approach, with a wiki and forums that are still very active today – despite the company’s assimilation into Logitech, and the discontinuation of its devices.

It was through these resources that I discovered JiveLite, Squeezebox controller software created by members of this community. This is a very fully featured app, written in a mixture of C and Lua with full source available, that runs on Linux. With a little digging and interpretation of the available instructions, I built and ran it on my Pi connected to a conventional LCD monitor via HDMI.

The next challenge was to get it working with the little 2.8″ LCD. Fortunately others had been there before me, so that didn’t take long – and with a little extension to the settings, I also got JiveLite to respond to the touch screen. This was proving a bit too easy…

Other People’s Software

Yes, it was a little too easy. It turned out that JiveLite had a few issues – some minor ones arising from using a very small display, some in the build configuration files and a crash when navigating music collections (e.g. when selecting by artist). I’m jumping ahead a bit here… I’ve now fixed these issues in a clone of the original codebase, and made it public. Hopefully I can persuade the originators to consider taking some of these back into the main repository.

I also added some extras – the necessary user interface data files for the small size LCD, the ability to turn off the mouse pointer for touch screen use, and the ability to control GPIO pins from the Lua script. The latter I used to modify one of the screen-savers, so it would turn off the LCD backlight when active to save some power.

Prototyping Custom Controls

Inspired by these strong steps forward, I decided to try driving JiveLite via controls attached to the Pi via GPIO pins. You can see what my efforts look like in the picture below. I used an Adafruit Pi Cobbler kit to connect my Pi to the breadboard, to make it easier to wire up the GPIOs to the control components.

IMG_20140614_162041 (1)

Yet more research turned up another really useful bit of Pi software made for this purpose – pikeyd. This package runs in the background, polling GPIO pins connected to switches and generating keystrokes when the switches are closed. So it was a relatively easy task to find out the keys that control JiveLite and configure pikeyd to generate those from GPIO inputs. Et voila, those little switches under the LCD were usable for navigating the menus, playing tracks and changing the volume.

Next I wanted to get a rotary encoder control to work. My Squeezebox Radio has one of these, which is used primarily to scroll up and down through menus and make choices by pressing on it. Rotary control components are relatively cheap and easy to obtain – both RS and Farnell carry a bewildering range. I got a couple of cheap ones from here. They’re okay quality for this project; however you could wind up spending a lot if you want really top quality rotary controls!

These SparkFun encoders act as a pair of switches that make and break contact with ground out of phase with each other as you turn the control shaft. By wiring the two “output” pins of the encoder via pull-up resistors to GPIO pins on the Pi, those pins will alternate between low and hi in the a pattern known as a Gray code, and the direction of rotation can be determined by tracking how the pin values change over time. So you can turn rotation of the controller into steps in the two different directions, and map those steps into changing something in your software (e.g. the current selection in a menu). This tutorial for Arduino provides more detail.

Unfortunately, piked doesn’t support rotary encoders, just simple switches on GPIO. But it wasn’t hard to add this support… you can find my modified fork of the software here for public consumption. So now pikeyd had gained the ability to map rotary encoder steps into key presses (two on each encoder, one per rotation direction), then I added a configuration option to set up the internal pull-up resistors on the Pi GPIO pins, saving extra components and wiring.

With my modified pikeyd configured to generate the corresponding keys from a rotary control, I could now navigate the JiveLite interface through it. There was also a built-in push switch on the controller, which I wired up to another GPIO pin to act as a “select” key stroke when pushed.

You can see all of it working together on this video.

The Control Board

With all of this prototyping under my belt, I went on to build a first working version of the controls for the SqueezePi – two rotary encoders (one for navigation, one for volume) and four switches for “home”, “back”, “on/off” and “play”. I constructed this on a thin strip of Veroboard with tracks like a breadboard, and attached a couple of single track strips top and bottom running at ninety degrees as ground tracks. I also used another (cheap) Pi cobbler from Maplin soldered onto the breadboard as a quick way of attaching the Pi GPIOs via ribbon cable.


Extending my custom pikeyd configuration to read these controls was a walk in the park.

Next, I’ll go onto describe what I did for audio output and the process of creating the case.

Digression #1: SqueezePi

I’ve wandered away a bit from Pi synthesiser exploration, and spent some time on another Pi audio project – the SqueezePi!


As a long-term owner and user of a couple of Slim Devices Squeezebox networked digital audio players, I’ve been feeling let down by Logitech’s purchase of that company and its subsequent discontinuation of the products. So I set myself the challenge to see if I could create an equivalent to the Squeezebox Radio or Boom players – taking inspiration from the work of others on open source versions of the software, and the efforts to get that running on the Pi.

In this post and subsequent ones, I’ll provide a potted, illustrated history.

First steps: Software and Key Goals

Fairly quickly, I discovered SqueezeLite. This is a free Squeezebox compatible player that has been successfully ported to the Pi in various Linux distributions. There’s a good thread about it on the Pi forums. I used a prebuilt (now deprecated) binary version.

It worked straight away on the Pi with my existing Squeezebox server – and I’m using it still (I should really attempt to build it from source soon, though).

So that got me off to a good start. Now some forward planning was in order…

To be as standalone as the real Squeezebox players, I was going to need some sort of dedicated display on the Pi. Also some push switches and a rotary control, analogue audio output to amplification and speakers, a power supply to drive the Pi and amplifier, and a nice case to package it all up. I drew up that list and began investigating my options.


I was already aware of a wide range of dedicated displays for the Pi – many easily affordable and fairly easy to set up and use. But to be like the original Radio player, the display would have to be colour, which led me to research the various small TFT LCD displays for the Pi. So I decided to try the Adafruit 2.8″ TFT LCD which had the added bonus of a (resistive) touch screen – so my SqueezePi would be a blend of the Radio, Boom and Touch players!

I ordered one from the marvellous folks at ModMyPi, and on its prompt arrival dusted off my soldering skills and put it together. This was a little nerve-wracking, but ultimately more straightforward than I feared! The Adafruit site provided all the info and software needed, and I easily had it up and running in under an afternoon. I also soldered on some small push switches onto the display’s circuit board that I could try as dedicated controls for the SqueezePi.

With a little research, I was able to write a simple prototype UI in Python that pulled information from my Squeezebox Server, via PyLMS and PyGame and control playback on the Pi’s instance of SqueezeLite. It was straightforward to get the touchscreen working via PyGame, and I used the RPIO Python GPIO library for the Pi to add support for those little touch switches – et voila custom dedicated controls worked!


In the image above, you can also see the first part of the audio stage – a “no-name” brand cheap USB audio card.

This was great as a prototype, but falling way short as a Squeezebox-like experience. So, next I had to either do more research into open source, or start some serious UI coding…

(c) 2014 Nick Tuckett.