I2C Functional Description
Applicable to following sensors
SFM3000, SFM3200, SFM3300, SFM3400
I2C details for other SFM sensors are directly included in the sensor’s datasheet
Key content▪
I2C communication details▪
Command set and data transfer sequences▪
Reset, limitations and extended command sets
SummaryThis document describes the I2C communication with the SFM3xxx sensor series. Communication between themaster and the SFM3xxx series sensor runs via the digital I2C-interface. This document contains all essential aswell as several extended commands and some basic descriptions of the SFM3xxx series I2C protocol. For thedetailed specifications please check the NXP document "The I2C-Bus Specification".

1 Interface connection
Bi-directional bus lines are implemented by the devices (master and slave) using open-drain output stages and apull-up resistor (Rp) connected to the positive supply voltage.
The recommended pull-up resistor value depends on the system setup, particularly on the capacitance of thecircuit or cable and bus clock frequency. For quick prototyping a value of 10kOhm is a reasonable choice. Pleaserefer to NXP’s I2C bus specification in order to determine the optimal value.
The capacitive loads on SDA and SCL line have to be the same. It is important to avoid asymmetric capacitiveloads. In case of long wires (>10cm) it is necessary to shield SDA and SCL. Wires longer than 30cm should notbe used.
I2C Connection Diagram
VDD
m a ste r

Rp

Rp

sla ve (S F M 3 0 0 0)

SDA
SCL

Both bus lines, SDA and SCL, are bi-directional and require an external pull-up resistor.

2 I2C Address
The I2C address is represented by a 7-digit binary value. By default, the I2C address is set to 64 (1000000b). The
address is always followed by a write bit (0) or read bit (1). The default hexadecimal I2C header for read accessto the sensor is therefore 0x81.

© Copyright Sensirion AG, Switzerland

1/10

3 I2C communication
The I2C protocol consists of start and stop conditions at the beginning and ending of the transfers and a numberof 8 bit frames in between, of which each frame is acknowledged in case of a successful transmission.

3.1 Transmission START Condition (S)The START condition is a unique situation on the bus created by the master, indicating to the slaves thebeginning of a transmission sequence (the bus is considered busy after a START).
I2C Transmission Start Condition
SDASCLS
START condition

A HIGH to LOW transition on the SDA line while SCL is HIGH

3.2 Transmission STOP Condition (P)The STOP condition is a unique situation on the bus created by the master, indicating to the slaves the end of atransmission sequence (the bus is considered free after a STOP).
I2C Transmission Stop Condition
SDASCLPSTOP condition

A LOW to HIGH transition on the SDA line while SCL is HIGH.

3.3 Acknowledge (ACK) / Not Acknowledge (NACK)
Each byte transmitted over the I2C bus is followed by an acknowledge condition from the receiver. This meansthat after the master pulls SCL low to complete the transmission of the 8th bit, SDA will be pulled low by thereceiver during the 9th bit time. If after transmission of the 8th bit the receiver does not pull the SDA line low, thisis considered to be a NACK condition.

© Copyright Sensirion AG, Switzerland

2/10

I2C Acknowledge / Not Acknowledge
n o t a ckn o w le d g e
SDAa ckn o w le d g e
SCL

R /_ W

ACK

D7D0ACKEach byte is followed by an acknowledge or a not acknowledge, generated by the receiver(The bold lines indicate that the sensor controls the SDA line)

3.4 Data transfer format
Data is transferred in byte packets in the I2C protocol. Each byte is followed by an acknowledge bit. Data istransferred with the most significant bit first.
A data transfer sequence is initiated by the master generating the Start condition (S) and sending a header byte.
The I2C header consists of the 7-bit I2C device address and the data direction bit (R/_W).
The value of the R/_W bit in the header determines the data direction for the rest of the data transfer sequence. If
R/_W = 0 (WRITE) the direction remains master-to-slave, while if R/_W = 1 (READ) the direction changes toslave-to-master after the header byte.

© Copyright Sensirion AG, Switzerland

3/10

4 Command Set and Data Transfer Sequences
After a data transfer is initiated by a header byte with a Write, a command is send to the slave. A command isrepresented by a 16-bit command code, consisting of two 8-bit frames. The data direction may not change after
the command bytes, since the R/_W bit of the preceding I2C header has already determined the direction to bemaster-to-slave. In order to execute Read commands, the following principle is used. On successful(acknowledged) receipt of the command code, the sensor stores the command internally. A successive Read isinvoked by initiating an I2C data transfer sequence with R/_W = 1 and the sensor replying with the requested
information.
If a correctly addressed sensor recognizes a valid command and access to this command is granted, it respondsby pulling down the SDA line during the subsequent SCL pulse for the acknowledge signal (ACK). Otherwise it
leaves the SDA line unasserted (NACK).
The commands are described below, and the data transfer sequences are specified.
Command[16 bit]
0x1000

Number of bytes
Command Description
to read backStart continuous measurement and/or move internal2
pointer (back) to flow measurement result register

CommentSee chapter 4.1

0x31AE4Read Serial Number (bit 31:0)

See chapter 4.20x2000

NASoft reset commandSee chapter 6Cmd[15:8]

Cmd[7:0]

ACK

I2CAdr[6:0] W

ACKS

ACK

I2C master writes command to SFM3000 with address I2CAdr

CRC[7:0]

CRC[7:0]

ACK

CRC[7:0]

NACK

NACK

ACK

flow data[7:0]

ACK

flow data[15:8]

ACK

I2CAdr[6:0] R

ACK

S

ACK

I2C master reads command results from SFM3000 with address I2CAdr

Porserial nr[15:8]

ACK

ACK

I2CAdr[6:0] R serial nr[31:24] serial nr[23:16]
ACKS

serial nr[7:0]PDark areas with white text indicate that the sensor controls the SDA (Data) line.

4.1 Measurement Triggering
Flow measurements are started by writing the start measurement command (0x1000) to the sensor.
Measurement results are continuously updated until the measurement mode is stopped by sending any othercommand or by a sensor reset. After a start measurement command, the measurement results can be read out© Copyright Sensirion AG, Switzerland

4/10

continuously1. In the case that the sensor chip performs an unexpected reset, e.g. due to an intermediate drop inthe supply voltage below 4.75V, the sensor chip will stop measuring and a sensor read command will provide aninvalid result from a user register. To avoid such an invalid result it is recommended to repeat the “startmeasurement” command in a repeated interval or for each “read” command as shown in the tables below. The
measurement result register is set to invalid after being read and only set to valid again when a newmeasurement result is available. If no valid result is available, the chip does not acknowledge a read command.
The tables below give an example sequence with explanations for every command.
Timing for SFM3000 (see below table for other SFM3xxx)∆ time (ms) I2C communication
Measuring? Comment0-

10080a10a00a0.581n

FFa

FFa

80a

10a00a81aF0a00a80a10a00a

81a

F0a

14n

80a

10a00a

0.5
0.5

FFn

CRCn

81n

0.1

81a

F0a

28a180a31aAEa

81a5Aa

D8aCRCa

47a

40a

CRCn

80a

10a00a81aF0a00a80a10a00a81aF0a00a80a10a00a0.3
0.5
0.5

Powering up of the sensor (heater powered up withstart up of the sensor SFM3000)→ Yes

After the sensor is out of reset, the startmeasurement command is sent

Yes

First measurement result read out after chip reset isinvalid

Yes

Start measurement command is sent
Valid measurement data is read out + CRC byte.

Yes

Start measurement command is sent
Updated flow value is read out. CRC is not read out.

Yes

0.40.2NoCRCnCRCn

CRCn

Start measurement command is sent

Yes

No valid measurement data is ready yet. The readrequest is not acknowledged

Yes

New measurement data is available and read out.

→ NoSend read serial number command

No

Read example serial number→ Yes

Start measurement command is sent
Measurement data is read out + CRC byte.

Yes

Start measurement command is sent
Measurement data is read out + CRC byte.

Yes

Start measurement command is sent

Dark areas with white text indicate that the sensor controls the SDA (Data) line.
An a indicates and ACK, an n indicates a NACK

1 This means that an I2C header with R/_W bit = 1 could be sent continuously to read out those results, without preceding itwith command 0x1000© Copyright Sensirion AG, Switzerland

5/10

Timing for SFM3200, SFM3300 and SFM3400
Measuring? Comment∆ time (ms)I2C communication

0-40

1000.50.5

First measurement result read out after chip reset isinvalid

Yes

Start measurement command is sent

Yes

Valid measurement data is read out + CRC byte.

81n

FFa

FFa

80a10a00a81aF0a00a80a10a00aYes

Start measurement command is sent

81aF0a14n

Yes

Updated flow value is read out. CRC is not read out.

80a10a00a

Yes

Start measurement command is sent

Yes

No valid measurement data is ready yet. The readrequest is not acknowledged

Yes

New measurement data is available and read out.

→ No

Send read serial number command

NoRead example serial number→ Yes

Start measurement command is sent

Yes

Measurement data is read out + CRC byte.

Yes

Start measurement command is sent

Yes

Valid measurement data is read out + CRC byte.

Yes

Start measurement command is sent

FFn

CRCn

81a

F0a

28a

180a

31a

AEa

81a5AaD8a

CRCa

47a40aCRCn

80a10a00a81aF0a00a80a10a00a81aF0a00a80a10a00a0.5

Yes00a0.10.5No

After the sensor is out of reset, the startmeasurement command is sent (unlike for SFM3000,the heater is only started with the start measurementcommand )10a81n0.3

Powering up of the sensor

80a

0.4

0.2

NoCRCnCRCn

CRCn

Dark areas with white text indicate that the sensor controls the SDA (Data) line.
An a indicates and ACK, an n indicates a NACK

© Copyright Sensirion AG, Switzerland

6/10

4.2 Read Data Layout
Data that is read back from the Sensor consists of two or four bytes, with the most significant byte and bit readfirst. The least significant bit and byte are read last. The following maps give more details on the content of thedifferent results:
Read flow measurement result
Bit

#Bits

Description/Coding

15:0

16

Flow measurement result. Bit <1:0> is always zero.

Read serial number
Command#Bits

Description/Coding

0x31AE32

Bit 31:0 of the unique serial number

4.3 Converting measurement result to measured values
In order to obtain the measured flow in the predefined unit, the flow measurement result needs to be converted
according to the following formula:
𝑓𝑙𝑜𝑤 [slm] =𝑚𝑒𝑎𝑠𝑢𝑟𝑒𝑑 𝑣𝑎𝑙𝑢𝑒 − 𝑜𝑓𝑓𝑠𝑒𝑡 𝑓𝑙𝑜𝑤
𝑠𝑐𝑎𝑙𝑒 𝑓𝑎𝑐𝑡𝑜𝑟 𝑓𝑙𝑜𝑤

Offset and scale factor can be found in the product datasheet.
Please note that the first measurement performed directly after chip initialization might not be valid.

5 CRC-8 Redundant Data Transmission
Cyclic redundancy checking (CRC) is a popular technique used for error detection in data transmission. The
transmitter appends an n-bit checksum to the actual data sequence. The checksum holds redundant information
about the data sequence and allows the receiver to detect transmission errors. The computed checksum can beregarded as the remainder of a polynomial division, where the dividend is the binary polynomial defined by thedata sequence and the divisor is a “generator polynomial”.
The SFM3000 sensor implements the CRC-8 standard based on the generator polynomial: x8 + x5 + x4 +1. (0x31)
Note that CRC is only used for data transmitted from the slave to the master.
For details regarding cyclic redundancy checking, please refer to the AppNote SFM-04 “CRC Checksum” on ourwebsite and the relevant literature.

6 Soft reset
The soft reset command forces a sensor reset without switching the power off and on again. On receipt of thiscommand, the sensor reinitializes the control/status register contents from the non-volatile memory and starts
operating according to these settings.
© Copyright Sensirion AG, Switzerland

7/10

I2C Soft Reset2345

9S 1 0 0 0 0 0 0 0I2CAdr

67W

10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 270 0 1 0 0 0 0 00 0 0 0 0 0 0 0

ACK

1

ACK

8

ACK

16 bit command code: 0x2000
Command: Soft Resetsystem reboot

Command[7:0]Command[15:8]

7 Limitations
The I2C interface of the SFM3xxxx show deviations from the NXP I2C specification and might lock up and cease
to react (including to the soft reset command), under the following conditions:▪
Glitches on the SCL, for example caused by electromagnetic irradiation or coupling.
▪
The master does not acknowledge the first byte read from the sensor after having sent the header byte (I2C
address + R bit). The critical acknowledge bit is highlighted below.

Data[7:0]

CRC[7:0]

NACK

Data[15:8]

ACK

I2CAdr[6:0] RACKSACK

I2C read sequence. ACK after first read byte highlighted.

PDark areas with white text indicate that the sensor controls the SDA (Data) line.
The following design precautions are recommended to reduce the probability of sensor freeze/lockup and torestore the sensor operation with a power (hard) reset in the event of a freeze:▪
The cable length from the sensor to the microprocessor is recommended to be as short as possible and notlonger than 30 cm as well as shielded. For wires longer than 10 cm the SDA and SCL must be shielded.
Sources that emit electromagnetic radiation must be kept away from the I2C connection.
▪
When data is read from the sensor, one must ensure that the first data byte of the transaction is always
acknowledged by the master.
▪
It must be possible to reset the sensor through a hard reset in case the sensor freezes by powering thesupply voltage of the sensor off and on again.
Suggested measures and error handling logic to establish a reliable communication and read-out of themeasurement values:▪ Send the “Start measurement” command before every read command to avoid an unnoticed sensor reset.
▪ Ensure the sensor acknowledges all commands, and the CRC checksum of the measurement data is valid.
▪ In case of an unexpected behavior from the sensor (NACK or a wrong CRC checksum), use the last valid
flow value and perform a sensor power (hard) reset if the error persists for 5 (or any other application
specific error threshold) consecutive cycles.

© Copyright Sensirion AG, Switzerland

8/10

8 Extended Command Set
Task
Start flow
measurement
Start temperature
measurement*
Read scale factor
Read offset

Command[16 bit]# of bytes toread backDetailled Command Description

0x10002Start continuous flow measurement

0x100120x30DE0x30DF

220x31E3

20x31E4

20x31AE

20x31AF

20x2000

NAStart continuous temperature measurement. Bit <1:0>
are always zero.
Combining both bytes yields the flow scale factor
Combining both bytes yields the flow offset
In order to read out the product type/article number,two commands have to be sent to the sensor resulting
in 4 bytes of data (bits <31:0>). The command 0x31E3
results in the first two bytes (bits <31:16>) followed bycommand 0x31E4 with another two bytes (bits<15:0>).
In order to read out the serial number, two commands
have to be sent to the sensor resulting in 4 bytes ofdata (bits <31:0>). The command 0x31AE results inthe first two bytes (bits <31:16>) followed by command
0x31AF with another two bytes (bits <15:0>).
Soft reset command

Read article
numberRead serial number
Soft reset

SFM3xxx-AW versions only! There is an additional EEPROM on the SFM3300-AW and SFM3400-AW to allow
storage of customer-specific data (e.g. usage hours). Please see all details in the datasheet of the EEPROM. The
EEPROM is of type 24LC01BT-I/MC. No additional validation or modification of EEPROM settings has been
performed by Sensirion.
*Allows read out of the chip temperature. Please note that the sensor temperature does not necessarily reflect thetemperature of the gas flowing through the sensor. See additional AppNote SFM-08 “Temperature Effects”.

© Copyright Sensirion AG, Switzerland

9/10

9 Revision history
Date
July 2013
July 2015

AuthorANB
ANBVersion
1
1.1

Jan 2021

PSIM

1.2

May 2022

LOEH

1.3

Changes
First releaseAdded Read Serial Number Command. Minor changes.
Added Extended I2C Command Set and applicability to further
SFM3x00 sensors
Detailed measurement mode (section 4.1) and measures toestablish reliable communication despite the I2C limitations(section 7)

10 Headquarters and Subsidiaries
SENSIRION AG
Laubisruetistr. 50
CH-8712 Staefa ZH
Switzerlandphone: +41 44 306 40 00
fax:+41 44 306 40 30
info@sensirion.com
www.sensirion.com

Sensirion Korea Co. Ltd.
phone: +82 31 337 7700 3
info@sensirion.co.kr
www.sensirion.co.kr
Sensirion China Co. Ltd.
phone: +86 755 8252 1501
info@sensirion.com.cn
www.sensirion.com.cn

Sensirion Inc., USA
phone: +1 805 409 4900
info_us@sensirion.com
www.sensirion.com

Sensirion AG (Germany)
phone: +41 44 927 11 66
info@sensirion.com
www.sensirion.com

Sensirion Japan Co. Ltd.
phone: +81 3 3444 4940
info@sensirion.co.jp
www.sensirion.co.jp© Copyright Sensirion AG, Switzerland

To find your local representative, please
visit www.sensirion.com/contact

10/10