Software

Firmware & Libraries

Modular firmware for microcontrollers. Sensor fusion, PO₂ control loops, alarm logic, and dive computer integration.

Safety Notice

This firmware is for research and educational use only. Do not use this software in any equipment intended for actual diving.

Repository — openccr/firmware

Embedded Firmware

Embedded C/C++ firmware for the openCCR controller board, built on Zephyr RTOS and the Nordic nRF SDK. Modular architecture designed for safety-critical embedded systems. Licensed under GPLv3.

PO₂ Sensor Fusion

Multi-cell voting algorithm with statistical outlier rejection. Continuous cell health scoring — degraded or failed cells are flagged and excluded from the voted value with appropriate alarms.

PO₂ Control Loop

Closed-loop solenoid actuation maintaining the configured PO₂ setpoint. Configurable dead-band, hysteresis, and maximum injection duration prevent over-oxygenation. Automatic depth-based setpoint changeover between low (descent) and high (bottom) setpoints. Hardware watchdog ensures fail-safe solenoid shutoff.

Alarm Management

Tiered alarm system with severity levels: advisory, warning, and critical. Alarm events are broadcast over rebus to HUD, display, and alert boards for audio, optical, and haptic signalling. Alarm conditions include high PO₂, low PO₂, cell failure, cell disagreement, low battery, and rebus bus fault.

Dive Log Recording

Continuous recording to on-board flash at configurable sample rates (1–10 Hz). Each record includes timestamp, depth, voted PO₂, per-cell readings, setpoint, solenoid state, and active alarms. Log exported via BLE to the companion app in binary, CSV, or UDDF format.

rebus Stack

Full implementation of the openCCR inter-board communication protocol. Bus master on the controller board coordinates sensor polling, display updates, and solenoid commands to peripheral boards. Built-in error detection with automatic retry and bus fault recovery. See the API page for protocol details.

Bluetooth Stack

BLE communication stack for wireless connectivity with the companion app. Handles pairing, secure data transfer, dive log export, configuration reads and writes, and over-the-air firmware updates. Built on the Zephyr BLE host stack targeting the nRF52/nRF54 radio peripherals.

Firmware Update

Secure bootloader supporting over-the-air firmware updates via BLE from the companion app and over rebus for peripheral boards. Update images are checked before flashing, and previous firmware is retained in a recovery partition for rollback on failed update.

Decompression Algorithm

Bühlmann ZHL-16C tissue model with configurable gradient factors (GF Lo/Hi). Tracks inert gas loading across 16 parallel compartments using depth and time data from the pressure sensor board. Calculates no-stop time remaining, decompression ceilings, and stop durations. Results broadcast over rebus to display boards. GF settings configurable via the companion app.

View openccr/firmware on GitHub

Repository — openccr/companion-app

Companion Application

Flutter-based application for iOS and Android. Connects wirelessly over Bluetooth to the openCCR device, giving divers a familiar, touch-friendly screen to configure the system, review dive logs, and push firmware updates — all before or after the dive. Licensed under GPLv3.

Pre-Dive Configuration

Connect to the openCCR unit via Bluetooth Low Energy to configure: PO₂ setpoints for low and high depth zones, depth-based setpoint changeover threshold, alarm level customisation (advisory, warning, and critical thresholds for high and low PO₂), cell type and calibration constants, and system clock synchronisation. All settings are checked against acceptable ranges before being written to the device — out-of-range values are rejected with a descriptive error.

Cell Calibration Wizard

Guided step-by-step calibration procedure: flush the breathing loop with pure O₂ at a known partial pressure, confirm stable sensor readings across all three cells, enter the reference PO₂ value, and commit the calibration constants. The wizard displays live millivolt readings per cell during the flush, flags cells with excessive drift or noise, and records calibration date and reference value in the device log.

Dive Log Viewer

Graphical post-dive log review with interactive timeline charts: voted PO₂ trace with per-cell overlays, depth profile, solenoid actuation events, setpoint transitions, and alarm event markers. Supports pan and zoom. Exports logs in CSV (spreadsheet-compatible), UDDF (dive computer interchange format), and openCCR native binary. Multiple dives can be compared on a single chart.

Firmware Updates

Push firmware updates to the openCCR controller wirelessly over BLE. The app checks the update image, displays a progress indicator during transfer, and confirms successful boot of the new firmware version. Supports rollback to the previous version if the device reports a failed update.

View openccr/companion-app on GitHub

Tools

Configure Your Hardware Stack

Before flashing firmware, use the visual configurator to lay out your board configuration and verify module connections match your firmware build.

Open Configurator