Skip to content

Use your Raspberry Pi as a remote-controlled keyboard that accepts keystrokes through a web browser.

License

Notifications You must be signed in to change notification settings

EdSmilovici/key-mime-pi

 
 

Repository files navigation

Key Mime Pi

CircleCI License

Deprecation

This project is now DEPRECATED. I'll accept pull requests, but I am no longer fixing bugs.

The replacement is a project called TinyPilot, which offers all the functionality of Key Mime Pi plus:

  • Video capture
  • Support for OS- and browser-captured keystrokes (e.g., Ctrl+Alt+Del, Ctrl+W)
  • Better stability

Overview

Use your Raspberry Pi as a remote-controlled keyboard that accepts keystrokes through a web browser.

Key Mime Pi screenshot

Compatibility

  • Raspberry Pi 4
  • Raspberry Pi Zero W

Pre-requisites

  • Raspberry Pi OS Stretch or later
  • git
  • pip
  • python3-venv

Quick Start

To begin, enable USB gadget support on the Pi by running the following commands:

sudo ./enable-usb-hid
sudo reboot

When the Pi reboots, run Key Mime Pi with the following commands:

python3 -m venv venv
. venv/bin/activate
pip install --requirement requirements.txt
PORT=8000 ./app/main.py

Key Mime Pi will be running in your browser at:

Ansible installation

From your Ansible control node, run the following commands:

PI_HOSTNAME="raspberrypi" # Change to your pi's hostname
PI_SSH_USERNAME="pi"      # Change to your Pi username

# Install the Key Mime Pi Ansible role
ansible-galaxy install mtlynch.keymimepi

# Create a minimal Ansible playbook to configure your Pi
echo "- hosts: $PI_HOSTNAME
  roles:
    - role: mtlynch.keymimepi" > install.yml

ansible-playbook \
  --inventory "$PI_HOSTNAME", \
  --user "$PI_SSH_USERNAME" \
  --ask-pass \
  --become \
  --become-method sudo \
  install.yml

ansible \
  "$PI_HOSTNAME" \
  -m reboot \
  --inventory "$PI_HOSTNAME", \
  --user "$PI_SSH_USERNAME" \
  --ask-pass \
  --become \
  --become-method sudo

You should be able to access Key Mime Pi through a web browser at:

Development Installation

If you're interesting in contributing to Key Mime Pi, follow these instructions to install the required developer packages in your development environment:

python3 -m venv venv
. venv/bin/activate
pip install --requirement requirements.txt
pip install --requirement dev_requirements.txt
hooks/enable_hooks

To run Key Mime Pi's build scripts, run:

./build

To enable Key Mime Pi's Git hooks, run:

./hooks/enable_hooks

Options

Key Mime Pi accepts various options through environment variables:

Environment Variable Default Description
HOST 0.0.0.0 Network interface to listen for incoming connections.
PORT 8000 HTTP port to listen for incoming connections.
HID_PATH /dev/hidg0 Path to keyboard HID interface.

About

Use your Raspberry Pi as a remote-controlled keyboard that accepts keystrokes through a web browser.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 46.7%
  • JavaScript 20.8%
  • Shell 14.5%
  • HTML 9.5%
  • CSS 8.5%