Raspberry PI music player gesture controlled with hover

Hover and Raspberry PI

I’ve recently received my hover gesture board from justhover.com and I needed a nice project to test it ! In the past, I’ve managed to get a bluetooth wireless speaker to work with my Raspberry PI and now, I’m going to use to output music from my music player controlled with gestures !

Note: Didn’t get to output music from pygame to my bluetooth speaker. Always getting the following error:

But, I’ve connected some speakers to the jack output and was set !

Hardware used

Raspberry PI model B+


Bluetooth Dongle

Bluetooth wireless speaker


Having your PI already up and running with some sort of audio output – whether by bluetooth or hdmi or jack .




For wiring the Hover, you can check the hover page. For the B+ version, the first half of the GPIO is the same, so there’s no problem with the different versions.

NOTE: Hover has updated the board, the PINS are almost the same – having the newer board more PINs than the version 1

Here you can check the page from hoverlabs. Here’s the pinout:

Hover Board Raspberry PI
HOST_V+ 3.3v
RESET GPIO 24 (default library)
3v3 3.3v
TS GPIO 23 (default library)

Raspberry PI



Head to http://www.justhover.com/raspberry and download the libraries or get the latest:

wget https://github.com/jonco91/hover_raspberrypi/archive/master.zip

Unzip the files

Prepare the RaspberryPI for GPIO programming

Following the instructions, we need to make sure to have the latest tools available to work with the GPIO.

Instructions from Adafruit




Check the I2C modules

and add the following:

Save and quit

If you want, you can reboot or PI or just load the modules

Install more tools

Now, some modules related to i2c and spi are blacklisted, because not everyone uses or needs them. Check if you have /etc/modules.d/raspi-blacklist.conf . If you have, edit it and comment the following lines:

(put a # in front of the lines)

Save and quit.

Reboot your PI

After reboot, check if hover is detected by checking any addresses in use:

Testing the libraries

Now, head to the directory unzipped from the hover github

and execute the example (using sudo) and wave yor hand…

You can get more information about the values of swipe in the raspberry PI page of hover.

Music player

Python should already have all the necessary modules installed and ready to run.

The music player is a python script that uses hover to stop, pause, skip to next track and skip to previous track using gestures.

The script controls are:

  • Hover left – previous track
  • Hover right – next track
  • Hover top – pause
  • Hover down – unpause
  • touch center – play
  • touch down – stop
  • touch left – vol down
  • touch right – vol up


Get the files from my bitbucket account and put it were you want.

Edit the file playerHover.py and search for the following lines:

Change toPath variable to where you have your music files (mp3).

Save and quit.

Execute the player with


Have fun with gestures !


A bit of explaining

Import all the necessary modules

Initialize hover

This next function takes an argument (trackNum), clears the screen, loads the next track from the array, plays it and prints the name

The location of the mp3 files. Fills the array playFiles with the files in the directory


Get the number of tracks to play


Initialize the pygame libraries


Plays the first track


Now, the hover stuff.

The next piece of code gets the status of hover and reads an event – if any

The next code gets the event and, with if statements check the time and act accordingly

The rest of the code is self explanatory !

I’m not a python programmer – the code may contain errors and I’m sure an experienced python programmer would make a lot of improvements

Here’s a small video of Hover in action

2 Replies to “Raspberry PI music player gesture controlled with hover

    1. Hi Dan !

      I’m sorry, but not. I haven’t tried any more (although I did search and try a lot of stuff when trying the first time) . I’ll to get back to that in a new project in the future. Best regars

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.