Component guide · Intermediate · 3 min read
TE MS5837-02BA and 30BA Water Depth Sensors, MS5840-02BA Barometer

and MS5525DSO Digital Differential Pressure Sensor
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
The MS5837 is a small gel-filled pressure sensor that works under water, used in ROVs, depth loggers and diving projects. The 30BA version reads to 30 bar (about 300 m of water) and the 02BA to 2 bar for high-resolution altitude or shallow depth. The MS5840 is a barometer, and the MS5525DSO is a 24-bit digital differential sensor for 1 to 30 psi.
Key specs at a glance
- Range
- 0.3 to 1.2 bar (02BA, MS5840), 0 to 30 bar (30BA), 1 to 30 psi (MS5525)
- Resolution
- 24-bit ADC; about 0.2 mbar (30BA) or 0.016 mbar (02BA)
- Interface
- I2C at 0x76 (MS5837); I2C or SPI (MS5525)
- Supply
- 1.5 to 3.6 V
- Media
- Gel-filled, water compatible (MS5837)
- Temperature
- Built in
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
Option 1TE Connectivity MS5837-02BA21 Absolute Pressure Sensor Module, 0.3-1.2 bar, Digital I²C₹499
Option 2TE Connectivity MS583702BA01-50 Pressure and Temperature Sensor, 300-1200 mbar Range, 1.5-3.6V, I2C Interface₹689
Option 3TE Connectivity MS583730BA01-50 Digital Pressure Sensor, 0-30 bar Sealed Gauge, I2C Interface₹1,049
Option 4TE Connectivity MS5840-02BA01 Absolute Pressure Sensor Module – I2C Digital Interface₹759
Option 5TE Connectivity MS5525DSO Digital Pressure Sensor, 1~30 PSI (69~2068 mbar), 24-bit I2C/SPI Output, MEMS High Precision₹6,129
What the MS5837, MS5840 and MS5525 pressure sensors is
The TE MS5837 and MS5840 are gel-protected pressure sensors for water depth and altitude; the MS5837-30BA reads up to 30 bar (about 300 m of water).
Depth = (pressure - surface pressure) / (fluid density x 9.81). Fresh water is about 997 kg/m3 and sea water about 1029.
The bare sensor needs a sealed housing with only the gel cap exposed; potting the wires is essential.
MS5837, MS5840 and MS5525 pressure sensors pinout
The pins on the MS5837, MS5840 and MS5525 pressure sensors and what each one does.
| Pin | Function |
|---|---|
| VDD | 3.3 V |
| GND | Ground |
| SDA / SCL | I2C |
| CSB / SDO | SPI on MS5525 |
- VDD
- 3.3 V
- GND
- Ground
- SDA / SCL
- I2C
- CSB / SDO
- SPI on MS5525
Wiring the MS5837, MS5840 and MS5525 pressure sensors
3.3 V parts: use a level shifter with a 5 V Uno. Keep I2C cables short or use an I2C extender for tethers.
| MS5837, MS5840 and MS5525 pressure sensors pin | Arduino Uno | ESP32 |
|---|---|---|
| VCC | 5V (or 3.3V) | 3V3 |
| GND | GND | GND |
| SDA | A4 | GPIO 21 |
| SCL | A5 | GPIO 22 |
- VCC
- Arduino Uno:
- 5V (or 3.3V)
- ESP32:
- 3V3
- GND
- Arduino Uno:
- GND
- ESP32:
- GND
- SDA
- Arduino Uno:
- A4
- ESP32:
- GPIO 21
- SCL
- Arduino Uno:
- A5
- ESP32:
- GPIO 22
Example code
A minimal sketch to check the part works.
#include <Wire.h>
#include "MS5837.h"
MS5837 sensor;
void setup() {
Serial.begin(115200);
Wire.begin();
while (!sensor.init()) { Serial.println("MS5837 not found"); delay(1000); }
sensor.setModel(MS5837::MS5837_30BA); // or MS5837_02BA
sensor.setFluidDensity(997); // fresh water
}
void loop() {
sensor.read();
Serial.printf("%.1f mbar %.2f C depth %.2f m\n", sensor.pressure(), sensor.temperature(), sensor.depth());
delay(500);
}Setup and tuning
VCC 3.3 V, GND, SDA and SCL with pull-ups.
use the Blue Robotics MS5837 library for Arduino.
set the library to 02BA or 30BA to match your sensor.
set density to 997 for fresh water or 1029 for sea water for depth.
seal the cable entry; only the gel-covered sensor face may touch water.
What you need
Shop this list7 of 8 found in our store · ₹9,534
TE Connectivity MS5837-02BA21 Absolute Pressure Sensor Module, 0.3-1.2 bar, Digital I²C: the part this guide coversTE Connectivity MS5837-02BA21 Absolute Pressure Sensor Module, 0.3-1.2 bar, Digital I²C₹499
TE Connectivity MS583702BA01-50 Pressure and Temperature Sensor, 300-1200 mbar Range, 1.5-3.6V, I2C Interface: another version this guide coversTE Connectivity MS583702BA01-50 Pressure and Temperature Sensor, 300-1200 mbar Range, 1.5-3.6V, I2C Interface₹689
TE Connectivity MS583730BA01-50 Digital Pressure Sensor, 0-30 bar Sealed Gauge, I2C Interface: another version this guide coversTE Connectivity MS583730BA01-50 Digital Pressure Sensor, 0-30 bar Sealed Gauge, I2C Interface₹1,049
TE Connectivity MS5840-02BA01 Absolute Pressure Sensor Module – I2C Digital Interface: another version this guide coversTE Connectivity MS5840-02BA01 Absolute Pressure Sensor Module – I2C Digital Interface₹759
TE Connectivity MS5525DSO Digital Pressure Sensor, 1~30 PSI (69~2068 mbar), 24-bit I2C/SPI Output, MEMS High Precision: another version this guide coversTE Connectivity MS5525DSO Digital Pressure Sensor, 1~30 PSI (69~2068 mbar), 24-bit I2C/SPI Output, MEMS High Precision₹6,129
ESP32-WROOM-32 38-pin development board: for Wi-Fi logging and dashboardsESP32-WROOM-32 38-Pin Development Board₹389- Uno R3 development board: the controller used in the wiring tableFind this part
4-channel logic level converter (BSS138): to connect 5 V and 3.3 V signals safely4-Channel Logic Level Converter (BSS138)₹20
Alternatives and when to choose them
- MS5803: stainless 14 and 30 bar parts.
- BMP390 and BMP581: barometers.
- Submersible level transmitters: ready probes.
Common mistakes to avoid
- Choosing the wrong model in the library.
- Leaving the cable entry unsealed.
- Touching or scratching the gel.
- Not zeroing at the surface.
Frequently asked questions
How deep can the MS5837-30BA measure?
Up to 30 bar, which is about 300 m of water.
Why does depth read wrong in sea water?
Set the fluid density to 1029 kg/m³ for sea water.
Can I use it for altitude too?
The 02BA version suits altitude; the 30BA is for depth.
Which library should I use?
The Blue Robotics MS5837 library supports both the 02BA and 30BA versions.
Why does the reading drift on land?
Atmospheric pressure changes; zero the depth at the surface.
Parts for this guide
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

