Application and programming of I2C Pressure Sensor

Date: 2022-Mar-22

Micro Sensor Sensoring Products

Digital sensors output in formats like I2C bus, SPI bus, Microwire/PLUS bus and one-wire single bus, etc. The MPM3801 pressure sensor is digital with I2C bus output.

digital pressure sensor

There are three kinds of sensors inside the integrated underwater open channel flow meter, which collects flow rate, water level, and temperature data in real-time. The ultrasonic sensor is used to detect the flow rate with high accuracy, wide range, and fast response, the measuring point is in front of the probe, the flow field won’t be affected. The water level is measured by the digital pressure sensor installed at the rear, and the pressure is less affected by the water flow. The built-in temperature sensor measures temperature and makes digital temperature corrections.

Pressure Sensor for Water Level

The velocity area method is used to comprehensively calculate the flow rate of the measured liquid. It is ideal to measure flow rates and flow for rivers, open channels both ordinary and special one where it is difficult to construct standard sections such as the Parshall flume.


IIC Pressure Sensor

The I2C digital pressure sensor has gradually expanded its application field after years of market promotion, and its advantages are obvious as below:

1. The output consistency error of the sensor can reach 0.5% or less, and the characteristic parameters of the sensor can be identical, so it has good interchangeability.

2. Excellent electromagnetic compatibility, increased anti-interference ability of the sensor, and more reliable than analog signals.

3. Standard digital communication interface, the signal can be directly connected to the MCU, the MCU can obtain and process more different parameters, realize multi-functional intelligent instruments.


Product Programming

The data acquisition of the digital signal sensor needs to be programmed by MCU, which is more complicated than the analog signal sensor. We take the MPM3808 I2C pressure sensor as an example to illustrate how digital sensors can read measurement data.

MPM3808 I2C digital pressure sensor, the I2C default communication address is 0x28, write: 0x50, read: 0x51; SCLK clock frequency: 100KHz ~ 400KHz.

The I2C master device (such as a microcontroller) sends a 7-bit slave address (0x28) and an 8th bit = 1 (read). As a slave device, the pressure sensor sends an acknowledge (ACK) as a sign to indicate that the communication is successful. The slave device then returns two bytes of pressure data (P[13:8] and P[7:0]), two bytes of temperature data (T[10:3] and T[2:0] to the master. ]). The I2C communication process is as follows:

I2C pressure sensor communication process

I2C is a commonly used communication method. Many integrated development environments (IDE) integrate the I2C library function. When data is acquired, the MCU can directly call the library function to realize the sensor I2C signal reading. For example, if you call the library function wire.h, the communication flow is as follows:

Wire.begin(4,5); // Initialize I2C bus, SDA:4, SCL:5

Wire.beginTransmission(0x28); // Start transferring data once

Wire.endTransmission(void); // The communication ends and the host sends a STOP signal.

Wire.requestFrom(0x28, 4); // Read 4 bytes of data from the 0X28 device

Wire.available(); // Number of bytes received; // Receive data, P1, P2, T1, T2

Pressure = P1 <<8 | P 2; // 14-bit pressure data (BIN)

Temperature = T1 <



The data read by the MCU from the MPM3808 pressure sensor is the code value, the pressure is a 14-bit binary number (0~16383), and the temperature is an 11-bit binary number (0 ~ 2047). For example, the sensor's basic range: 0~300Kpa, the output signal (5%~95%) corresponds to 819 ~ 15563, the code value and pressure and temperature conversion are as follows:

how digital sensors can read measurement data?

(I2C data collected by MCU is simulated and printed by the SecureCRT terminal through the serial port)


At present, most sensor applications use analog output signals, but the convenience of digital output sensor applications such as I2C has been recognized by more and more designers. The sensor uses serial bus technology, which can simplify the system's hardware, reduce the size, and improve reliability. At the same time, the system upgrade and expansion are extremely easy.


Contact Us

For specific applications of the MPM3808 digital pressure sensor, please contact us via Our engineers will provide the corresponding product solutions according to your actual needs.


Previous posts: Level Transmitter Portfolio

Next chapter: Pressure Transmitter Applied In Petrol Stations

Related Products

ATEX Pressure Transmitter

Water Pressure Transmitter

General / Flush Diaphragm
CE, RoHS, ATEX approved

more info...

Digital RS485 HART Pressure Transmitter

Water Pressure Transmitter

Accuracy: ±0.15%FS (Typ.)
RS485/HART Protocol

more info...

IIC Pressure Sensor

Water Pressure Transmitter

Accuracy: ±0.25%FS
Digital IIC output

more info...

Digital Pressure Transmitter

Water Pressure Transmitter

Accuracy: ± 0.25%FS
General use structure

more info...


Contact Us

If you still can't find what you're looking for, please contact us with more details so that we can provide you with a suitable solution.


No. 18, Yingda Road,
Baoji, 721006,Shaanxi,P.R.China

German Subsidiary
Micro Sensor GmbH
Girardetstr. 6, D-45131 Essen, Germany

Tel: +86-29-88346384
Whatsapp: 15114817352