3 years ago

Magic Presentations with Skywriter

Amaze your audience with baffling magical powers or mastery of the Force using a Skywriter HAT

Let’s face it: simply using a Raspberry Pi to run the slides for your talk will make the audience think you’re pretty cool. But if that’s not impressive enough, why not dazzle them further by using your telekinetic powers to flip through the presentation and annotate the slides by drawing in the air? You don’t even need to be a graduate of Hogwarts or the Jedi Academy: just get yourself a Skywriter device and some simple Python, and you’re ready to rock.

The Skywriter device uses a grid of transmitting electrodes to generate an electric field that propagates around the surface in three dimensions. When you move your hand above the Skywriter, it disturbs this field and these variations are detected by the receiver electrode grid. These measurements can be used to calculate the position and movement direction of your hand.

This tutorial can be found in The MagPi 39 and was written by Richard Hayler

You’ll need…

Skywriter HAT or board
Skywriter API library
Python AutoPy library
LibreOffice Impress


Connect the Skywriter device

If you have a Skywriter HAT, this just connects onto the GPIO pins like other HATs. If you have the larger Skywriter board, you’ll need to connect six GPIO pins to the matching pins at the top, as shown below.

Pay attention to the wiring diagram!

Pay attention to the wiring diagram!


Install the software

Make sure you have the latest version of Raspbian, with all updates installed. As usual, those helpful Pimoroni Pirates supply a single script to handle the installation, including the full Python API. Like most HATs, the Skywriter needs the I2C bus on the Pi to be enabled, so if you haven’t already got this activated on your Pi, you’ll need to reboot before the Skywriter will work.

You’ll also need the AutoPy Python library and its dependencies, so install these with:

…and then:


Test your Skywriter

The Python API has example scripts to help you become familiar with the way Skywriter works:

Now wave your hand around in the air just above your Skywriter. You should see three columns of scrolling numbers corresponding to your hand’s position in a three-axis (x/y/z) box over the device. The Python library is preconfigured to recognise certain gestures: a flick (swiping over the Skywriter), a tap or touch (bring your hand down to just above the surface), and, trickiest of all, the Airwheel (wiggle a finger in a circular pattern above the Skywriter). It takes a while to get the hang of reproducing these gestures so that they are always detected, so spend some time practising. You can edit the test.py script and comment out the @skywriter.move() function (which displays the x/y/z numbers) to make it easier to see when you’ve nailed one of the gestures.


Configure your presentation software

Now it’s time to get your presentation software ready. LibreOffice Impress is very similar to Microsoft PowerPoint and works well on the Raspberry Pi. If you don’t need the other applications in the LibreOffice suite, you can just install Impress and the core components using:

You’re going to use Python code to detect gestures via the Skywriter and generate keyboard taps to control Impress in the normal way. The only extra configuration necessary is to activate the functionality that lets you draw on slides with the mouse. This is done by selecting Slide Show>Slide Show Settings and checking the ‘Mouse pointer as pen’ box.


Use the code

Type up the code from the listing (right) and save it as magic_control.py. You can do this using IDLE or with another text editor of your choice. Start LibreOffice Impress and open your presentation. Then minimise Impress and run your code either through Idle or via the command line:

Now flip back to Impress and get ready to start your talk or presentation.

Razzle Dazzle

Razzle Dazzle


Dazzle your audience

Start the slideshow by flicking upwards across the Skywriter. You can navigate through the slides by flicking left to right (forward), or right to left (backwards). To end the presentation, flick down across the Skywriter.

To annotate a slide, you need to activate the drawing function. Do this using a tap/touch: you’ll now be controlling the mouse with your hand movements, leaving a trail on the screen just like you’re drawing with a pen. This takes practice, so make sure you’ve spent some time preparing in advance! When you’ve finished drawing, tap/touch again to disengage the pen function.

We all know that, under the pressure of a live performance, things can go wrong. If you want to quickly disable Skywriter control of the presentation, use a double-tap to quit the Python program.

Code listing