|
MAX30001G 1.4.2
Arduino library for MAX30001G ECG and BIOZ AFE
|
This is the MAX30001 library for Arduino. It attempts to be complete and supports impedance spectroscopy.
This library has been validated for ECG, continuous BIOZ, combined ECG+BIOZ, internal calibration paths, and the nonblocking BIOZ scan flow that is driven through setup...(), start(), and repeated update().
This library and example programs enable impedance spectroscopy, reporting impedance magnitude and phase versus modulation frequency.
Internal 1 kOhm resistor scan validation works across the full 128 kHz down to 125 Hz scan range.
External fixture validation was completed over the 1024 to 131072 Hz modulation range.
External scan output uses the cosine fit to estimate complex impedance magnitude and phase.
Uncorrected cosine-fit magnitude is underestimated, so a calibration model was developed. The selected first correction is a simple global magnitude scale with K = 1.25065.
The external BIOZ scan can report a provisional reliability score with each corrected spectrum point:
| Corrected magnitude | 1024 Hz | 2048 Hz | 4096 Hz | 8192 Hz | 18204 Hz | 40960 Hz | 81920 Hz | 131072 Hz |
|---|---|---|---|---|---|---|---|---|
| <20 ohm | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| 20 ohm - 5 kOhm | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 |
| 5 kOhm - 10 kOhm | 3 | 3 | 3 | 3 | 3 | 3,2 | 3,1 | 3,1 |
| 10 kOhm - 33 kOhm | 3 | 3 | 3 | 3 | 1 | 1 | 1 | 1 |
| 33 kOhm - 50 kOhm | 3 | 3 | 3 | 1 | 1 | 1 | 1 | 1 |
| 50 kOhm - 100 kOhm | 2 | 2 | 1 | 1 | 1 | 1 | 1 | 1 |
| 100 kOhm - 150 kOhm | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| >150 kOhm | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Phase downgrade rules for marked cells:
3,2: if abs(phase_deg) >= 20, then r = 2; otherwise r = 3.3,1: if abs(phase_deg) >= 25, then r = 1; otherwise r = 3.Install the library in Arduino IDE or clone the GitHub repository into your Arduino libraries folder.
This driver depends on
Using Arduino-style setup() / loop() with setup + start/update/stop:
BIOZ spectroscopy uses the same configure/start/update lifecycle, but setupBIOZScan(...) only configures the scan. Call start() once, then keep calling update() until a spectrum becomes available in BIOZ_spectrum.
The sketch that reflects the latest driver organization most closely is examples/MAX30001G_BLESerial_Display_Sleep/MAX30001G_BLESerial_Display_Sleep.ino.
It is an interactive USB serial and BLE Serial utility for exercising the current driver layers, switching modes, applying settings, running health checks, and validating scan/calibration flows from one sketch. The USB-only variant is examples/MAX30001G/MAX30001G.ino.
When you open the USB serial monitor or connect over BLE Serial and type ?, the sketch prints this help menu:
**examples/MAX30001G_BLESerial/MAX30001G_BLESerial_Display_Sleep.ino** and **examples/MAX30001G/MAX30001G.ino**: interactive serial test program covering all options of the software including mode switches, setup helpers, calibration, scan control, and register inspection.
The BLESerial version allows wireless access to the device. You can use BLESerial in SerialUI.
The other maintained example sketches match the current driver structure:
examples/ECG/ECG.ino: continuous ECG using setupECG(...), start(), and repeated update()examples/BIOZ/BIOZ.ino: continuous fixed-frequency BIOZ using setupBIOZ(...)examples/ECGandBIOZ/ECGandBIOZ.ino: simultaneous ECG and BIOZ using setupECGandBIOZ(...)examples/BIOZScan/BIOZScan.ino: external nonblocking BIOZ spectroscopy using setupBIOZScan(...)examples/BIOZScan_Internal/BIOZScan_Internal.ino: internal-resistor scan validation using the same scan-owned state machineexamples/BIOZScan_Internal_Fast/BIOZScan_Internal_Fast.ino: fast reduced-phase internal-resistor full-spectrum validationexamples/Hardware_HealthCheck/Hardware_HealthCheck.ino: startup communication and hardware checksexamples/ECG_FIFOInterruptValidation/ECG_FIFOInterruptValidation.ino: ECG FIFO interrupt and ECG_data validationexamples/BIOZ_FIFOInterruptValidation/BIOZ_FIFOInterruptValidation.ino: BIOZ FIFO interrupt and BIOZ_data validationexamples/ECGandBIOZ_FIFOInterruptValidation/ECGandBIOZ_FIFOInterruptValidation.ino: combined FIFO drain validationexamples/BIOZ_Internal_ImpedanceCalibration/BIOZ_Internal_ImpedanceCalibration.ino: internal BIST point measurements outside the scan flowexamples/BIOZ_External_ImpedanceCalibration/BIOZ_External_ImpedanceCalibration.ino: external known-load impedance calibrationexamples/BIOZ_SignalCalibration/BIOZ_SignalCalibration.ino and examples/ECG_SignalCalibration/ECG_SignalCalibration.ino: internal signal-generator calibration pathsSee LICENSE.
Read Validation.md, Refactor.md, and examples/MAX30001G/MAX30001G.ino first. Then start your agentic programming session.
The MAX30001G is a highly integrated analog front end that consists of a differential ECG channel with optional right-leg drive. It employs standard high-pass and low-pass filters, an instrumentation amplifier, and an analog-to-digital converter.
The impedance unit consists of a current driver, analog high-pass filter, and phase-shifted demodulator to measure impedance from 128kHz down to 125Hz modulation frequency at varying phase shifts. Internal-BIST validation shows coherent full-spectrum scans with dynamic AHPF selection. External fixture validation supports a magnitude-corrected cosine-fit scan model for the validated low/moderate impedance region, while high-frequency/high-impedance measurements should be interpreted using the reported reliability score.
Besides ESD protection, the input MUX can detect lead-off and lead-on conditions. In addition, it can switch input electrode polarity and correct common-voltage bias on the subject. Input can be turned off and replaced with an internal signal generator for testing purposes.
Similar to the ECG input MUX, the BIOZ input MUX has ESD protection as well as lead-on and lead-off detection. Besides input signal calibration, a programmable resistor can be measured internally as simulated impedance.