Sensor Data Acquisition¶
TinyMeasurement — The Data Acquisition Pipeline for SHM Nodes
From ADXL355 accelerometer readings to MQTT remote transmission. Covers three acquisition modes and three real-time processing architectures. Fully command-driven via MQTT.
Architecture¶
-
Online Sensing
Continuous timer-based streaming (1~20 Hz)
MQTT / serial real-time output
Long-term structural monitoring -
Offline Sensing
High-rate batch acquisition (100~4000 Hz)
Memory / SD card storage
MQTT report on completion
Modal analysis, impact testing -
RT Processing
Three compile-time architectures:
Ring buffer / DMA double buffer / Dual-core
Real-time threshold-triggered detection
Online damage detection -
Command Handler
MQTT remote commands → control acquisition
SENSE,ONLINE/OFFLINE/RT
Scheduled and delayed triggering -
WSN Time Sync (FTSP)
Flooding Time Synchronization Protocol over ESP-NOW
Gateway broadcasts periodic beacons + NTP world time
Leaf nodes run linear regression for clock skew correction
Sync visualization via RGB LED (marquee color cycling)
Microsecond precision · Drift compensation
Use Case Index¶
-
Long-term SHM monitoring
→ Online Sensing, low rate (1~20 Hz), continuous MQTT upload
-
Impact testing / modal analysis
→ Offline Sensing, high rate (100~4000 Hz), SD card storage
-
Real-time impact / damage detection
→ RT Processing + threshold trigger, microsecond response
-
Remote command & control
→ Command Handler, start/stop acquisition remotely via MQTT
Quick Start¶
#include "tiny_measurement.h"
// === Online (long-term monitoring) ===
online_sensing_config_t online_cfg = {
.sampling_frequency_hz = 20.0f,
.enable_mqtt = true,
.enable_serial = true,
};
online_sensing_start(&online_cfg); // start 20 Hz streaming
// === Offline (modal test) ===
offline_sensing_config_t offline_cfg = {
.sampling_frequency_hz = 100.0f,
.sampling_duration_sec = 30.0f,
.enable_memory = true,
.enable_sd = true,
.enable_mqtt_report = true,
};
offline_sensing_start(&offline_cfg);
// === RT Processing (impact detection) ===
rt_process_config_t rt_cfg = {
.sampling_frequency_hz = 100.0f,
.enable_accel_detection = true,
};
rt_process_init(&rt_cfg);
rt_process_start();
Mode Comparison¶
| Online | Offline | RT Processing | |
|---|---|---|---|
| Rate | 1~20 Hz | 100~4000 Hz | 20~1000 Hz |
| Duration | Continuous | Bounded (seconds) | Continuous |
| Output | MQTT stream / serial | Memory / SD / MQTT report | Processed results |
| Use case | Long-term monitoring | Modal analysis | Impact/damage detection |
| Trigger | MQTT command | MQTT (supports delay) | MQTT + auto-threshold |
Dependency Chain¶
ADXL355 sensor → tiny_measurement → MQTT / SD card / serial
↑
tiny_ai (signal processing)
WSN time sync (FTSP):
Gateway: NTP (Internet) → tiny_toolbox/tiny_time → FTSP beacon (ESP-NOW)
Leaf: FTSP beacon → linear regression → world time @ µs precision
Code Structure¶
include/ tiny_measurement.h · tiny_measurement_config.h
online-sensing/ online acquisition
offline-sensing/ offline acquisition
command/ MQTT command parser
real-time-process-arch/ RT architectures (3 types)
wsn/ WSN utilities
time_sync/ FTSP time synchronization module
ftsp.h Unified entry header
ftsp_config.h Compile-time tuning (beacon interval, table size, ...)
ftsp_types.h Beacon packet layout (16 B basic / 26 B extended)
ftsp_gateway.h/.c Gateway periodic beacon broadcast
ftsp_leafnode.h/.c Leaf beacon sniffer + linear regression
ftsp_ntp.h/.c NTP sync recording & world-time anchor
ftsp_precision.h/.c Clock drift estimation & compensation (ppm)
ftsp_sync_viz.h/.c RGB LED sync status visualization
app/ application examples