Skip to content

Driver

SFM Flow Meter Driver

A C++20 driver for the Sensirion SFM digital mass flow meters on I2C: the SFM4300, SFM3003, SFM3013, SFM3019, SFM3119, SFM3304, SFM3505, the legacy SFM3000, SFM3200, SFM3300, SFM3400, SFM4200 and SFM4100, and the preliminary SFM6000D. One API, 32 variants, on any MCU.

Quickstart API guide Source on GitHub

The driver has no platform code. You give it a small class that brings the bus up and moves bytes; it does the rest: identification, scaling checks, the command sequences of each protocol family, the CRC of every word, the status checks, the waits and the recovery rules.

Not a safety device

The vendor states that these sensors are not designed for safety-critical or life-supporting use unless the datasheet says so. This driver is verified against a model of the chip, not against hardware, and carries no medical or safety claim. See Contract.

Digital mass flow meters SFM family Sensirion
Function
Gas mass flow in standard litres per minute (SFM4100: standard cubic centimetres) and the temperature the sensor reports (its silicon; on the SFM3003-300-CET a gas temperature sensor in the flow channel), as signed integers in millilitres per minute and milli-degrees
Interface
I2C, 100 kHz to 1 MHz depending on the part; no register byte: raw command words and 16-bit words with a CRC-8
Families
SF06 (five parts), SF06 gen 2 (SFM3304), SF06 dual (SFM3505), SF05 (five legacy), SF04 (SFM4100), SFx6000 (SFM6000D, preliminary)
Integrity
CRC-8 on every word, checked before anything is decoded; status word checks; stuck lines are errors
Supply
3.0 V to 5.5 V (SFM4300); 3.3 V or 5 V by part, see Hardware

What you get

  • One object for every part. SfmFlowMeter<YourPort> takes a reference to your port and does no I/O until you initialise it. The part is data (a table of 32 rows); the code branches on the protocol family only. See Architecture.
  • Errors you can act on. Every call returns Result<T> with an Error such as NoData, Crc, DeviceReset or StateUnknown. See API guide.
  • Non-blocking by construction. Calls that need a wait return it; you sleep, then Poll(). A blocking wrapper exists when the port has DelayUs(). See API guide.
  • Datasheet defaults. PresetFor(variant) gives a valid Config for each part; CheckedConfig proves one valid at build time. See Configuration.
  • Zero-overhead portability. The port is a CRTP class checked by a concept: the bus hooks, plus optional delay, clock, log, clock-stretching read, general call, power cycle and reset pin found at compile time. See Porting.
  • No heap, no exceptions, no RTTI. The host tests build with -fno-exceptions -fno-rtti. See Contract.
  • Tested without hardware. Host tests run every part against an independent model of the sensor, a fuzzer checks the driver's promises, and the coverage gate includes MC/DC. See Testing and CI.

Datasheet

Document Revision Get it
Datasheet: SFM3000 digital mass flow meter (Sensirion AG SFM3000) 2.2, July 2016 vendor page
Datasheet: SFM3003 digital mass flow meter (Sensirion AG SFM3003 D1) 1.1, June 2024 vendor page
Datasheet: SFM3003-300-CET digital mass flow meter (Sensirion AG SFM3003-300-CET) 1.0, April 2022 vendor page
Datasheet: SFM3013 digital mass flow meter (Sensirion AG SFM3013 D3) 1.1, June 2024 vendor page
Datasheet: SFM3019 digital mass flow meter (Sensirion AG SFM3019 D1) 1.3, not printed (vendor page: 08/2024) vendor page
Datasheet: SFM3020 analog mass flow meter (reviewed, not supported) (Sensirion AG SFM3020) 1.2, not printed vendor page
Datasheet: SFM3100 analog mass flow meter (reviewed, not supported) (Sensirion AG SFM3100) 1.5, not printed (vendor page: 08/2026) vendor page
Datasheet: SFM3119 digital mass flow meter (Sensirion AG SFM3119 D1) 1.3, September 2023 vendor page
Datasheet: SFM3200 digital mass flow meter (Sensirion AG SFM3200) 1.1, May 2017 PDF · vendor page
Datasheet: SFM3200-AW digital mass flow meter (Sensirion AG SFM3200-AW) 1.1, March 2022 vendor page
Datasheet: SFM3300-D and SFM3300-AW digital mass flow meters (Sensirion AG SFM3300) 1.4, March 2022 vendor page
Datasheet: SFM3304-xxx-D digital mass flow meter (Sensirion AG SFM3304) 1.3, not printed (vendor page: 09/2026) PDF · vendor page
Application note: Transition guide SFM3300-250-D to SFM3304-250-D (Sensirion AG SFM3300-SFM3304 transition) 1, not printed (vendor page: 10/2026) vendor page
Datasheet: SFM3400-AW and SFM3400-D digital mass flow meters (Sensirion AG SFM3400) 1.5, January 2024 vendor page
Datasheet: SFM3505 digital mass flow meter (Sensirion AG SFM3505 D3) 1.0, October 2025 PDF · vendor page
Datasheet: SFM4100 series digital mass flow meters (Sensirion AG SFM4100) 1.4, January 2024 PDF · vendor page
Application note: CRC calculation for the SFM4100 (Sensirion AG SFM4100 CRC) 1.0, June 2009 PDF · vendor page
Application note: SFM4100 sample code (Sensirion AG SFM4100 sample code) 1.0, July 2009 vendor page
Datasheet: SFM4200 digital mass flow meter (Sensirion AG SFM4200 D1) 1.2, August 2018 vendor page
Datasheet: SFM4300 series digital mass flow meters (Sensirion AG SFM4300 D1) 1.0, April 2022 PDF · vendor page
Datasheet: SFC5300 and SFM5300 (2016; reviewed, not supported) (Sensirion AG SFM5300 (2016)) not printed, 2016 vendor page
Datasheet: SFC5300/SFM5300 and SFC5330/SFM5330 (reviewed, not supported) (Sensirion AG SFx53x0) 05/2023, May 2023 vendor page
Datasheet: SFC5400 and SFM5400 (reviewed, not supported) (Sensirion AG SFx5400) 05/2023, May 2023 vendor page
Datasheet: SFC5460 and SFM5460 (reviewed, not supported) (Sensirion AG SFx5460) 05/2023, May 2023 vendor page
Datasheet: SFC5500 and SFM5500 (reviewed, not supported) (Sensirion AG SFx5500) 02/2024, February 2024 vendor page
Reference manual: SFC5xxx SHDLC interface reference (reviewed, not supported) (Sensirion AG SFC5xxx SHDLC) 1.9, October 2015 vendor page
Datasheet: SFC6000D and SFM6000D digital mass flow meters (Sensirion AG SFx6000D D1) 1.1, May 2023 vendor page
Reference manual: SFC6xxx/SFM6xxx I2C interface reference (preliminary) (Sensirion AG SFx6000 I2C) 1.1, not printed (vendor page: 07/2023) PDF · vendor page
Reference manual: SFC6xxx/SFM6xxx RS485 SHDLC guide (reviewed, not supported) (Sensirion AG SFx6000 SHDLC) 1.1, not printed vendor page
Application note: SFM-05 I2C functional description for the SFM3x00 series (Sensirion AG SFM-05) not printed (vendor page: 10/2026), not printed PDF · vendor page
Application note: SFM-04 CRC checksum (Sensirion AG SFM-04 D1) not printed, not printed (vendor page: 01/2020) vendor page
Application note: SFM-01 engineering guidelines for mass flow meters (Sensirion AG SFM-01) not printed, not printed vendor page

Written against these revisions; the SHA-256 of each file is in docs/datasheets.yml. Where each part of the driver is in the datasheet: Datasheet map.

Where to go next

  • Quickstart


    Wire the sensor, write the port, read a flow in about 20 lines.

  • Hardware


    Connectors, addresses, bus settings, timing, power and fittings per variant.

  • Contract


    What the driver promises, what it needs, and what is not verified.

  • API guide


    Initialise, measure, update the mixture, sleep, reset and handle errors, task by task.

  • Porting


    Implement the port for your MCU.

  • API reference


    Every class and member, generated from the headers.