Skip to content

Heart Rate Monitor via LoRaWAN

This project enables real-time heart rate monitoring using the Wireless Tracker connected to a MAX30102 pulse oximetry sensor. Data transmits via LoRaWAN to the SnapEmu platform for visualization.

ComponentPurpose
Heltec Wireless TrackerMain controller + LoRa TX
HT-M7603 Indoor LoRa GatewayLoRaWAN network gateway
MAX30102 Heart Rate SensorPulse oximetry sensor
DuPont WiresConnections

The MAX30102 connects via I2C:

MAX30102 PinTracker PinDescription
VCC3V3Power (3.3V)
GNDGNDGround
SDAGPIO45I2C Data
SCLGPIO46I2C Clock
  1. Configure LoRa Gateway

    Set up your HT-M7603 gateway with SnapEmu platform following the official Heltec documentation.

  2. Register Device on SnapEmu

    Register your Wireless Tracker node following the SnapEmu device connection guide.

  3. Install Libraries

    Required Arduino libraries:

    • Wire.h (built-in)
    • MAX30102_PulseOximeter.h
    • LoRaWan_APP.h (Heltec library)
  4. Test Sensor Standalone

    Upload the test code to verify sensor operation before adding LoRaWAN.

  5. Deploy Full Application

    Upload the complete LoRaWAN code with your OTAA credentials.

#include <Wire.h>
#include "MAX30102_PulseOximeter.h"
#define REPORTING_PERIOD_MS 1000
PulseOximeter pox;
uint32_t tsLastReport = 0;
void onBeatDetected() {
Serial.println("Beat detected!");
}
void setup() {
Serial.begin(115200);
Wire.begin(45, 46); // SDA=GPIO45, SCL=GPIO46
Serial.print("Initializing MAX30102..");
delay(3000);
if (!pox.begin()) {
Serial.println("FAILED");
for(;;);
} else {
Serial.println("SUCCESS");
}
pox.setIRLedCurrent(MAX30102_LED_CURR_7_6MA);
pox.setOnBeatDetectedCallback(onBeatDetected);
}
void loop() {
pox.update();
if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
float heartRate = pox.getHeartRate();
float spo2 = pox.getSpO2();
Serial.print("HR: ");
Serial.print(heartRate > 0 ? String(heartRate) : "N/A");
Serial.print(" bpm / SpO2: ");
Serial.print(spo2 > 0 ? String(spo2) : "N/A");
Serial.println("%");
tsLastReport = millis();
}
}

SnapEmu provides:

  • Real-time heart rate graph
  • SpO2 level monitoring
  • Historical data (up to 1 month)
  • Mobile app + web interface
IssueSolution
No heartbeat detectedEnsure finger is properly placed, adjust LED current
Erratic readingsClean sensor, reduce movement, check power supply
LoRa join failedVerify gateway connection, check OTAA credentials
Data not on platformCheck decoder function, verify port number matches

Based on the project by ashley15 on Hackster.io.