Support magnetometer and barometer if available #24

Closed
opened 2026-02-28 17:39:15 -05:00 by seb · 0 comments
Owner

Request

The firmware should detect and use compass (magnetometer) and barometer sensors if present on the board or added externally.

Magnetometer

  • Provides absolute yaw heading — eliminates gyro drift (#21)
  • Fuse with gyro Z via complementary or Madgwick filter for drift-free yaw
  • Common chips: QMC5883L, HMC5883L, IST8310 (I2C)
  • MAMBA F722S status: no onboard mag — would need external module on I2C1 (PB8/PB9)

Barometer

  • Provides altitude estimate (useful for future stair detection, ramp awareness)
  • MAMBA F722S: BMP280 or DPS310 on I2C1 (PB8/PB9)
  • Previously noted: I2C init hangs — needs debugging
  • Even if not used for balance, log the data in telemetry for the Jetson

Implementation

  • Auto-detect sensors on I2C bus at boot (WHO_AM_I probes)
  • If mag found: fuse into yaw estimate, add mx/my/mz or heading to telemetry JSON
  • If baro found: add alt (relative altitude in cm) to telemetry JSON
  • If not found: skip gracefully, no error
  • Update web UI to display heading and altitude when available

Related: #21 (yaw drift), #23 (boot calibration)

## Request The firmware should detect and use compass (magnetometer) and barometer sensors if present on the board or added externally. ### Magnetometer - Provides absolute yaw heading — eliminates gyro drift (#21) - Fuse with gyro Z via complementary or Madgwick filter for drift-free yaw - Common chips: QMC5883L, HMC5883L, IST8310 (I2C) - **MAMBA F722S status:** no onboard mag — would need external module on I2C1 (PB8/PB9) ### Barometer - Provides altitude estimate (useful for future stair detection, ramp awareness) - **MAMBA F722S:** BMP280 or DPS310 on I2C1 (PB8/PB9) - Previously noted: I2C init hangs — needs debugging - Even if not used for balance, log the data in telemetry for the Jetson ### Implementation - Auto-detect sensors on I2C bus at boot (WHO_AM_I probes) - If mag found: fuse into yaw estimate, add `mx/my/mz` or `heading` to telemetry JSON - If baro found: add `alt` (relative altitude in cm) to telemetry JSON - If not found: skip gracefully, no error - Update web UI to display heading and altitude when available Related: #21 (yaw drift), #23 (boot calibration)
seb closed this issue 2026-02-28 18:45:26 -05:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: seb/saltylab-firmware#24
No description provided.