@thehighestbit/node-red-contrib-vibration-ism330dhcx 1.0.2
Node-RED node for vibration sensing using the STMicroelectronics ISM330DHCX 6-axis IMU
node-red-contrib-vibration-ism330dhcx
A Node-RED node for vibration sensing using the STMicroelectronics ISM330DHCX 6-axis IMU over I2C. Continuously samples the accelerometer, computes time- and frequency-domain vibration metrics on fixed-size windows and emits both per-window values for live charting and an aggregated record for long-term storage.
Installation
cd ~/.node-red
npm install @thehighestbit/node-red-contrib-vibration-ism330dhcx
Configuration
| Property | Description |
|---|---|
| Data Rate | Accelerometer output data rate (12.5 Hz – 6.66 KHz). Higher rates resolve higher vibration frequencies but produce more data. |
| Measurement Range | Full-scale acceleration range (±2g, ±4g, ±8g, ±16g). Pick the smallest range that still covers your expected peaks. |
| High Pass Filter | Optional accelerometer high-pass filter to remove DC / gravity bias (None, Slope, ODR/10 … ODR/800). |
| Window Size | Number of samples per analysis window (128 – 65536). Larger windows give finer frequency resolution but slower update rate. |
| Output Interval | How often the aggregated metrics record (output 1) is emitted, in ms. Defaults to 30000. |
The gyroscope is intentionally powered down — only the accelerometer is used.
Outputs
The node has 5 outputs. Output 1 is intended for database storage; outputs 2–5 are intended for live charts (e.g. Node-RED Dashboard 2.0). All amplitude values (mean, RMS, peak, top-peak magnitudes) are in m/s².
1. Aggregated metrics
Emitted every Output Interval ms. Aggregates all per-window metrics computed since the last emission.
{
"payload": {
"ts_start": 1714400000000,
"ts_end": 1714400030000,
"window_size": 256,
"avg_mean": 9.83,
"max_peak": 24.33,
"overall_rms": 10.14,
"avg_crest_factor": 2.41,
"avg_kurtosis": 3.12,
"dominant_freq": 124.5,
"top_peaks": [
{ "f": 124.5, "m": 18.2 },
{ "f": 249.0, "m": 7.4 }
]
}
}
dominant_freq and top_peaks are taken from the highest-RMS window in the interval (a "worst-case spectral snapshot"), since averaging FFT peaks across windows is unreliable when frequencies drift.
2. RMS / Peak (m/s²)
Emitted once per analysis window as two messages with topics RMS and Peak.
3. Crest Factor
Emitted once per analysis window with topic Crest Factor. Ratio of peak to RMS — useful for detecting impulsive faults.
4. Kurtosis
Emitted once per analysis window with topic Kurtosis. Fourth-moment statistic — rises sharply when the signal contains transients.
5. Dominant Frequency (Hz)
Emitted once per analysis window with topic Dominant Frequency. Frequency of the largest FFT magnitude bin (DC removed, Hann-windowed, zero-padded to next power of two).
How it works
- The accelerometer is configured with the chosen rate, range and (optional) high-pass filter, and put into FIFO continuous mode.
- Every 10 ms the FIFO is drained and the magnitude
√(x² + y² + z²)of each sample is appended to a rolling buffer. - Once the buffer reaches
Window Sizesamples, that window is consumed and metrics are computed: mean, RMS, peak, crest factor, kurtosis, and an FFT (DC-removed, Hann-windowed, zero-padded). The five strongest spectral peaks are picked greedily with a minimum separation of three FFT bins so a single true peak cannot fill multiple slots. - Per-window metrics go out on outputs 2–5 immediately and are also stashed for aggregation.
- Every
Output Intervalms, the stashed metrics are aggregated and emitted on output 1.