Hover... What it it? Well I am afraid to say that it does not grant you the ability to fly off the ground and bunk off school (I shouldn't be saying this, it is summer holidays!) However, it is pretty exciting. You may have seen my article about the Leap Motion (see here), and it is a little similar to that, except that it does work with the Raspberry Pi (as well as arduino and similar), Hooray! This opens up loads of new opportunities, such as using it to control robots and the like! As well as hand gestures (Forward swipe, Back swipe, Left swipe and Right swipe) it is also a simple touchpad like you might find on a laptop. This can recognise taps in five places, (North, South, East, West and Centre). You can buy a Hover here.
There is a video of this in action on the right :) -->
The board is simply fixed to the Pi with a breadboard, and some simple wiring, then can be controlled with some simple code, that I will explain later on. Simple :)
So, before I take you through setting it up, what will you need?
- 1 Male to Male jumper lead
- 6 Male to Female jumper leads
- Raspberry Pi Model B (Not B+)
- Internet connection for the Pi
- USB Stick
- Windows computer (Or Mac, but instructions are for Windows)
- Internet connection for Windows Computer.
Size : 1392.035 Kb
Type : zip
Here you can see the Hover being used to make an LED flash. If you would like the code for this, please contact me through the form on the Homepage of this site, found here.
I2C is commonly used to allow one chip to talk to another. Like the Raspberry PI and Hover.
It's time to do the Hardware!
- Collect your equipment listed at the top of the page.
- Wire the Raspberry Pi and Hover together as in the diagram on the right. DISCONNECT THE POWER SUPPLY FROM THE PI BEFORE DOING THIS!
- Power up the Raspberry Pi, Login and start the GUI.
- Open LXTerminal and type: cd hover_raspberrypi-master.zip
- Type: sudo python Hover_example.py
- You can now touch the touchpads, or swipe your hand across, and the corresponding action should be displayed on the screen!
- If you are feeling more adventurous, try the example drum program, where different drum sounds are played when you tap or swipe. Simply type: sudo python Hover_drum.py in step 5. Make sure that you plug in some speakers or headphones, and you have configured the sound correctly, following the instructions here.
NB - If you are using a Raspberry Pi Version 1, you need to change the Hover_library.py file line 27 to use SMBus 0 instead of SMBus 1. The default library is setup for Raspberry Pi version 2.
Before we start setting up the hardware side of things, the Software must be ready to go.
On the Windows computer:
- Insert the USB stick.
- Download the file on the left.
- Locate the .zip file in the Computer's 'Downloads' folder.
- Right click on the file and select 'Extract All'
- When the window pops up, click 'Browse' then select the USB stick.
- Click 'OK' then 'Extract'
- When this has finished, remove the USB stick from the computer.
On the Raspberry Pi:
- Insert the USB stick.
- Boot up, login and open the GUI (command startx).
- Open 'File Manager'
- Double click on the USB stick (on the left)
- Drag the entire folder (hover_raspberrypi-master) to the bit on the left reading 'Pi' (or your username if changed). Drop.
- Open LXTerminal.
- Type 'sudo apt-get update', press enter and wait.
- Then, 'sudo apt-get install python-dev'
- Finally, type 'sudo apt-get install python-rpi.gpio'. You will probably be prompted to press 'y', and press enter to confirm.
- Reboot. This can be done by typing 'sudo reboot' into the command prompt (LXTerminal)
- When the Pi is ready, login and start the GUI again (startx).
- Open LXTerminal and type 'sudo nano /etc/modules'. This will open a tiny program that controls the workings of the pi. You need to enable the Pi to use i2c, by adding the following lines of code to the bottom of the existing code: 'i2c-bcm2708', 'i2c-dev'. It should now look like the picture on the left.
- Close and save this program by pressing Ctrl + X, followed by 'Y', then Enter.
- You now need to install two more things. In LXTerminal, type: 'sudo apt-get install python-smbus' and press enter.
- Now type: 'sudo apt-get install i2c-tools'. Press enter.
- Next, you need to edit another program that tells the Raspberry Pi not to use i2c. This is to help people who don't want to use this system, but we need to use it! In LXTerminal, open the file by typing: sudo nano /etc/modprobe.d/raspi-blacklist.conf
- You will now need to void the last two lines of code by putting '#' in front of them. Python ignores anything after a '#'. It should now look like it does on the left.
- Exit the editor by pressing Ctrl + X, then 'Y' and finally Enter.
- Reboot with 'sudo reboot'
To check that the Raspberry Pi is working with the i2c device connected, type the following into LXTerminal:
sudo i2c detect -y 1
If you are using a Raspberry Pi Version 1, typethe following instead:
sudo i2c detect -y 0
If the number 42 appears, you are doing great, however if not, ensure that you have done everything outlined above!