Giter Site home page Giter Site logo

apds-gesture-ui's Introduction

APDS-9960 Gesture uInput

About

apds-gesture-uid uses the gesture recognition of a APDS-9960 to simulate keyboard input by using the Linux uinput kernel module. This small script uses python-apds9960 and python-uinput to allow to control your GUI with gestures.

The APDS-9960 is able to detect 4 directions which will trigger a virtual keypress. The default config maps:

Direction Key
UP Page Up
DOWN Page Down
LEFT Left
RIGHT Right

Config

The python configuration file is /etc/gesture-ui.conf. The following settings are recognized:

  • I2C_PORT - the SMBus port number
  • GMAPPINGS - defines which gesture direction should trigger which key presses
  • POLLING_SLEEP - sleep between polling for new gesture recognition events

If the MQTT bridge modus is used, apds-gesture-uid-pub and apds-gesture-uid-sub are using the following MQTT settings:

  • MQTT_HOST - the MQTT broker hostname or ip address
  • MQTT_OPTS - connection options (see also connect method of the Paho MQTT python client)
  • MQTT_TOPIC - the MQTT topic used for publish and subscribe

Install

Prerequisites

On Raspberry Pi you need to enable the I²C bus. See also the documentation at the the python-apds9960 module.

Install git, python-smbus and virtualenv:

# apt-get install git python-smbus virtualenv

Download source

# git clone --recursive https://github.com/liske/apds-gesture-ui.git /opt/apds-gesture-ui

Kernel module

The apds-gesture-ui and the apds-gesture-ui-sub scripts require the kernel module uinput.ko to be loaded:

# modprobe uinput

Put uinput into /etc/modules to load the module during system boot automaticly.

Python modules

It is recommended to create a dedicated virtualenv where the python modules required by apds-gesture-uid will be installed:

  • create new virtualenv
# virtualenv --system-site-packages /opt/apds-gesture-ui/venv
  • enter the virtualenv
# . /opt/apds-gesture-ui/venv/bin/activate
  • install Python-uinput
# pip install python-uinput
  • install Paho MQTT python client (optional)
# pip install paho-mqtt

Configuration

Copy the example default config file and customize it:

# cp /opt/apds-gesture-ui/ex/apds-gesture-ui.conf /etc/

System service

This project contains example systemd.service files (see ex/). For activation copy the service file to /etc/systemd/system/ and change the containing paths to match you environment:

# cp /opt/apds-gesture-ui/ex/apds-gesture-ui.service /etc/systemd/system/
# systemctl daemon-reload
# systemctl start apds-gesture-ui.service
# systemctl status apds-gesture-ui.service

apds-gesture-ui's People

Contributors

liske avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.