Sensors

9-axis IMU capture window

A 2.5 s slice from the middle of a real 9-axis log: accelerometer, gyroscope, magnetometer at 100 Hz. The page states the hardware path and the firmware capture flow, then plots that window.

Sensors IMU9-axisdata capture ESP32

01 Overview

This is not an ESP-IDF example recap. It is a landed 9-axis capture from the lab, opened on a page so the numbers can be seen.

The raw file starts with a long header and unused GNSS columns. This page drops those fields and keeps accel, gyro and mag. 250 samples (~2.5 s at 100 Hz) are taken from the middle of the log.

Device AA-DB816B4C, firmware v1.0.3. Full scale: accel ±16 g, gyro ±2000 dps, mag 800 µT. Body axes, right-handed; xyz = forward, left, up.

GNSS is invalid in this slice, so there is no map. The plot is what the nine channels do while the board is moving.

Captured window (mid-log)

Device AA-DB816B4C, firmware v1.0.3, 100 Hz. 250 samples (~2490 ms) from the middle of the log. Accel / gyro / mag only — header and GNSS dropped.

t_msaccX_gaccY_gaccZ_ggyroX_dpsgyroY_dpsgyroZ_dpsmagX_uTmagY_uTmagZ_uT
0-0.1113-0.25150.9697-0.366-26.4020.122-35.33311.4332.567
10-0.1172-0.23880.98780.061-24.939-0.061-34.96711.5672.4
20-0.1313-0.22951.00050.122-24.7560.122-34.911.4332.9
30-0.1577-0.23881.0088-0.61-25.427-0.061-34.56711.4333.467
40-0.1899-0.26371.0132-1.341-25.9150.915-34.46711.3333.3
50-0.2178-0.27641.0244-1.402-26.5852.317-35.06711.3333.067
60-0.2329-0.25681.0454-1.89-28.3542.927-34.26711.5673.3
70-0.2314-0.22611.0649-4.146-29.7562.805-34.96711.2673.933
80-0.2153-0.20311.0884-5.549-30.9152.805-34.26711.3334.033
90-0.1919-0.1871.1089-6.951-32.9882.744-33.26711.7333.4
100-0.1753-0.18121.1152-8.598-35.8542.561-33.26711.6333.933
110-0.1758-0.18461.1211-8.476-38.4153.476-33.06711.3334.4
120-0.1943-0.19291.1294-6.89-41.8295.976-33.43311.1674.8
130-0.2202-0.20211.1289-4.695-47.1958.841-33.33311.2675.367
140-0.2363-0.211.1196-2.317-53.23211.524-33.511.5675.467
150-0.2363-0.21681.10450.427-58.7214.268-32.96711.15.7

Table shows 16 rows; the charts plot the full window.

02 Hardware

  • MCU: ESP32. It paces the sample, packs a line, and writes TSV.
  • Sensor: 9-axis IMU — 3-axis accel + 3-axis gyro + 3-axis mag. This window is aligned at 100 Hz. Mag native rate is 200 Hz; firmware time-aligns it.
  • Scale: accel 2048 LSB/g (±16 g); gyro 16.4 LSB/dps (±2000 dps); mag 30 LSB/µT (800 µT). The curves are already in physical units.
  • Bus: IMU on SPI or I2C (see the board schematic). The log is UART text, one sample time per line.
  • Power and mount: keep the IMU off inductors and antenna keep-out. Soft-magnetic housings bend the mag; leave a quiet volume.
  • Axes: right-handed, x forward, y left, z up. Firmware writes acc/gyro/mag in this body frame. Do not rotate them again on the page.

03 Software flow

1. After boot, init the IMU: full-scale, ODR 100 Hz, data-ready interrupt or a timer.

2. Every 10 ms read nine raw registers, scale to g / dps / µT. Attitude is optional; this page plots the nine raw channels.

3. One text line: timeMs plus nine numbers. GNSS writes nan when there is no fix; this page drops those columns.

4. A full log can be huge. The page cuts 250 points from the middle so the header does not get in the way.

5. The browser draws three charts — accel, gyro, mag — and a 16-row table so the magnitude can be checked by eye.

04 Core points

A shared 100 Hz time base matters more than running each sensor at its maximum rate.

A wrong full-scale setting doubles or halves the plot. The page uses the scales from the same log header.

The magnetometer hates steel and speaker magnets; the accelerometer hates mount resonance. Check this mid-log window for saturation first.

This window has no GNSS. A track is a different link. Do not mix it onto the nine-axis plot.

中文

传感器

9轴IMU采集窗口

从一段真实9轴日志的中段截取2.5秒:加速度计、陀螺仪、磁力计,100 Hz。页面给出硬件链路和固件采集流程,并画出这段数据。

传感器 IMU9-axisdata capture ESP32

01 项目概述

这不是官方案例复述。这是实验室里一段已落地的9轴采集日志,在网页上打开给人看。

原始文件带很长的文件头和 GNSS 空列。本页丢掉那些字段,只留加速度、陀螺、磁力计,并从整段日志中间切出 250 点(约 2.5 秒,100 Hz)。

设备号 AA-DB816B4C,固件 v1.0.3。量程:加速度 ±16 g,陀螺 ±2000 dps,磁力计 800 µT。机体坐标右手法则,xyz = 前、左、上。

这一段里 GNSS 无效,所以不画经纬度。看的是人拿着板在动时,九个数怎么一起变。

采集窗口(日志中段)

设备 AA-DB816B4C,固件 v1.0.3,100 Hz。从整段日志中间截取 250 点,约 2490 ms。只保留加速度 / 陀螺 / 磁力计,不含文件头和 GNSS。

t_msaccX_gaccY_gaccZ_ggyroX_dpsgyroY_dpsgyroZ_dpsmagX_uTmagY_uTmagZ_uT
0-0.1113-0.25150.9697-0.366-26.4020.122-35.33311.4332.567
10-0.1172-0.23880.98780.061-24.939-0.061-34.96711.5672.4
20-0.1313-0.22951.00050.122-24.7560.122-34.911.4332.9
30-0.1577-0.23881.0088-0.61-25.427-0.061-34.56711.4333.467
40-0.1899-0.26371.0132-1.341-25.9150.915-34.46711.3333.3
50-0.2178-0.27641.0244-1.402-26.5852.317-35.06711.3333.067
60-0.2329-0.25681.0454-1.89-28.3542.927-34.26711.5673.3
70-0.2314-0.22611.0649-4.146-29.7562.805-34.96711.2673.933
80-0.2153-0.20311.0884-5.549-30.9152.805-34.26711.3334.033
90-0.1919-0.1871.1089-6.951-32.9882.744-33.26711.7333.4
100-0.1753-0.18121.1152-8.598-35.8542.561-33.26711.6333.933
110-0.1758-0.18461.1211-8.476-38.4153.476-33.06711.3334.4
120-0.1943-0.19291.1294-6.89-41.8295.976-33.43311.1674.8
130-0.2202-0.20211.1289-4.695-47.1958.841-33.33311.2675.367
140-0.2363-0.211.1196-2.317-53.23211.524-33.511.5675.467
150-0.2363-0.21681.10450.427-58.7214.268-32.96711.15.7

表格先列 16 行;曲线由页面脚本画出全部采样点。

02 项目硬件描述

  • 主控: ESP32。定时采样、组帧、把一行 TSV 写出去。
  • 传感器: 9轴 IMU:三轴加速度 + 三轴陀螺 + 三轴磁力计。本窗口按 100 Hz 对齐。磁力计原生 200 Hz,固件侧对齐到同一时间轴。
  • 量程与刻度: 加速度 2048 LSB/g(±16 g);陀螺 16.4 LSB/dps(±2000 dps);磁力计 30 LSB/µT(800 µT)。页面上的曲线已经换成物理单位。
  • 总线: IMU 走 SPI 或 I2C(以板级原理图为准)。日志口是 UART 文本,一行一个采样时刻。
  • 电源与安装: 传感器远离电感和天线净空。壳体软磁材料会拧弯磁力计,安装时要留出无磁区。
  • 坐标: 右手法则,x 向前、y 向左、z 向上。固件按这套机体轴写 acc/gyro/mag,不要在网页上再转一次。

03 项目软件流程描述

1. 上电后初始化 IMU:写入量程、ODR=100 Hz、打开数据就绪中断或定时器。

2. 在 10 ms 节拍里读 9 个原始寄存器,按刻度换成 g / dps / µT,可选地算出 roll/pitch/yaw,但本页展示用原始九轴。

3. 一行文本:timeMs 和九个数。GNSS 若无定位就写 nan,本页采集展示直接丢掉这些列。

4. 整段日志可以很长。网页只切中段 250 点,避免文件头干扰阅读。

5. 浏览器把 250 点画成三条曲线:加速度、角速度、磁场。表格先列出前 16 行便于核对量级。

04 项目核心点

100 Hz 对齐比“三种传感器各自最快”更重要,融合和对照才有同一时间轴。

量程写错,曲线会整体差一倍。网页用的刻度来自同一份日志文件头。

磁力计怕铁壳和喇叭磁钢;加速度计怕安装共振。现场先看这段中段是否已经饱和。

本窗口无 GNSS。要轨迹是另一条链路,不要和九轴混在一张图上。