Turn your Raspberry Pi Zero W into a USB keyboard with remote access
  • Python 83.7%
  • Shell 16.3%
Find a file
2020-09-14 10:30:15 +02:00
gadgetsetup.sh initial commit 2020-02-25 19:53:08 +01:00
keycodes.py added password entry mode, support for other keyboard layouts 2020-09-10 11:01:04 +02:00
README.md added more usage info 2020-09-10 11:15:41 +02:00
sendkeys.py better permission handling 2020-09-14 10:30:15 +02:00

Raspberry Pi Remote Keyboard

This is some Bash and Python code to setup and run a Raspberry Pi Zero W as a USB HID gadget, e.g. to use it as an USB keyboard with remote access via wifi.

The Pi is back-powered over the USB port of the connected computer and doesn't need an additional power supply.

Setup

  1. Connect your Pi to your computer using the Pi's Micro-USB data port
  2. Enable required device tree overlay and modules:
> echo "dtoverlay=dwc2" | sudo tee -a /boot/config.txt
> echo "dwc2" | sudo tee -a /etc/modules
  1. Put /your/absolute/path/to/gadgetsetup.sh into /etc/rc.local to run the script at boot
  2. Reboot the Pi

Usage

> sudo ./sendkeys.py "string"    # send "string" to connected computer, simulating keyboard input
> sudo ./sendkeys.py -l de -p    # send something using german keyboard layout and password mode (no echo)
> sudo ./sendkeys.py -h          # show help

Credits

Specs