Datasheet SPS30
Particulate Matter Sensor for Air Quality Monitoring and Control
▪ Unique long-term stability
▪ Advanced particle size binning
▪ Superior accuracy in
mass-concentration sensing
▪ Small, ultra-slim package
▪ Fully calibrated digital output
Product Summary
The SPS30 Particulate Matter (PM) sensor is a technological breakthrough in optical PM sensors. Its
measurement principle is based on laser scattering and makes use of Sensirion’s innovative contaminationresistance technology. This technology, together with high-quality and long-lasting components, enables
accurate measurements from its first operation and throughout its lifetime of more than eight years. In addition,
Sensirion’s advanced algorithms provide superior accuracy for different PM types and higher-resolution particle
size binning, opening up new possibilities for the detection of different sorts of environmental dust and other
particles. With dimensions of only 41 x 41 x 12 mm3, it is also the perfect solution for applications where size is
of paramount importance, such as wall-mounted or compact air quality devices.
Content
1 Particulate Matter Sensor Specifications
2
2 Electrical Specifications
3
3 Hardware Interface Specifications
4
4 Operation and Communication through the UART Interface
5
5 Operation and Communication through the I2C Interface
11
6 Technical Drawings
17
7 Shipping Package
18
8 Ordering Information
18
9 Important Notices
19
10 Headquarters and Subsidiaries
20
www.sensirion.com
Preliminary – Version 0.9 – D1 – November 2018
1/20
1 Particulate Matter Sensor Specifications
Default conditions of 25 °C and 5 V supply voltage apply to values in the table below, unless otherwise stated.
Parameter
Mass concentration accuracy1
Mass concentration range
Mass concentration resolution
Mass concentration size range2
Number concentration range
Number concentration size range2
Sampling interval
Start-up time
Lifetime3
Acoustic emission level
Weight
Conditions
0 to 100 μg/m3
Value
Units
μg/m3
100 to 1’000 μg/m3
10
0 to 1’000
1
0.3 to 1.0
0.3 to 2.5
0.3 to 4.0
0.3 to 10.0
0 to 3’000
0.3 to 0.5
0.3 to 1.0
0.3 to 2.5
0.3 to 4.0
0.3 to 10.0
1
8
25
26
10
PM1.0
PM2.5
PM4
PM10
PM0.5
PM1.0
PM2.5
PM4
PM10
24 h/day operation
0.2 m
-
%
μg/m3
μg/m3
μm
μm
μm
μm
1/cm3
μm
μm
μm
μm
μm
s
s
years
dB(A)
g
Table 1: Particulate Matter sensor specifications.
ΔM.C.
[µg/m3]
ΔM.C.
[%]
±50
±45
±40
±35
±30
±25
±20
±15
±10
±5
±0
±50
±45
±40
±35
±30
±25
±20
±15
±10
±5
±0
Typical Consistency
-10
0
10
20
30
40
50
60
Typical Consistency
-10
0
Temperature [°C]
Figure 1: Typical consistency tolerance for PM2.5 in µg/m3
between 0-100 µg/m3.
10
20
30
40
50
60
Temperature [°C]
Figure 2: Typical consistency tolerance for PM2.5 in %
between 100-1000 µg/m3.
1
Deviation to TSI DustTrak™ DRX Aerosol Monitor 8533 reference. PM2.5 accuracy is verified for every sensor after calibration using a defined potassium chloride
particle distribution. Ask Sensirion for further details on accuracy characterization procedures.
2 PMx defines particles with a size smaller than “x” micrometers (e.g., PM2.5 = particles smaller than 2.5 μm).
3 Validated with accelerated aging tests. Ask Sensirion for further details on accelerated aging validation procedures. Lifetime might vary depending on different
operating conditions.
www.sensirion.com
Preliminary – Version 0.9 – D1 – November 2018
2/20
1.1 Recommended Operating Conditions
The sensor shows best performance when operated within recommended normal temperature and humidity range of
10 – 40 °C and 20 – 80 %RH, respectively.
2 Electrical Specifications
2.1 Electrical Characteristics
Default conditions of 25 °C and 5 V supply voltage apply to values in the table below, unless otherwise stated.
Parameter
Supply voltage
Idle current
Average supply current
Max. supply current
Input high level voltage (VIH)
Input low level voltage (VIL)
Output high level voltage (VOH)
Output low level voltage (VOL)
Conditions
Idle-Mode
Measurement-Mode
First ~200 ms after start of Measurement-Mode
-
Value
4.5 to 5.5
2.31
< 0.99
> 2.9
< 0.4
Units
V
mA
mA
mA
V
V
V
V
Table 2: Electrical specifications.
2.2 Absolute Minimum and Maximum Ratings
Stress levels beyond those listed in Table 3 may cause permanent damage to the device. These are stress ratings only
and functional operation of the device at these conditions cannot be guaranteed. Exposure to the absolute maximum
rating conditions for extended periods may affect the reliability of the device.
Parameter
Supply voltage VDD
Interface Select SEL
I/O pins (RX/SDA, TX/SCL)
Max. current on any I/O pin
Operating temperature range
Storage temperature range
Operating humidity range
ESD CDM (charge device model)4
Electromagnetic field immunity to high frequencies5
High frequency electromagnetic emission6
Low frequency electromagnetic emission7
Rating
-0.3 to 5.5 V
-0.3 to 4.0 V
-0.3 to 5.5 V
±16 mA
-10 to +60 °C
-40 to +70 °C
0 to 95 %RH (non-condensing)
±4 kV contact, ±8 kV air
3 V/m (80 MHz to 1000 MHz)
30 dB 30 MHz to 230 MHz;
37 dB 230 MHz to 1000 MHz
30-40 dB 0.15 MHz to 30 MHz
Table 3: Absolute minimum and maximum ratings.
4
According to IEC 61000-4-2.
According to IEC 61000-4-3.
6 According to CISPR 14.
7 According to CISPR 22.
5
www.sensirion.com
Preliminary – Version 0.9 – D1 – November 2018
3/20
3 Hardware Interface Specifications
The interface connector is located at the side of the sensor opposite to the air inlet/outlet. Corresponding female plug is
ZHR-5 from JST Sales America Inc. In Figure 3 a description of the pin layout is given.
Pin 1
Pin
Name
Description
Comments
1
VDD
Supply voltage
5V ± 10%
UART: Receiving pin for
communication
2
I C: Serial data input / output
TTL 5V and
LVTTL 3.3V
compatible
UART: Transmitting pin for
communication
2
I C: Serial clock input
TTL 5V and
LVTTL 3.3V
compatible
Leave floating to
select UART
Pull to GND to
select I2C
2
Pin 5
RX
SDA
3
TX
SCL
Figure 3 The communication interface connector is
located at the side of the sensor opposite to the air outlet.
4
SEL
Interface select
5
GND
Ground
Table 4 SPS30 pin assignment.
The SPS30 offers both a UART8 and an I2C interface. For connection cables longer than 20 cm we recommend using
the UART interface, due to its intrinsic robustness against electromagnetic interference.
3.1 Physical Layer
The SPS30 has separate RX and TX lines with unipolar logic levels. A transmitted byte looks as in Figure 4.
Bit Time
(1/Baudrate)
Start
Bit
Bit 0
Bit 1
Bit 2
Bit 3
Bit 4
Bit 5
Bit 6
Bit 7
Stop
Bit
Figure 4 Transmitted byte.
8
Universal Asynchronous Receiver Transmitter.
www.sensirion.com
Preliminary – Version 0.9 – D1 – November 2018
4/20
4 Operation and Communication through the UART Interface
VDD
VDD (1)
Master TX
RX (2)
Master RX
TX (3)
NC
SPS30
Connector
SEL (4)
The following UART settings have to be used:
Baud Rate: 115’200 bit/s
Data Bits: 8
Parity: None
Stop Bit: 1
GND (5)
Figure 5 Typical UART application circuit.
4.1 SHDLC Frame Layer
On top of the UART interface, the SPS30 uses the very powerful and easy-to-implement SHDLC9 protocol. It is a serial
communication protocol based on a master/slave architecture. The SPS30 acts as the slave device.
Data is transferred in logical units called frames. Every transfer is initiated by the master sending a MOSI 10 frame. The
slave will respond to the MOSI frame with a slave response, or MISO11 frame. The two types of frames are shown in
Figure 6.
Frame Content
MOSI Frame
Start
(0x7E)
ADR
CMD
L
(1 Byte) (1 Byte) (1 Byte)
TX Data
0...255 Bytes
CHK
(1 Byte)
Stop
(0x7E)
Frame Content
MISO Frame
Start
(0x7E)
ADR
CMD
State
L
(1 Byte) (1 Byte) (1 Byte) (1 Byte)
RX Data
0...255 Bytes
CHK
(1 Byte)
Stop
(0x7E)
Figure 6 MOSI and MISO frames structure.
Start and Stop Byte (0x7E)
The 0x7E character is sent at the beginning and at the end of the frame to signalize frame start and stop. If this byte
(0x7E) occurs anywhere else in the frame, it must be replaced by two other bytes (byte-stuffing). This also applies to the
characters 0x7D, 0x11 and 0x13. Use Table 5 for byte-stuffing.
Original data byte
Transferred data bytes
0x7E
0x7D, 0x5E
0x7D
0x7D, 0x5D
0x11
0x7D, 0x31
0x13
0x7D, 0x33
Table 5 Reference table for byte-stuffing.
Example: Data to send = [0x43, 0x11, 0x7F] Data transmitted = [0x43, 0x7D, 0x31, 0x7F].
9
Sensirion High-Level Data Link Control.
Master Out Slave In. Frame direction from master to slave.
11 Master In Slave Out. Frame direction from slave to master.
10
www.sensirion.com
Preliminary – Version 0.9 – D1 – November 2018
5/20
Address
The slave device address is always 0.
Command
In the MOSI frame the command tells the device what to do with the transmitted data. In the MISO frame, the slave just
returns the received command.
Length
Length of the “TX Data” or “RX Data” field (before byte-stuffing).
State
The MISO frame contains a state byte, which allows the master to detect communication and execution errors. The first
bit is reserved for future use. Figure 7 shows the composition of the Status byte.
b7
0
b6
b0
Execution error code
Figure 7 Status byte structure.
The execution error code signalizes all errors which occur while processing the frame or executing the command. The
following table shows the error codes which can be reported from the device. Note that some of these errors are system
internal errors which require additional knowledge to be understood. In case of a problem, they will help Sensirion to
localize and solve the issue.
Error Code
dec
hex
0
0x00
1
0x01
2
0x02
3
0x03
4
0x04
40
0x28
67
0x43
Meaning
No error
Wrong data length for this command (too much or little data)
Unknown command
No access right for command
Illegal command parameter or parameter out of allowed range
Internal function argument out of range
Command not allowed in current state
Table 6 Reference table for error codes.
Data
The data has a usable size of [0…255] bytes (original data, before byte-stuffing). The meaning of the data content
depends on the command.
Checksum
The checksum is built before byte-stuffing and checked after removing stuffed bytes from the frame. The checksum is
defined as follows:
1. Sum all bytes between start and stop (without start and stop bytes).
2. Take the LSB of the result and invert it. This will be the checksum.
For a MOSI frame use Address, Command, Length and Data to calculate the checksum.
For a MISO frame use Address, Command, State, Length and Data to calculate the checksum.
www.sensirion.com
Preliminary – Version 0.9 – D1 – November 2018
6/20
Example (MOSI frame without start/stop and without byte-stuffing):
Adr
CMD
L
Tx Data 2 Bytes
CHK
0x00
0x00
0x02
0x01, 0x03
0xF9
The checksum is calculated as follows:
Adr
CMD
L
Data 0
Data 1
0x00
0x00
0x02
0x01
0x03
Sum 0x06
LSB of Sum 0x06
Inverted (=Checksum) 0xF9
4.2 UART / SHDLC Commands
The following table shows an overview of the available SHDLC commands.
CMD
0x00
0x01
0x03
0x80
0x56
0xD0
0xD3
Command
Start Measurement
Stop Measurement
Read Measured Value
Read/Write Auto Cleaning Interval
Start Fan Cleaning
Device Information
Reset
Read / Write / Execute
Execute
Execute
Read
Read / Write
Execute
Read
Execute
Table 7 Reference table for SHDLC commands.
4.2.1 Start Measurement (CMD: 0x00)
Starts the measurement12. After power up, the module is in Idle-Mode. Before any measurement values can be read, the
Measurement-Mode needs to be started using this command.
MOSI Data:
Byte # Datatype
0
uint8
1
uint8
Description
Subcommand, this value must be set to 0x01
Measurement-Mode, this value must be set to 0x03
MISO Data:
No data.
Example Frames:
MOSI
MISO
12
0x7E 0x00 0x00 0x02 0x01 0x03 0xF9 0x7E
Empty response frame:
0x7E 0x00 0x00 0x00 0x00 0xFF 0x7E
This command can only be executed in Idle-Mode.
www.sensirion.com
Preliminary – Version 0.9 – D1 – November 2018
7/20
4.2.2 Stop Measurement (CMD: 0x01)
Stops the measurement13. Use this command to return to the initial state (Idle-Mode).
MOSI Data:
No data.
MISO Data:
No data.
Example Frames:
MOSI
MISO
0x7E 0x00 0x01 0x00 0xFE 0x7E
0x7E 0x00 0x01 0x00 0x00 0xFE 0x7E
4.2.3 Read Measured Values (CMD: 0x03)
Reads the measured values from the module. This command can be used to poll for new measurement values. If no
new measurements are available, the module returns an empty response frame. The default measurement interval is
1 second.
MOSI Data:
No data.
MISO Data:
If no new measurement values are available: no data.
If new measurement values are available:
Byte #
0..3
4..7
8..11
12..15
16..19
20..23
24..27
28..31
32..35
36..39
Datatype
float (IEEE754)
float (IEEE754)
float (IEEE754)
float (IEEE754)
float (IEEE754)
float (IEEE754)
float (IEEE754)
float (IEEE754)
float (IEEE754)
float (IEEE754)
Description
Mass Concentration PM1.0 [µg/m³]
Mass Concentration PM2.5 [µg/m³]
Mass Concentration PM4.0 [µg/m³]
Mass Concentration PM10 [µg/m³]
Number Concentration PM0.5 [#/cm³]
Number Concentration PM1.0 [#/cm³]
Number Concentration PM2.5 [#/cm³]
Number Concentration PM4.0 [#/cm³]
Number Concentration PM10 [#/cm³]
Typical Particle Size [µm]
Example Frames:
13
MOSI
0x7E 0x00 0x03 0x00 0xFC 0x7E
Empty response frame:
0x7E 0x00 0x03 0x00 0x00 0xFC 0x7E
MISO
Or response frame with new measurement values:
0x7E 0x00 0x03 0x00 0x28 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0xD4 0x7E
This command can only be executed in Measurement-Mode.
www.sensirion.com
Preliminary – Version 0.9 – D1 – November 2018
8/20
4.2.4 Read/Write Auto Cleaning Interval (CMD: 0x80)
Reads/Writes the interval [s] of the periodic fan-cleaning. When the module is in Measurement-Mode an automatic
fan-cleaning procedure will be triggered periodically following a defined cleaning interval. This will accelerate the fan to
maximum speed for 10 seconds in order to blow out the dust accumulated inside the fan.
Important notes:
Measurement values are not updated while the fan-cleaning is running.
Set the interval to 0 to disable the automatic cleaning.
Once set, the interval is stored permanently in the non-volatile memory.
The default cleaning interval is set to 604’800 seconds (i.e., 168 hours or 1 week).
If the sensor is switched off, the time counter is reset to 0. Make sure to trigger a cleaning cycle at least every
week if the sensor is switched off and on periodically (e.g., once per day).
MOSI Data:
Read Auto Cleaning Interval:
Byte # Datatype
0
uint32
Description
Subcommand, this value must be set to 0x00
Write Auto Cleaning Interval:
Byte # Datatype
0
uint8
1..4 uint32
Description
Subcommand, this value must be set to 0x00
Interval in seconds
MISO Data:
Read Auto Cleaning Interval:
Byte # Datatype
0..3 uint8
Description
Interval in seconds
Write Auto Cleaning Interval: no data.
Example Frames:
MOSI
MISO
Read Auto Cleaning Interval:
0x7E 0x00 0x80 0x01 0x00 0x7D 0x5E 0x7E
Write Auto Cleaning Interval to 0 (disable):
0x7E 0x00 0x80 0x05 0x00 0x00 0x00 0x00 0x00 0x7A 0x7E
Response frame for “Read Auto Cleaning Interval”:
0x7E 0x00 0x80 0x00 0x04 0x00 0x00 0x00 0x00 0x7B 0x7E
Response frame for “Write Auto Cleaning Interval”:
0x7E 0x00 0x80 0x00 0x00 0x7F 0x7E
4.2.5 Start Fan Cleaning (CMD: 0x56)
Starts the fan-cleaning manually14. For more details, note the explanations given for the “Read/Write Auto Cleaning
Interval” command.
MOSI Data:
No data.
14
This command can only be executed in Measurement-Mode.
www.sensirion.com
Preliminary – Version 0.9 – D1 – November 2018
9/20
MISO Data:
No data.
Example Frames:
MOSI
MISO
0x7E 0x00 0x56 0x00 0xA9 0x7E
0x7E 0x00 0x56 0x00 0x00 0xA9 0x7E
4.2.6 Device Information (CMD 0xD0)
This command returns the requested device information. It is defined as a string value with a maximum length of 32
ASCII characters (including terminating null character).
MOSI Data:
Byte # Datatype
0
uint8
Description
This parameter defines which information is requested:
0x01: Product Name
0x02: Article Code
0x03: Serial Number
MISO Data:
Byte # Datatype
0…n string
Description
Requested Device Information as null-terminated ASCII string. The size of the string is limited to 32 ASCII
characters (including null character).
Example Frames:
Product Name:
MOSI
MISO
0x7E 0x00 0xD0 0x01 0x01 0x2D 0x7E
0x7E 0x00 0xD0 0x00 0x0D 0x48 0x65 0x6C 0x6C 0x6F 0x20 0x57 0x6F 0x72
0x6C 0x64 0x21 0x00 0xE5 0x7E
Article Code:
MOSI
MISO
0x7E 0x00 0xD0 0x01 0x02 0x2C 0x7E
0x7E 0x00 0xD0 0x00 0x0C 0x78 0x2D 0x78 0x78 0x78 0x78 0x78 0x78 0x2D
0x78 0x78 0x00 0x91 0x7E
Serial Number:
MOSI
MISO
0x7E 0x00 0xD0 0x01 0x03 0x2B 0x7E
0x7E 0x00 0xD0 0x00 0x15 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30
0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x00 0x5A 0x7E
4.2.7 Device Reset (CMD: 0xD3)
Soft reset command. After calling this command, the module is in the same state as after a Power-Reset. The reset is
executed after sending the MISO response frame.
MOSI Data:
No data.
MISO Data:
No data.
www.sensirion.com
Preliminary – Version 0.9 – D1 – November 2018
10/20
Example Frames:
MOSI
MISO
0x7E 0x00 0xD3 0x00 0x2C 0x7E
0x7E 0x00 0xD3 0x00 0x00 0x2C 0x7E
5 Operation and Communication through the I2C Interface
Usage:
I2C address:
0x69
Max. speed:
standard mode, 100 kbit/s
Clock stretching: not used
VDD
Rp
Rp
VDD (1)
SDA
SDA (2)
SCL
SCL (3)
SPS30
Connector
SEL (4)
GND (5)
Both SCL and SDA lines are open drain I/Os. They should
be connected to external pull-up resistors (e.g. Rp = 10 kΩ).
Important notice: in order to correctly select I2C as
interface, the interface select (SEL) pin must be pulled to
GND before or at the same time the sensor is powered up.
Figure 8 Typical I2C application circuit.
Some considerations should be made about the use of the I2C interface. I2C was originally designed to connect two chips
on a PCB. When the sensor is connected to the main PCB via a cable, particular attention must be paid to
electromagnetic interference and crosstalk. Use as short as possible (< 10 cm) and/or well shielded connection cables.
We recommend using the UART interface instead, whenever possible: it is more robust against electromagnetic
interference, especially with long connection cables.
5.1 Transfer Types
Set Pointer
Sets the 16-bit address pointer without writing data to the sensor module. It is used to execute commands, which do not
require additional parameters.
9
1
P P P P P P P P
7 6 5 4 3 2 1 0
ACK
P P P P P P P P
15 14 13 12 11 10 9 8
ACK
A6 A5 A4 A3 A2 A1 A0
ACK
SDA
Pointer Address
Write
I2C Header
9
1
9
SCL
1
S
I2C Address
www.sensirion.com
W A
Pointer MSB
A
Pointer LSB
A P
Preliminary – Version 0.9 – D1 – November 2018
11/20
Set Pointer & Read Data
Sets the 16-bit address pointer and read data from sensor module. It is used to read sensor module information or
measurement results. The data is ready to read immediately after the address pointer is set. The sensor module transmits
the data in 2-byte packets, which are protected with a checksum.
1
9
D D D D D D D D
7 6 5 4 3 2 1 0
ACK
9
A6 A5 A4 A3 A2 A1 A0
ACK
1
Read Data 0
Read
9
P P P P P P P P
7 6 5 4 3 2 1 0
ACK
P P P P P P P P
15 14 13 12 11 10 9 8
I2C Header
ACK
A6 A5 A4 A3 A2 A1 A0
ACK
SDA
Pointer Address
Write
I2C Header
9
1
9
...
...
SCL
9
1
9
...
S
...
D D D D D D D D
7 6 5 4 3 2 1 0
D D D D D D D D
7 6 5 4 3 2 1 0
9
1
Checksum
C C C C C C C C
7 6 5 4 3 2 1 0
NACK
1
C C C C C C C C
7 6 5 4 3 2 1 0
Read Data (n-1)
ACK
D D D D D D D D
7 6 5 4 3 2 1 0
Read Data (n-2)
ACK
...
Checksum
ACK
Read Data 1
1
ACK
1
9
1
9
...
I2C Address
...
W A
Pointer MSB
Data 1
A
A
Pointer LSB
Checksum 0
A
A P
...
S
Slave Address
R A
A
Data (n-1)
Data (n-2)
Data 0
A
A
...
Checksum
A P
It is allowed to read several times in succession without setting the address pointer again. This reduces the protocol
overhead for periodical reading of the measured values.
Set Pointer & Write Data
Sets the 16-bit address pointer and writes data to the sensor module. It is used to execute commands, which require
additional parameters. The data must be transmitted in 2-byte packets which are protected by a checksum.
1
9
1
9
1
Checksum
C C C C C C C C
7 6 5 4 3 2 1 0
ACK
9
Write Data 1
D D D D D D D D
7 6 5 4 3 2 1 0
ACK
1
D D D D D D D D
7 6 5 4 3 2 1 0
ACK
9
Write Data 0
P P P P P P P P
7 6 5 4 3 2 1 0
ACK
P P P P P P P P
15 14 13 12 11 10 9 8
ACK
A6 A5 A4 A3 A2 A1 A0
ACK
SDA
Pointer Address
Write
I2C Header
9
1
9
...
...
SCL
D D D D D D D D
7 6 5 4 3 2 1 0
1
D D D D D D D D
7 6 5 4 3 2 1 0
9
1
Checksum
C C C C C C C C
7 6 5 4 3 2 1 0
ACK
...
Write Data (n-1)
ACK
Write Data (n-2)
ACK
1
9
1
9
...
S
Slave Address
W A
Pointer MSB
A
Pointer LSB
...
www.sensirion.com
A
...
Data 0
A
Data 1
A
Checksum
A
Data (n-2)
A
Data (n-1)
A
Checksum
A P
Preliminary – Version 0.9 – D1 – November 2018
12/20
5.2 Checksum Calculation
The Read and Write Commands transmit the data in 2-byte packets, followed by an 8-bit checksum. The checksum is
calculated as follows:
Property
Name
Protected Data
Width
Polynomial
Initialization
Reflect Input
Reflect Output
Final XOR
Example
Value
CRC-8
read and/or write data
8 bit
0x31 (x^8 + x^5 + x^4 + 1)
0xFF
false
false
0x00
CRC(0xBEEF) = 0x92
uint8_t CalcCrc(uint8_t data[2]) {
uint8_t crc = 0xFF;
for(int i = 0; i < 2; i++) {
crc ^= data[i];
for(uint8_t bit = 8; bit > 0; --bit) {
if(crc & 0x80) {
crc = (crc