Software NEXT firmware

Recording Data

Last updated Jul 10, 2026

HealthyPi 5 can record signals in three places: on the microSD card in the board, on a computer through OpenView 2, or on a phone through the OpenView 2 mobile app.

What you get depends on which firmware you’re running.

Destination Arduino (NEXT) Zephyr
microSD card ✅ binary /REC*.BIN ✅ CSV
Computer (OpenView 2 desktop) ✅ CSV ✅ CSV
Phone (OpenView 2 mobile) ✅ CSV
Fetch SD logs over BLE

Requirements

  • HealthyPi 5 (any kit)
  • USB-C cable for power (not included)
  • For SD recording: a microSD card (not included), FAT-formatted, in the slot on the underside of the main board

Recording to a computer

Works on either firmware, and it’s the simplest option. Run a normal OpenView 2 desktop session and click Start Logging before or during the stream; Stop writes a CSV. Full walkthrough: Streaming to OpenView 2.

Recording to the SD card — Arduino (NEXT)

Add one line to enable the SD sink:

HealthyPi5.recordSD();     // before begin()

Then start and stop a recording either from code or over the USB command plane:

HealthyPi5.recordStart();  // opens a new /REC*.BIN
HealthyPi5.recordStop();   // closes it
HealthyPi5.recording();    // true while a file is open

The host commands REC_START and REC_STOP do the same thing over USB — see Host commands.

The card is an ordinary drop-newest sink on its own core0 task, so a slow card only drops SD records — counted, and reported in the telemetry line. It can never stall acquisition. Writes are batched into 4 KB pages and the FAT is flushed every two seconds, bounding how much you lose to a power cut.

examples/Tutorials/11_SD_Datalog is a complete worked example.

The on-disk format

Files are written to the card root as /REC*.BIN: a 32-byte header followed by fixed 16-byte records, all little-endian.

Header (32 bytes)
  uint32  magic            0x35504824  ('$HP5')
  uint16  version          1
  uint16  rec_size         16
  uint16  sample_rate_hz   ~128
  uint16  channels         4
  uint32  start_uptime_ms
  uint8   reserved[16]

Record (16 bytes, repeated)
  int32   ecg
  int32   bioz         (respiration)
  int32   ppg_red
  int32   ppg_ir
Reading the file

The format is stable and trivial to parse — four little-endian int32 values per sample after a 32-byte header. In Python:

import struct

with open("REC0001.BIN", "rb") as f:
    hdr = f.read(32)
    magic, version, rec_size, rate, channels, start_ms = struct.unpack("<IHHHHI", hdr[:16])
    assert magic == 0x35504824, "not a HealthyPi 5 recording"

    while chunk := f.read(rec_size):
        ecg, bioz, red, ir = struct.unpack("<iiii", chunk)
        print(ecg, bioz, red, ir)

Retrieving the recording

Power the device off, remove the microSD card, and read it with a card reader. The .BIN files sit at the root.

The Arduino firmware does not support fetching logs over BLE — that’s a Zephyr feature.

Recording to the SD card — Zephyr

The Zephyr firmware records CSV and can be driven entirely from the OpenView 2 mobile app, including retrieving files wirelessly.

Start a session

  1. From the OpenView 2 mobile app, tap Connect next to your HealthyPi 5.

    OpenView 2 mobile app discovering HealthyPi 5
    Connect button next to the HealthyPi 5 device entry

  2. Tap Log to SD Card on the left of the stream view.

    Log to SD Card option

  3. To stop, tap Stop Logging.

    Stop Logging button in OpenView 2 mobile

Keep recording after the phone walks away

Tap Disconnect and choose Disconnect & Continue. The HealthyPi 5 keeps writing to the card on its own. When you reconnect, tapping Log to SD Card ends the previous session and starts a new one.

Disconnect and Continue dialog letting the device keep recording

Getting the files back

Over BLE. Reconnect from the app, tap Get Logs, pick a file, tap Download.

Get Logs view showing available log files on the SD card
Download progress while fetching a log file
Download successful confirmation

Or pull the card. Power off, remove the microSD, read it directly. CSV files are at the root.

Tip

When fetching logs over BLE, keep the phone close to the device — log files can be large and the transfer slows considerably on a weak link.

Recording to the phone — Zephyr

  1. Install OpenView 2 on your phone (links in Wireless: BLE & Wi-Fi).

  2. Tap Scan, then Connect.

  3. Tap Log to App. Recording starts immediately.

    Log to App option in the OpenView 2 mobile app

  4. To stop, tap Disconnect. The CSV is saved to the app’s storage.

    Stopping the Log to App session