I²C interface reference
Register map, transaction structure, status bits, and control commands. All multi-byte values are little-endian; floats are IEEE 754 single-precision.
Draft: for early access integrators only.
Register layout may change before v1 firmware is final. Email info@reacgen.com for a stable preview build if you need to start hardware bring-up early.
Physical interface
| I²C role | Slave |
| 7-bit address | 0x69 (configurable from web UI) |
| Logic level | 3.3 V |
| Connector | Qwiic / JST SH 1 mm 4-pin |
| Recommended SCL | 400 kHz (fast mode) |
| Endianness | Little-endian |
For the Qwiic connector pinout, the 3.3 V power rules, and how to change the I²C address, see Wiring connection.
Transaction structure
Reading a register requires a repeated-START transaction: write the register address (no STOP), then immediately read the response. The first byte of every response is a status code; data bytes follow.
# Python (smbus2): repeated-START read
import struct
from smbus2 import SMBus, i2c_msg
ADDR = 0x69
def read_float(bus, reg):
write = i2c_msg.write(ADDR, [reg])
read = i2c_msg.read(ADDR, 5) # 1 status + 4 data
bus.i2c_rdwr(write, read)
data = list(read)
if data[0] != 0x00:
return float('nan')
return struct.unpack('<f', bytes(data[1:]))[0]// Arduino (Wire): repeated-START read
Wire.beginTransmission(0x69);
Wire.write(reg);
Wire.endTransmission(false); // no STOP
Wire.requestFrom(0x69, 5);
uint8_t status = Wire.read();
// read 4 data bytes...Response status codes
| Byte | Meaning |
|---|---|
| 0x00 | OK. Data bytes that follow are valid |
| 0x01 | Unknown or deleted register; no data bytes follow |
| 0xFF | Client-side wire-error sentinel used by libraries; not emitted by the sensor |
Read registers
The sensor updates its register bank after every completed measurement. The default configuration waits 100 ms between measurement cycles, in addition to acquisition and processing time. Reads are served from the cache without blocking. Response length = data bytes + 1 status byte.
| Addr | Type | Bytes | Field | Description |
|---|---|---|---|---|
| 0x10 | float32 | 4 | measured_reflectance | Raw reflectance ratio: reflected power vs laser power (unitless) |
| 0x11 | float32 | 4 | normalized_reflectance | Reflectance normalized to the initial reference. Uses blank subtraction when an optional blank is available. |
| 0x12 | float32 | 4 | calibrated_density | Unfiltered culture density in g/L from the calibration lookup table. |
| 0x13 | float32 | 4 | growth_rate | Kalman filter specific growth rate µ in 1/h. NaN when the Kalman filter is disabled. |
| 0x14 | float32 | 4 | laser_power_mw | Laser optical output power in mW. |
| 0x15 | — | — | (reserved) | Returns status 0x01. Do not use. |
| 0x16 | float32 | 4 | filtered_calibrated_density | Kalman-filtered density in g/L. More stable than 0x12. NaN when the Kalman filter is disabled. |
| 0x17 | float32 | 4 | filtered_calibrated_growth_rate | µ × filtered_density in g/L/h (volumetric). NaN when the Kalman filter is disabled. |
| 0x18 | float32 | 4 | calibrated_absolute_growth_rate | µ × calibrated_density (unfiltered) in g/L/h. NaN when the Kalman filter is disabled. |
| 0x20 | uint8 | 1 | status | Live status flags. Always read from hardware state, never cached. |
| 0x21 | uint32 | 4 | error_flags | Live system error/warning vector (the same bitmask that drives the status LED). 0 means no faults. Always built live, never cached. See the error-flags table below. |
| 0x30 | uint32 | 4 | reading_number | Monotonic read counter. Increments each OD reading. Resets to 0 on job start. |
| 0x31 | struct | 22 | latest_reading | Atomic latest normal-cadence reading with age, calibration metadata, normalized reflectance, and calibrated value. |
| 0x32 | struct | 20 | triggered_reading | Pending or completed result of a host-triggered one-shot reading. Poll phase until complete. |
Atomic host readings
Registers 0x31 and 0x32 return the customer-facing values and their metadata in one transaction. This prevents a normal cadence update from splitting fields across different samples. The byte counts below describe the payload after the leading response-status byte.
Latest normal-cadence reading: register 0x31
Read 23 bytes total: one response-status byte followed by this 22-byte payload. The sensor responds immediately from its latest completed scheduled capture.
Offset Size Field
0 1 flags
1 1 quality
2 1 calibration_unit
3 1 reserved (0)
4 2 diagnostic_code (u16)
6 4 reading_number (u32)
10 4 age_ms (u32)
14 4 normalized_reflectance (float32)
18 4 calibrated_value (float32)Fresh one-shot reading: control 0x0C and register 0x32
Write [0x40][0x0C], then poll register 0x32 and read 21 bytes total. Accept the result when request_sequence changes andphase is 2 (complete).
Offset Size Field
0 2 request_sequence (u16)
2 1 phase: 0 idle, 1 pending, 2 complete
3 1 flags
4 1 quality
5 1 calibration_unit
6 2 diagnostic_code (u16)
8 4 age_ms (u32)
12 4 normalized_reflectance (float32)
16 4 calibrated_value (float32)While continuous measurement is running, the one-shot capture is serialized with scheduled readings. When the job is stopped, the sensor powers the laser, captures the sample, and shuts the laser down afterward. The request is observational: it does not update the normal reading counter, rolling average, Growth Model, datalog, or latest normal-cadence register.
Packed-reading flags
| Bit | Field | Set when |
|---|---|---|
| 0 | valid | The captured sample is valid. |
| 1 | calibrated | A usable calibration lookup table was applied. |
| 2 | job_running_at_capture | The continuous measurement job was running during capture. |
Calibration units
| Value | Unit |
|---|---|
| 0 | Dry cell weight (g/L) |
| 1 | OD600 |
| 2 | FNU |
| 3 | NTU |
| 4 | Custom |
| 0xFF | None |
If no usable calibration is active, the calibrated flag is clear, calibrated_value is NaN, and calibration_unit is 0xFF. Normalized reflectance is still returned when an initial reference is available. age_ms is the elapsed time since optical capture completion; 0xFFFFFFFF means no sample is available.
Write registers
| Addr | Type | Bytes | Field | Description |
|---|---|---|---|---|
| 0x40 | uint8 | 1 | control | Dispatches a sensor command. See command table below. |
| 0x50 | float32 | 4 | target_laser_pct | Laser power target as percentage of maximum (0.0 to 100.0 %). Writing this also activates the laser power controller at the given target. |
| 0x51 | — | — | (reserved) | Do not write. |
Status byte: register 0x20
The status byte is a live snapshot built from hardware state accessors on every read. It is never served from the register cache, so control-flow events (job start, laser lock) are visible immediately.
| Bit | Field | Set when |
|---|---|---|
| 0 | job_running | OD measurement job is active |
| 1 | has_blank | A blank (reference media) measurement has been captured |
| 2 | has_initial | Initial reference is complete (job has produced at least one reading) |
| 3 | laser_pwrctl_running | Laser constant power controller is active |
| 4 | laser_stable | Laser output has stabilized (within 0.5 % band for 5 consecutive cycles) |
| 5 | reflectance_stable | Reflectance is stable (within 1 % band, <0.5 %/s rate of change, 6 cycles) |
| 6 | error | One or more error/warning flags are active. Read register 0x21 for the detailed vector. |
| 7 | calibrated | A usable calibration lookup table is present (2 or more points), so calibrated_density (0x12) is meaningful. |
Typical startup sequence
After CMD_START_JOB (0x01):
Immediately: bit 0 set (job_running = 1)
During init: firmware captures 60 initial-reference samples
On complete: bit 2 set (has_initial = 1)
Use a timeout of at least 180 s for has_initial.
After CMD_TAKE_BLANK (0x03):
On complete: bit 1 set (has_blank = 1)Error flags: register 0x21
Register 0x21 is a 32-bit little-endian vector of the system error and warning flags, the same bitmask the firmware uses to drive the status LED. A value of 0 means no faults. Like 0x20, it is built live on every read and never cached. Bits 9 to 31 are reserved (0).
Status byte bit 6 (error) is the OR of every flag below, so a client can poll the single status byte and only read 0x21 when bit 6 is set. The error-class bits (0 to 4) latch and are cleared with control command 0x07 (CMD_CLEAR_ERRORS); the warning-class bits (5 to 8) are live-derived and re-assert on their own.
| Bit | Flag | Class | Set when |
|---|---|---|---|
| 0 | SAFETY_CRITICAL | error | Optical output power exceeded the safety limit |
| 1 | SAFETY_WARNING | error | Reserved optical safety warning |
| 2 | PI_FAILED | error | Optical power controller failed to stabilize |
| 3 | LOW_HEAP | error | Free heap dropped below the safe threshold |
| 4 | STORAGE | error | SPIFFS / NVS load failure |
| 5 | NO_BLANK | warning | No blank reference is set |
| 6 | NO_INITIAL | warning | No initial reference while a job is running |
| 7 | WIFI_DOWN | warning | Wi-Fi is disconnected |
| 8 | OTA | warning | A firmware update is in progress |
Control commands: register 0x40
Write register address 0x40 followed by one command byte. Async commands return immediately and run in a background task. Poll the status register to confirm start, stop, and blank completion. CMD_CAL_READING is a current protocol exception: it has no I²C-visible completion bit and does not return the captured reflectance value. Use the web interface for the calibration workflow until the I²C API is extended.
| Byte | Name | Type | Description |
|---|---|---|---|
| 0x01 | CMD_START_JOB | Async | Begin continuous OD measurements. Resets register bank to NaN and reading_number to 0. |
| 0x02 | CMD_STOP_JOB | Async | Stop the measurement task and turn off the laser. |
| 0x03 | CMD_TAKE_BLANK | Async | Capture blank reference (clear media). Job must be stopped first. |
| 0x04 | CMD_CAL_READING | Async | Capture a reflectance reading against a known-density standard. I²C currently exposes no completion bit or captured result. |
| 0x05 | CMD_DEACTIVATE_LASER | Sync | Stop laser power controller and turn off laser immediately. Effective before ACK. |
| 0x06 | CMD_ERASE_INITIAL | Sync | Clear stored initial reference. normalized_reflectance reverts to NaN. |
| 0x07 | CMD_CLEAR_ERRORS | Sync | Clear the latching error-class bits (0 to 4) in register 0x21 and status bit 6. Warning-class bits (5 to 8) re-assert if their condition persists. |
| 0x08 | CMD_ENABLE_UKF | Sync | Enable the growth rate model (Kalman filter). Persisted to flash; takes effect on the next job start. Rejected while a job is running, so stop the job first. The growth-model registers (0x13, 0x16 to 0x18) stay NaN until it is enabled. There is no I²C disable command; disable from the web dashboard. |
| 0x0C | CMD_TRIGGER_READING | Async | Request one fresh observational reading. Poll register 0x32 for a new request sequence with phase = 2. |
Data formats
IEEE 754 float (32-bit, little-endian)
# Python
struct.unpack('<f', bytes([b0, b1, b2, b3]))[0]
// C (little-endian host)
float f; memcpy(&f, buf, 4);NaN representation
Registers not yet populated (job not started, Kalman filter disabled) contain IEEE 754 quiet NaN. Always check with math.isnan() before using a value.
Hex: 0x7FC00000
Wire bytes: [0x00, 0x00, 0xC0, 0x7F] (little-endian)uint32 (32-bit, little-endian)
# Python
struct.unpack('<I', bytes([b0, b1, b2, b3]))[0]Async operation pattern
Use this polling pattern for start, stop, and blank commands. Calibration capture does not currently expose an I²C completion flag.
1. Write command byte to register 0x40
2. Wait ~50–100 ms (command dispatch)
3. Poll register 0x20:
a. Read status (2-byte repeated-START)
b. Check the relevant bit
c. Set → operation complete
d. Not set → wait 200 ms and repeat
4. Apply an operation-specific timeout; surface an error if the bit never changesTiming reference
| Event | Typical duration |
|---|---|
| Job start → laser stable (bit 4) | 0.5–2 s |
| Job start → initial ref complete (bit 2) | 60 samples; allow at least 180 s |
| Blank measurement | Poll bit 1; apply a 30 s timeout |
| Calibration reading | No I²C-visible completion flag |
| Inter-reading delay | 100 ms default, plus acquisition and processing time |
| Status register read latency | <1 ms |
Error handling
| Condition | Indicator | Action |
|---|---|---|
| Unknown register | Status byte = 0x01 | Skip; do not use the following bytes |
| Wire error | Client sentinel 0xFF or exception | Retry after 100 ms; check wiring if persistent |
| Register value is NaN | math.isnan(value) is True | Check startup state, lookup table availability, and whether the Kalman filter is enabled for the requested field |
| reading_number not incrementing | Same value on successive reads | OD job not running; issue CMD_START (0x01) |
| System fault or warning active | Status bit 6 (error) set | Read register 0x21 and decode the flag vector; clear the latching error bits with CMD_CLEAR_ERRORS (0x07) |
| laser_stable never sets | Bit 4 stays 0 after >10 s | Laser or hardware fault; check web interface serial log |
For ready-made client libraries (Arduino and Python) and end-to-end examples, see Code libraries, the Arduino examples, and the Python examples.

