Skip to main content

Trying out Raspberry Pi Gesture Sensors

flick pad

Connecting a Pimoroni Skywriter and a Pi Supply Flick to a Raspberry Pi, installing the necessary software and trying some examples.

I have been trying out a couple of gesture sensors designed primarily for the Raspberry Pi (201-2262) : a Pimoroni Skywriter (146-2641) and a Flick (136-5430) from Pi Supply. The former is a Pi HAT and the latter a larger, add-on board. They are both based on the same MGC3130 3D tracking chip, which reads up to 200 positions per second, enabling it to reliably detect simple gestures. They also both sense touch in the centre and on the four edges of the board.

The Flick claims to be able to sense up to 10cm away from the surface, although I found that in practise I needed to be a bit closer than that. The Skywriter HAT has a 5 cm range. The chip they both employ uses electrical near-field 3D/gesture sensing. This means that they can detect movement through a cover, as long as it is made of non-conductive material, should you wish to mount them in a case. The 3D gesture sensing means that it responds to flicks and scrolls of the finger, as well as proximity and position. Both boards communicate with the Pi’s I2C bus using the Python SMBus module.

Pimoroni Skywriter

skywriter

I started by setting up the Skywriter, fixing it to the top of the Pi as you would with any HAT and then installing the necessary software using the handy script created by Pimoroni. This does everything for you, including enabling i2c, installing the Python smbus module which facilitates Python i2c communication, and also installing a selection of Python examples to use with the Skywriter. It is simply a matter of opening a terminal on your Pi and typing:

curl -sSL get.pimoroni.com/skywriter | bash

There are clear instructions on the Pimoroni Github page, including how to install everything without the script if you prefer.

Once this was done I tested the Skywriter by running the test script from the examples provided by opening Terminal and typing:

sudo python test.py

Next I tried the mouse example. As this uses X Windows I needed to install the Python X Library:

sudo apt-get install python-dev python-xlib libxtst-dev libpng-dev python-pip

Then start X by typing startx and then running the mouse example:

sudo python mouse.py

Although these examples were quit interesting, what I was really keen on trying was the theremin. This example also needed an extra bit of software installed as it uses PureData, or PD. Again this is done in the Terminal by typing:

sudo apt-get install pd

Once PD is installed the theremin can be started by entering:

sudo python synth.py

The theremin has a fairly thin, some might say irritating, sound, but that might be down to my lack of theremin skills.

Pi Supply Flick

flick and the top hat

As the Flick that I have is the add-on board, rather than a HAT, it connects to the Pi using the supplied female to female ribbon cable. I took care to connect it up correctly referring to the guide on the Pi Supply Flick GitHub page.

flick connected to the raspberry pi

The connectivity is arranged so that only the pins on the left side of Raspberry Pi's header are required to be connected to the Flick Large.

This is how the pins are connected:

Flick

Raspberry Pi

LED2 (Red) Pin 15
LED3 (Green) Pin 7
GND Pin 9
TS Pin 13
Reset Pin 11
SCL Pin 5
SDA Pin 3
VCC Pin1

The detection surface is 148mm x 104mm and so considerable bigger than the Skywriter’s standard HAT size. Similar to the Skywriter, Pi Supply provide a script to install all the necessary software. This time it is a case of entering into a terminal window:

curl -sSL https://pisupp.ly/flickcode | sudo bash

Unlike the Skywriter, the examples provided are pretty basic. The demo.py one, shows the X, Y and Z values as you move your hand above the board. There is a “flick snail” that lets you flick a snail (an @ sign) around the screen. The most interesting is probably the volume control that responds to the “Airwheel” gesture – rotating a finger above the board – to adjust the sound volume.

I wondered, given that it uses the same processor, if ithe Flick would work with the Skywriter examples – there was certainly no harm in trying, and I could have a go at controlling the theremin using a bigger surface. I was happy to discover that the theremin example worked just fine!

In the video you can also hear that, although the theremin does not sound great, it is a useful addition to my modular synth setup. The signal put through an echo/loop module and the Bela Pepper running the Granulator script starts to sound really interesting.

Conclusion

Vince the cat

Vince the cat obviously enjoyed trying out the sensors.

The performance of the of the two is very similar, although the Flick being a lot bigger and having longer detection range obviously makes a difference. It certainly made the theremin easier to control. Having said that, there is a board version of the Skywriter and a HAT version of the Flick (136-5431) .

I assume that if the Flick works with the Skywriter examples, the reverse is also true, although I have not had a chance to test this. Although the supplied Flick examples are not very inspiring there are some interesting third party software libraries, including an example to control a Philips Hue Lamp by sending Flick data to MQTT – unfortunately the guide is in German which I do not understand.

There is also a 3D holographic audio visualizer with gesture control and real time animations of SoundCloud playlists over on Hacker Shack that looks very interesting. Although I have concentrated here on using the sensors with a Raspberry Pi, the Skywriter already has an Arduino library and the Flick promises Arduino and Beaglebone software in the near future.

I have a background in the arts, environmental conservation and IT support. In my spare time I do a bit of DJing and I like making things.
DesignSpark Electrical Logolinkedin