MS5803-14BA Pressure Sensor Hookup Guide

Contributors: CaseyTheRobot
Favorited Favorite 6


 MS5803-14BA Breakout Board

The MS5803-14BA is a pressure sensor with an I2C ("Wire") and SPI interface.

Pressure sensors measure the absolute pressure of the fluid around them. This includes air, water, and anything else that acts like a viscous fluid. Depending on how you interpret the data, you can determine altitude, water depth, or any other tasks that require an accurate pressure reading.

Covered in This Tutorial

We will show you how to connect this sensor to an Arduino microcontroller and use the included software library to get measurements out of the sensor. We'll also show you how to interpret the readings showing changes in altitude and water depth.

Suggested Reading

This part is easy to use. But before you start, we recommend the following background knowledge:

Connecting the Hardware - I2C

In this example, we will communicate with the MS5803-14BA using the I2C interface.

Connection Names

The MS5803-14BA Breakout Board breaks out seven connections from the IC. We traditionally call these connections "pins" because they come from the pins on the IC, but they are actually holes that you can solder wires or header pins to.

alt text

We'll connect four of the seven pins on the board to your Arduino. The four pins you need are labeled GND, VCC, SCL, and SDA.

Connecting Headers to the Board

You can use any method you like to make your connections to the board. For this example, we'll solder on a seven-pin length of male-male header strip, and use male-female jumper wires to connect the MS5803-14BA to your Arduino.

Solder a 7-pin length of male-male header to the board. You can solder it to either side. The bottom is more useful for breadboards, and the top is more useful for jumper wires.

alt text

Connecting the Board to your Arduino

When you're done soldering, connect the GND, 3.3v, SDA, and SCL pins to your Arduino. Different Arduino models use different pins for the I2C interface; use the following chart to determine where to plug everything in.

IMPORTANT: Connect the power pins (3.3v and GND) ONLY to a 3.3V supply. Larger voltages will permanently damage the part. Note that because I2C uses open drain drivers, it is safe to connect the I2C pins (DA and CL) to an I2C port on a 5V microprocessor.

MS5803-14BA label Pin function Arduino connection
GND ground GND
3.3v 3.3V power supply 3.3V
SDA I2C data Any pin labeled SDA, or:
Uno, Redboard, Pro / Pro Mini A4
Mega, Due 20
Leonardo, Pro Micro 2
SCL I2C clock Any pin labeled SCL, or:
Uno, Redboard, Pro / Pro Mini A5
Mega, Due 21
Leonardo, Pro Micro 3

alt text

Once you have the MS5803-14BA connected to your Arduino, we're ready to play with the software.

Installing the Arduino Library

Libraries are collections of software functions geared towards a single purpose, such as communicating with a specific device. Arduino comes with a number of built-in libraries that help you do advanced tasks. We've written an Arduino library called SFE_MS5803_14BA_I2C that allows you to easily talk to the MS5803 sensor. This library is not included with the stock Arduino software, but don't worry, installing new libraries is easy.

If you'd like to interface the MS5803 to a microcontroller other than an Arduino, the C++ source code in the library and the information in the datasheet may be helpful when writing your own code.

1. Install the Arduino IDE

If you don't already have the Arduino IDE (Integrated Development Environment) installed, download the version for your system (Windows, Mac, Linux) from and install it following the instructions on that site.

If you need help installing the IDE, check out our tutorial.

2. Install the SFE_MS5803_14BA_I2C Library

User-installed libraries live in a "libraries" folder within your personal Arduino sketch folder. On Windows systems your personal sketch folder is located in "My Documents/Arduino". On Mac computers, it's "~/Documents/Arduino". On Linux it is usually "~/Arduino/sketchbook". Locate your personal Arduino sketch folder and open it so you can drag new files into it.

Now download the latest MS5803 software archive from this link: You can either save the file to your system and open it later, or open it directly.

(Note that you can find the .zip file for any Github repository by looking for the "Download ZIP" button on the main page:)

alt text

Open the .zip file you just downloaded. (On most systems you should be able to double-click it to show the included files.) Open the folder called "MS5803-14BA_Breakout-master", then "Libraries", then "Arduino". You should now see a folder called "SFE_MS5803_14BA_I2C". Drag the "SFE_MS5803_14BA_I2C" folder from the .zip folder into your personal Arduino sketch folder. If you get a warning that there is already a libraries folder there, that's fine. It just means you've already installed some libraries, which is great! Just tell your system to go ahead and overwrite them, which sounds alarming but will only add the new library to the existing folder.

alt text

That's it! Now restart the Arduino IDE and you should be ready to go.

If any of these instructions are unclear, you can find more detailed instructions in our installing an arduino library tutorial.

Running the Example sketches

Running the Example Sketch

The library you just installed includes an example sketch that show basic operation of the MS5803. This are designed to be a starting point for writing your own code.

After you install the library, run the Arduino IDE, and open the following menu item: File / Examples / SFE_MS5803_14BA / SFE_MS5803_14BA_I2C_demo.

(If you don't see this menu item, you may not have installed the library correctly, or didn't restart the Arduino IDE. Take another look at the library installation page to see if you missed any steps.)

alt text

When the example opens, upload it to your Arduino (remember to select the correct board type and serial port), and open the Serial Monitor to 9600 baud. You should see some diagnostic information (if it can't find the device, double check your hardware connections) followed by measurement readings.

alt text

Writing Your Own Sketches

The comments and code in the example sketch should get you started when writing your own sketches. In many cases you should be able to copy and paste the example code into your own sketch.

Resources and Going Further

If you have any problems or questions, our technical support department can help. Please don't hesitate to contact us. We also love to hear about your projects!

Further reading and projects: