Skip to content

PCPartPicker/tinypilot

 
 

Repository files navigation

TinyPilot

CircleCI License

Overview

Turn your Raspberry Pi into a browser-based KVM.

TinyPilot demo

Pre-requisites

  • Raspberry Pi OS Stretch or later
  • python3-venv

Hardware requirements

All-in-one kits are available from tinypilotkvm.com.

See "TinyPilot: Build a KVM Over IP for Under $100" for a more detailed tutorial on how to assemble these parts to create a TinyPilot.

Simple installation

The following installation steps:

  • Create a service account for TinyPilot with limited priviliges.
  • Install TinyPilot as a systemd service so it runs automatically on every boot.
  • Install TinyPilot's dependencies.

From your Raspberry Pi device, run the following commands:

curl \
  --silent \
  --show-error \
  https://raw.githubusercontent.com/mtlynch/tinypilot/master/quick-install | \
    bash - && \
  sudo reboot

When your Pi reboots, you should be able to access TinyPilot by visiting your Pi hostname in the browser. For example, if your device is named raspberrypi:

Advanced installation

To choose configuration options for the install, specify them in the TINYPILOT_INSTALL_VARS environment variable.

Possible variables are available in:

Here's an example that installs TinyPilot with a desired capture resolution of 1280x720 and chooses the 1.0.2 version of TinyPilot.

export TINYPILOT_INSTALL_VARS="ustreamer_resolution=1280x720 tinypilot_repo_branch=1.0.2"
curl \
  --silent \
  --show-error \
  https://raw.githubusercontent.com/mtlynch/tinypilot/master/quick-install | \
    bash - && \
  sudo reboot

To apply these installation options on every update, add them to your .bashrc file:

echo 'export TINYPILOT_INSTALL_VARS="ustreamer_resolution=1280x720 tinypilot_repo_branch=1.0.2"' >> ~/.bashrc
. ~/.bashrc

Remote installation

If you have Ansible installed on your local machine, you can configure TinyPilot on a Raspberry Pi device using the TinyPilot Ansible role. To configure TinyPilot remotely, run the following commands from your Ansible control node:

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

# Install the TinyPilot Ansible role
ansible-galaxy install mtlynch.tinypilot

# Create a minimal Ansible playbook to configure your Pi
echo "- hosts: $PI_HOSTNAME
  roles:
    - role: mtlynch.tinypilot" > 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

After running these commands, you should be able to access TinyPilot through a web browser at:

Developer installation

If you're interested in contributing to TinyPilot, follow these instructions to install the required developer packages in your development environment:

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

npm install [email protected]

To run TinyPilot's build scripts, run:

./dev-scripts/build

To enable TinyPilot's Git hooks, run:

./hooks/enable_hooks

To run TinyPilot on a non-Pi machine, run:

PORT=8000 KEYBOARD_PATH=/dev/null ./app/main.py

Options

TinyPilot 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.
KEYBOARD_PATH /dev/hidg0 Path to keyboard HID interface.

Upgrades

The installation script is idempotent, so you can upgrade to the latest stable release of TinyPilot and its dependencies by just re-running the quick install script.

Enable read-only filesystem

You can increase the lifetime of your microSD card and reduce the risk of filesystem corruption from unplanned shutdowns by enabling read-only mode on your Pi.

As the name implies, the read-only filesystem makes it so that no writes to the filesystem persist across reboots. To perform system updates or make permanent changes to your TinyPilot, you'll need to disable the read-only filesystem.

To enable read-only mode / overlay filesystem:

  1. sudo raspi-config
  2. Choose 7 - Advanced options
  3. Choose AB - Overlay FS
  4. When prompted, "Would you like the overlay file system to be enabled?" choose "Yes"
  5. When prompted "Would you like the boot partition to be write-protected?" choose "No"
  6. Choose "Finish"
  7. When prompted "Would you like to reboot now?" choose "Yes"

Read-only mode slows down the boot process, so don't worry if your reboot takes 2-3x as long as normal.

To disable read-only mode, follow the same steps as above, but when prompted, "Would you like the overlay file system to be enabled?" choose "No".

Alternatively, you can use the overlayfs script to control this behavior without leaving the command-line.

Security considerations

TinyPilot does not support authentication. You should only use TinyPilot on networks that you trust. Anyone who accesses the TinyPilot URL can shutdown or restart your Pi and type arbitrary commands into the device to which your Pi is connected.

If you need authentication, the simplest solution would be to adjust your Nginx configuration (included by default with the installation) to require HTTP Basic Authentication.

Support

If this project is useful to you, consider making a financial contribution to support its development:

Detailed project updates

If you're interested in seeing what's happening with the project at a granular level, weekly updates appear every Friday on What Got Done:

See also

Mailing list

For news about major TinyPilot releases and other updates about the project, sign up for the TinyPilot mailing list:

About

Use your Raspberry Pi as a browser-based KVM.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 33.0%
  • JavaScript 24.7%
  • Shell 16.4%
  • HTML 13.3%
  • CSS 12.6%