Skip to content

NOTES

Offline Sensing — High-Rate Batch Acquisition, Local Storage

Acquire data at high rates (default 100 Hz) for a fixed duration (default 10 s), store to memory and/or SD card, then send an MQTT report on completion. Ideal for impact testing and modal analysis.

Intuition

Why Higher Rate Than Online?

Online is "acquire and transmit at the same time" — bandwidth-limited. Offline is "acquire first, transmit later" — sprint during acquisition:

  • Data goes to local buffers (memory or SD card)
  • MQTT report is sent after the acquisition completes
  • Not constrained by network bandwidth

Memory Budget

rate × axes × bytes/sample × duration = buffer size
100 Hz × 3 (x,y,z) × 4 bytes × 10 s = 12 KB

Default config needs only 12 KB. At 4000 Hz × 60 s, that's ~2.8 MB — use PSRAM or SD card.

Data Flow

"SENSE,OFFLINE,F=100,D=10" via MQTT
Init memory/SD buffers
ESP timer fires every 10 ms (100 Hz)
Read ADXL355 → memory buffer / SD card
Timer expires → stop
MQTT report (count, duration, file path, etc.)

API

typedef struct {
    float sampling_frequency_hz;       // rate in Hz, default 100.0
    float sampling_duration_sec;       // seconds, default 10.0
    bool enable_memory;
    bool enable_sd;
    bool enable_mqtt_report;
    const char *sd_file_path;
    const char *mqtt_report_topic;
} offline_sensing_config_t;

esp_err_t offline_sensing_start(const offline_sensing_config_t *config);
esp_err_t offline_sensing_stop(void);
bool offline_sensing_is_running(void);

Notes

4000 Hz max is ADXL355's hardware limit

The sensor's physical ODR ceiling.

SD for long acquisitions

Memory is limited; SD stores more. Use both for high-rate + long-duration.

Auto-generated file names

SD file names follow sensor_YYMMDD_HHMMSS.csv when not specified, preventing overwrites.