loading

Hover can be combined with an Raspberry Pi to make a drum machine. You can customize each tap and gesture for different sound effects or even voice clips.

This example was inspired by the BeetBox (http://scott.j38.net/interactive/beetbox/).

Step 1: WHAT YOU NEED

Raspberry Pi: You can use any Raspberry Pi board with Hover.

Hover: The magical board that lets you control your hardware projects with gestures.

Breadboard: Hover will need to be connected to a breadboard using the 7-pin header.

Jumper wires: You need 7 of these to connect Hover.

Speakers: Plug them into the Aux Port on the Raspberry Pi

Step 2: BUILD THE CIRCUIT

Use the diagram below to connect Hover to your Arduino board. Here's a description of all the relevant pins:

  • HOST_V+: Connect the HOST_V+ pin to the 3V3 pin on Raspberry Pi.
  • RESET and TS: These pins are used by the library to configure Hover. These can be connected to any GPIO pins of the Raspberry. Default library uses GPIO 24 for RESET and GPIO 23 for TS.
  • SCL and SDA: The I2C pins are used to read data from Hover. Connect SCL/SDA on Hover directly to the SCL0/SDA0 of the Raspberry Pi.
  • 3V3 and GND: The 3.3V power supply and ground pins are used to power Hover. Connect these to the 3.3V and GND pins on Raspberry Pi.

Step 3: INSTALL THE LIBRARY

With the hardware setup, we'll need to install the library before we can start hovering. The Hover library lets you easily incorporate gesture and touch events into your projects. We've added the library and example code on Github. Hit the link to grab the latest version:

https://github.com/jonco91/hover_raspberrypi

Step 4: RUN THE EXAMPLE SKETCH

Open up LX Terminal and run the following two commands:

sudo modprobe snd_bcm2835

sudo amixer -c 0 cset numid=3 1

This enables sounds on the raspberry pi and sets the audio output to the AUX port. Move the Hover_drum.py and the samples folder into the same location as the Hover_library.py (the Hover_drum.py file will be part of the library you downloaded in the previous step). Now you're ready to run the file using this command:

sudo python Hover_drum.py.

Wait for Hover to Initialize and then rock on.

Step 5: UNDERSTANDING THE CODE

The key component added is the pygame code. Once you have imported pygame, you'll need to initialize the pygame mixer. After that, you can load in sounds and play them. Here is a snippet of the code.

import pygame

pygame.mixer.init()

kick = pygame.mixer.Sound('samples/kick.wav')

kick.play()

<p>What's the latency between the touch and the sound? It looks far too long for this to be usable.</p>
The latency is because the mp3 files are large and the Pi is a little slow while trying to load those. The latency of the Hover board is almost zero -- gestures and taps are recognized instantly. <br><br>These two videos were done on an Arduino and it shows the responsiveness: <br>https://vimeo.com/94027694<br>https://vimeo.com/93829989
Awesome, don't rush through these projects though. Take your time

About This Instructable

12,822views

27favorites

License:

More by JustHoverBoard:DIY Drum Machine with Raspberry Pi + Hover Browse Google Earth with touch-less hand gestures 
Add instructable to: