Skip to content

ESP32 - Streams BNO005 IMU and ThinPot depth over BLE with motion-aware filtering. ESP32 -> BLE - roll/pitch/yaw + depth (ThinPot) with Median/Kalman/EMA adaptive filtering. IMU and Depth to VisionOS/VR via BLE

Notifications You must be signed in to change notification settings

SINRG-Lab/visionos-esp32-sensor-bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

visionos-esp32-sensor-bridge

Overview

Firmware for ESP32 that reads BNO055 orientation (roll, pitch, yaw) and ThinPot analog depth, applies motion-aware filtering (median for spikes, raw while moving, heavy Kalman + EMA + SMA when stationary), and streams telemetry over BLE for VisionOS/VR clients.

Features

  • Sensors: Adafruit BNO055 + ThinPot.
  • Adaptive filtering:
    • Median filter (window=5) to de-spike input.
    • Motion detection via recent variation.
    • While moving → raw values for responsiveness.
    • When stationary → Kalman + exponential smoothing (α=0.02) + 10-sample moving average.
    • Auto-reset of filter state at motion→stationary transition to prevent lag.
  • BLE telemetry: NimBLE-based server with notifications at 10 Hz (delay(100)).

BLE

  • Service UUID: "180C"
  • Characteristic UUID: "2A56" (notify + read)
  • Payload (CSV): roll_deg,pitch_deg,yaw_deg,depth_mm
    Example: 12.34,-1.02,178.90,57.3

Build & Dependencies

  • Board: ESP32 Nano
  • Baud: 115200
  • Libraries:
    • Adafruit_BNO055
    • Adafruit Unified Sensor
    • NimBLE-Arduino
  • Notes: bno.setExtCrystalUse(true) enabled.

Calibration

On boot, you’ll see a prompt; place the sensor in the desired starting orientation. After ~3 s, the code captures zero offsets (setZero()).

Tuning

Key parameters near the top of the sketch:

  • MOTION_THRESHOLD (mm), MOTION_SAMPLES
  • MEDIAN_WINDOW
  • Stationary filter: Q, R, alpha, and STATIONARY_THRESHOLD

Wiring (typical)

  • BNO055: SDA → ESP32 SDA, SCL → ESP32 SCL, 3V3, GND
  • ThinPot: Wiper → THINPOT_PIN (ADC), ends to 3V3 and GND

Output Rate

~10 Hz notifications (adjust delay(100)).

Use Cases

  • VisionOS / VR dashboards
  • Haptics/robot control panels that need stable depth at rest and low-latency motion updates

About

ESP32 - Streams BNO005 IMU and ThinPot depth over BLE with motion-aware filtering. ESP32 -> BLE - roll/pitch/yaw + depth (ThinPot) with Median/Kalman/EMA adaptive filtering. IMU and Depth to VisionOS/VR via BLE

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages