AdvancedWearables

Smart Gesture Ring

A compact finger-worn controller for slides, music and quick actions.

Time
3 h
Estimated cost
~£40
Hardware
Seeed Studio XIAO ESP32-C3

Prototype — not yet validated (wearable + battery)

Try it in the browser

What you will build

A tiny Bluetooth controller worn on your index finger. Your computer or phone sees it as a Bluetooth keyboard. Four gestures, no buttons needed:

Gesture Action Key sent
Flick right Next slide / next track Right arrow / Next track
Flick left Previous slide / previous track Left arrow / Previous track
Twist clockwise / anticlockwise Volume up / down Media volume keys
Double tap (two sharp knocks) Play / pause Media play/pause

A short press on the tiny mode button switches between Slides and Music mode.

How it works

The IMU's gyroscope measures how fast your finger rotates. A gesture is a short, sharp spike above a threshold on one axis: yaw spike = flick, roll spike = twist. A double tap is two acceleration spikes within 400 ms. After each gesture the code ignores motion for 350 ms (a "refractory period") so one movement never fires twice. The ESP32-C3 sends the result as a Bluetooth LE keyboard key.

Parts

Part Qty Purpose Required
Seeed Studio XIAO ESP32-C3 1 Controller + BLE + LiPo charging Yes
Small MPU6050 breakout (≤ 16 × 20 mm) 1 Gesture sensing Yes
6 mm tactile button 1 Mode switch Yes
3.7 V LiPo, 80–150 mAh, with protection circuit 1 Battery Yes
Thin silicone wire, heat-shrink, Velcro strap or printed band — Assembly Yes

Build steps

  1. Prototype on a breadboard first, USB powered: MPU6050 SDA → D4, SCL → D5, VCC → 3V3, GND → GND; button D1 → GND.
  2. Install Adafruit MPU6050 and ESP32 BLE Keyboard (T-vK). Check it compiles for XIAO ESP32-C3 on core v3.x; if not, use a maintained NimBLE fork and record the version on the page.
  3. Upload. Open the Serial Monitor: it prints gyro peaks. Do each gesture 10 times and note typical peak values; adjust FLICK_THRESHOLD and TWIST_THRESHOLD.
  4. Pair XBOT Ring in your computer's Bluetooth settings.
  5. Checkpoint: in Slides mode, flick right/left changes slides in a presentation; in Music mode, twist changes volume.
  6. Miniaturise: solder short silicone wires between the IMU and XIAO, stack them with foam tape, solder the protected LiPo to the battery pads (check polarity twice), insulate everything with heat-shrink, and fix it to a Velcro strap.

Try it in the browser

Interactive Preview. An animated hand demonstrates each gesture, and a gesture tester shows live gyro traces with the threshold lines when the ring is connected over USB (Web Serial). Without hardware, buttons replay recorded sample traces, labelled Sample data.

Code

Download smart-gesture-ring.ino

// Smart Gesture Ring — XBOTNOW
// Board: Seeed XIAO ESP32-C3 · Core: esp32 v3.x
// Libraries: Adafruit MPU6050, ESP32 BLE Keyboard (record exact version/fork)
#include <BleKeyboard.h>
#include <Adafruit_MPU6050.h>

const int MODE_BTN = D1;
const float FLICK_THRESHOLD = 5.0;   // rad/s on yaw (z)
const float TWIST_THRESHOLD = 5.0;   // rad/s on roll (x)
const float TAP_THRESHOLD = 25.0;    // m/s^2 total acceleration spike
const unsigned long REFRACTORY_MS = 350, DOUBLE_TAP_MS = 400;

BleKeyboard kb("XBOT Ring", "XBOTNOW", 100);
Adafruit_MPU6050 mpu;
bool musicMode = false;
unsigned long lastGesture = 0, firstTap = 0, lastTelemetry = 0;

void send(const char* name, uint8_t slideKey, const MediaKeyReport musicKey) {
  if (musicMode) kb.write(musicKey); else kb.write(slideKey);
  Serial.println(name);
  lastGesture = millis();
}

void setup() {
  Serial.begin(115200);
  pinMode(MODE_BTN, INPUT_PULLUP);
  if (!mpu.begin()) { Serial.println("MPU6050 not found"); while (1) delay(500); }
  mpu.setGyroRange(MPU6050_RANGE_1000_DEG);
  mpu.setAccelerometerRange(MPU6050_RANGE_8_G);
  kb.begin();
}

void loop() {
  if (digitalRead(MODE_BTN) == LOW) {
    musicMode = !musicMode; Serial.println(musicMode ? "Mode: Music" : "Mode: Slides"); delay(400);
  }
  sensors_event_t a, g, t; mpu.getEvent(&a, &g, &t);
  if (millis() - lastTelemetry >= 50) {
    lastTelemetry = millis();
    Serial.printf("{\"gx\":%.2f,\"gz\":%.2f}\n", g.gyro.x, g.gyro.z);
  }
  if (!kb.isConnected()) { delay(10); return; }
  if (millis() - lastGesture < REFRACTORY_MS) { delay(5); return; }

  float gz = g.gyro.z, gx = g.gyro.x;
  float acc = sqrt(sq(a.acceleration.x) + sq(a.acceleration.y) + sq(a.acceleration.z));

  if (gz > FLICK_THRESHOLD)        send("Flick right", KEY_RIGHT_ARROW, KEY_MEDIA_NEXT_TRACK);
  else if (gz < -FLICK_THRESHOLD)  send("Flick left",  KEY_LEFT_ARROW,  KEY_MEDIA_PREVIOUS_TRACK);
  else if (gx > TWIST_THRESHOLD)   { kb.write(KEY_MEDIA_VOLUME_UP);   Serial.println("Vol +"); lastGesture = millis(); }
  else if (gx < -TWIST_THRESHOLD)  { kb.write(KEY_MEDIA_VOLUME_DOWN); Serial.println("Vol -"); lastGesture = millis(); }
  else if (acc > TAP_THRESHOLD) {
    if (firstTap && millis() - firstTap < DOUBLE_TAP_MS) {
      kb.write(KEY_MEDIA_PLAY_PAUSE); Serial.println("Double tap"); firstTap = 0;
    } else firstTap = millis();
    lastGesture = millis() - REFRACTORY_MS + 120;   // short lockout between taps
  }
  delay(5);
}

Troubleshooting

Symptom Likely cause Check
Gestures fire while typing or walking Thresholds too low Raise thresholds; use mode button to pause (add an Off mode)
Flick left fires after flick right Rebound motion Increase REFRACTORY_MS to 450
Library compile errors BLE library vs core version Use the documented fork/version
Short battery life Constant BLE + IMU Expected 2–4 h on 100 mAh; add sleep in Next steps

Safety and limitations

Protected LiPo only. Never wear it while charging, and stop if it gets warm or swells. Insulate every solder joint: a short on a finger-worn battery can burn. Remove it before washing hands. Gesture recognition is threshold-based and will sometimes misfire; it is not an accessibility-certified input device.

Checklist

Next project

Invisible Room: sense people without anything to wear at all.

Next project: Invisible Room — mmWave Smart Space