Building Your Own USB Typing Stick
A USB typing stick is a tiny device that pretends to be a keyboard when plugged into a computer. Instead of waiting for you to press physical keys, it automatically types out whatever script you’ve programmed into it. This simple trick opens a whole world of possibilities, from automation and testing to creative experiments with computer input.
What makes this device powerful is its ability to act as a USB Human Interface Device (HID). Computers naturally trust HID devices, so when your microcontroller announces itself as a keyboard, the system accepts it without hesitation.
Choosing the Microcontroller
The heart of the USB typing stick is the microcontroller. You need a chip that supports USB device mode, allowing it to impersonate a keyboard.
Common options include:
- Arduino Pro Micro (ATmega32U4) – Compact, inexpensive, and HID-ready.
- Teensy boards – Extremely capable and very small.
- Raspberry Pi Pico (RP2040) – Affordable, powerful, and supports HID through MicroPython or C++.
Each of these can be programmed to send keyboard input the moment the device receives power.
Programming the Device
On an Arduino Pro Micro, for example, programming the stick is as simple as writing a small sketch. Using the built-in Keyboard library, you can instruct the device to type any text automatically.
Here is a simple example:
#include <Keyboard.h>
void setup() {
delay(2000); // give the OS time to detect the device
Keyboard.print("hello world");
}
void loop() {}
After uploading this code, the device will begin typing "hello world" as soon as it's plugged into a computer.
Making It Look Like a USB Stick
Once the firmware works, the next step is creating a compact form. You can solder the microcontroller directly to a USB male connector or mount it inside an old USB flash drive case.
Common enclosure options:
- A gutted USB flash drive housing
- A small 3D-printed case
- A USB male plug adapter
- Heat-shrink tubing for a minimalist build
The goal is a clean, durable device that plugs in like a regular flash drive.
Creating a Programmable Version
Instead of recompiling code every time you want to change the script, you can create a version that loads a text file and types its contents.
Using a Raspberry Pi Pico and MicroPython, you can store a file named payload.txt on the device. The firmware reads the file and types its contents automatically.
A simple MicroPython script looks like this:
import time
import usb_hid
from hid_keyboard import Keyboard
kbd = Keyboard(usb_hid.devices)
time.sleep(2)
with open("payload.txt") as f:
for line in f:
kbd.print(line)
Updating the typed script becomes as easy as editing a text file.
Expanding the Capabilities
Once the basic typing stick works, there are many creative upgrades you can explore:
- Add multiple modes using a physical switch.
- Include an LED indicator to show the device is active.
- Store multiple payloads on a microSD card.
- Use a WiFi-enabled microcontroller to change scripts remotely.
- Add a tiny OLED display to select scripts before typing.
These enhancements turn the simple USB typing stick into a highly flexible automation tool.
Final Thoughts
Building a USB typing stick combines electronics, programming, and a bit of imaginative hardware design. Whether you’re automating repetitive tasks, experimenting with HID behaviors, or just enjoying the engineering challenge, this project opens the door to a strange and delightful corner of microcontroller creativity. The next step is tailoring it to your own needs, transforming it from a simple gadget into a tool that reflects your approach to automation.