What is it?
The Skywriter is a nifty little add on that enables you to control your Raspberry Pi A+ or B+ with a flick of the wrist! The Pimoroni Skywriter HAT senses the position of your fingers in the air above and responds to a range of hand movements and gestures. Using the provided Python API you can read off the positional data (x, y, z) and common gestures like flick left, tap, and double tap.
1. Getting Started
Load the LX Terminal:
sudo apt-get update
sudo apt-get upgrade
To get stared with this project you need to firstly install the python smbus, type
sudo apt-get install python-smbus, (After installation I then restarted Pi). Then the i2c needs enabling, this can be done with a simple bash script provided by Pimoroni, curl -sSl get.pimoroni.com/i2c | bash
Next step restart your Pi to enable the smbus and when loaded, re-open the LX Terminal and install the Skywriter Python Library, typing:
sudo apt-get install python-pip
sudo pip install skywriter
Once install then reboot your Pi typing, sudo reboot
2. A Starting Program
With your Skywriter connected to the GPIO pins of your Raspberry Pi try this simple Python program below. It allows you to double tap the Skywriter and prints out the position of the double tap back to the console screen. For example, center, west, east, north and so on. Copy and paste the code into IDLE, press F5 to save the code and run it.
print('Double tap!', position)
Download the code here
Other Skywriter Controls
Pimoroni have created an excellent library of examples to get you started with the Skywriter, these can be found here. The controls below are taken from their test.py program which demonstrates all the movements and interactions with the user and the Skywriter.
Slow down: You can slow down the responsiveness of the Skywriter using the following code, repeat_rate=2, where the number 2 is the of number of permitted touches a second. For example to enable a maximum of 3 touches a second code,
X Y Z Position: This code returns the X, Y and Z position of your finder on the Skywriter, the Y axis is response up to about 5cm
def move(x, y, z):
print( x, y, z )
The Flick: Flick your finger across the Skywriter and the code returns the location of the flick, south to north, west to east or vice-versa.
print('Got a flick!', start, finish)
The Tap: Like the double tap but a activated with a single tap.
The Touch: This code returns the position where you touched the Skywriter.
- Raspberry Pi
- Contact Me
- Hologram Machine