Tested on:RPi3; Raspbian Stretch; Python3
Prerequisites:Raspberry Pi with Raspbian Jessie and internet connection (see steps 1-7 in the Introduction)
Hardware:Skywriter gesture sensor
UnicornHAThd
(pHAT Stack)
6 * jumper cables m/m
0

Painting colors with the Skywriter gesture sensor and the UnicornHAT


The Skywriter gesture sensor by Pimoroni can detect motions and gestures in the field above it. Here, the detected movements are used for coloring a UnicornHAT according to their coordinates.

Assembly
The Skywriter has six pins that all need to be connected to the Raspberry Pi with jumper cables. GND needs to be connected to pin 6, TRFR to pin 13, RESET to pin 11, SCL to pin 5, SDA to pin 3 and VCC to pin 1 in BOARD numbering.
The following setup could also be realized with a breadboard and ribbon cable instead of the pHAT Stack used here:

FarbMaler

ColorPainter

Installation
The software packages of the Skywriter gesture sensor and the UnicornHAT 16*16 pixel matrix as well as the script color_painter.py need to be installed. For this, enter

ColorPainter
Start the ColorPainter with

A movement right increases red, a movement up increases green and a movement away from the Skywriter increases blue. The functionality of the Skywriter library is realized with a Python decorator:

skywriter.move is an asynchronous signal which is generated by the sensor calling the move function in the script for every movement detected. If a movement had been detected, all 16*16 pixels of the UnicornHAT are colored according to the coordinates of the movement.

signal.pause()makes the script wait for asynchronous signals like move:

Movements are not the only gestures the Skywriter can detect. The other gestures implemented can be found in the API.

Full script
Click on Full Script to show all of the code.

Links
Pimoroni Skywriter API: http://docs.pimoroni.com/skywriter/
Python decorator: https://wiki.python.org/moin/PythonDecorators
Tutorial pHAT Stack: http://www.knight-of-pi.org/combining-hats-with-the-phat-stack/
Skywriter gesture sensor GitHub: https://github.com/pimoroni/skywriter-hat
Pimoroni Skywriter: https://shop.pimoroni.com/products/skywriter-hat
Tutorial UnicornHAT: http://www.knight-of-pi.org/first-experiments-with-the-unicornhat/

Knight of Pi

Johannes Bergs aka Knight of Pi. Diploma in Bioinformatics, some Webdesign and Python coding then. Living in the beautiful city of Vienna.

Comment

Time limit is exhausted. Please reload CAPTCHA.