Physical inputs · WebUSB · p5.js

Connect StemmaQT devices
to p5.js sketches in your browser

StemmaWeb bridges Adafruit StemmaQT sensors to the browser via WebUSB. Turn physical knobs, sliders, and touch pads into live inputs for creative code — no server, no drivers.

How it works

Five steps from hardware to browser — all over USB, no drivers or servers required.

StemmaQT Module

Rotary encoder, touch sensor, gyroscope…

Trinkey RP2040

Reads I²C, speaks USB

USB

Physical connection, no drivers

WebUSB API

Browser talks directly to the Trinkey

p5.js Sketch

Your creative code gets live sensor data

A few lines of code

Call startRotaryEncoder() inside p5.js's preload() and the device is ready by the time setup() runs. Read values in draw() or react to events with named callbacks.

Every device follows the same pattern — just swap the start function and method names.

Explore First Steps →
let encoder;

function preload() {
  encoder = startRotaryEncoder();
}

function setup() {
  createCanvas(400, 400);
}

function draw() {
  let angle = map(encoder.getValue(), 0, 100, 0, TWO_PI);
  background(20);
  translate(width / 2, height / 2);
  rotate(angle);
  fill(99, 102, 241);
  rect(-80, -8, 160, 16, 4);
}

function rotaryEncoderChanged(event) {
  console.log('Position:', event.detail.value);
}

Get started in four steps

Everything you need, from hardware to running sketch.

1

Buy the hardware

Pick up an Adafruit Trinkey RP2040 QT and any supported StemmaQT module from the Adafruit shop.

2

Flash the firmware

Download the prebuilt firmware and drag it onto the Trinkey — it reboots in seconds, no toolchain needed.

3

Load the library

Add one script tag to your p5.js sketch. The StemmaWeb library registers the start functions automatically.

4

Write code

Call startRotaryEncoder(), startTouchSensor(), or any other start function and your device is live.

Built for creative work

From classroom to gallery — StemmaWeb fits wherever creative code meets the physical world.

Learning

Immediate feedback makes physical computing concepts click. Students see the effect of turning a knob in their sketch before writing a single event handler.

Exhibitions

Build interactive installations that run entirely in the browser. No app to install, no backend to maintain — just a USB cable and a URL.

Rapid Prototyping

Test hardware interaction ideas in minutes. Swap devices, tweak mappings, and iterate without touching firmware or wiring a custom PCB.

Free and open source

StemmaWeb is MIT-licensed. The firmware, client library, and this site are all on GitHub. Contributions, bug reports, and feature ideas are welcome.

View on GitHub