TeCoEd (Teaching Computing Education)
  • Home
    • Freelance
    • Book
    • Downloading
  • Python
    • Learn Python >
      • Python Modules
    • PyGame Zero
    • Python Programs >
      • Higher or Lower
      • Magic Calculator
      • Password Checker
      • Python Pit
    • What's News App
    • Pixels to Cells
    • Python Mosaics
    • Python OCR
    • L-1-AM
    • Web Scraping >
      • Scraping Trains
    • Weather App
    • Snakes and Windows
    • Python Web Server >
      • Flask
    • Python Picks
  • Raspberry Pi
    • All About the Pi
    • Getting Started
    • Remote Desktop and VNC
    • Static IP Address
    • Sonic Pi >
      • 3.14
    • Twitter Feed >
      • Tweepy
    • Android & Pi >
      • Advanced Apps
      • Odds
    • A.I on the the Pi
    • CRON
    • Pick Your Own
  • Pi Hardware
    • Pi HATS >
      • Sense Hat Hacks
      • AstroPi HAT
      • Unicorn-HAT >
        • Unicorn Alphabet Disco
        • Uni Codes / Programs
      • Skywriter
      • Piano HAT
    • STS Pi
    • Pi Camera >
      • Pi-Cam, Python & Email >
        • Time Lapse
      • Pi Noir
    • Pipsta >
      • Flask, Input & Printers
    • Raspberry Pi Power >
      • Energenie IR power
    • Pibrella
    • Distance Sensor
    • LCD Screen
    • Pi-Tooth
    • Robot Arm
    • PiGlow
    • PiFM
    • Accelerometer
    • PiFace >
      • Installing PiFace >
        • Python Commands
  • Pi-Hacks
    • Drone Hacks
    • Pi Glue Gun Hack
    • Blinkt!
    • Sonic Pixels
    • R2D2
    • Get to the chopper
    • Astro Bird
    • Twitter Translator
    • Hacking a Robot
    • Nature_Box >
      • Best Nature Photos
    • Wearable Tech >
      • Project New York
      • P.N.Y Part 2 Health
      • P.N.Y Part 3 Games
      • P.N.Y Part 4 Translation
    • Dino-Tweet
    • Other Links
  • Pi-Hacks 2
    • The Joker
    • Hologram Machine
    • Google Vision: Camera Tell
    • Yoda Tweets
    • Pi Phone
    • Darth Beats
    • Twitter Keyword Finder
    • Crimbo Lights Hack
    • Xmas Elf
    • Halloween 2016
    • Halloween Hack 2015
    • Socrative Zombie
    • Voice Translation
    • The Blue-Who Finder
    • GPIO, Twitter
    • Pi Chat Bot >
      • Dictionary Definitions
    • PiGlow & Email
    • Pibrella Alarm System
    • SMS with Python >
      • Spooking a Mobile
  • Pi-Hacks 3
    • David Bowie
    • Lamp Prank >
      • TEST
    • Yoda FM
    • Retro Player
    • LED Pixel Art
    • TARDIS
    • Battleships
    • LED Board
    • Night Vision
    • Enviro+ Weather
  • Minecraft
    • Minecraft API
    • Minecraft Sweeper
    • PiGlove: Minecraft Power Up
    • Minecraft Photo-booth
    • Rendering Pixels
    • Speed Cube
    • Lucky Dip
  • Computing
    • Why Computing?
    • Can You Compute
    • micro:bit
    • Coding Resources
    • Learn to Code >
      • Coding with iPads
      • Apps Creation Tools
      • sKratchInn
      • Sound Editing
    • Cheat Sheets
    • Theory
    • HOUR OF CODING
    • BEBRAS Computing Challange
    • Computer Facts
    • Free Software and Links
  • Contact Me

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
Picture
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


Picture
The position of the Skywriter
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.

@skywriter.double_tap()
def doubletap(position):
      print('Double tap!', position)

Download the code here

The Skywriter



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, 

@skywriter.touch(repeat_rate=2)
def touch(position):
  print('Touch!', position)
 
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 

@skywriter.move()
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.

@skywriter.flick()
def flick(start,finish):
   print('Got a flick!', start, finish)

The Tap: Like the double tap but a activated with a single tap.

@skywriter.tap()
def tap(position):
  print('Tap!', position)

The Touch: This code returns the position where you touched the Skywriter.

@skywriter.touch()
def touch(position):
  print('Touch!', position)

Copyright 2020 TeCoEd @dan_aldred