Close

Working with the MS5803 Pressure Sensor

A project log for Micro Dive

A DIY dive computer based on micropython

michaelMichael 02/12/2021 at 13:210 Comments

One of the most important parts of a dive computer is the pressure sensor, it is what is used to calculate the depth you are at, and without it, calculating decompression would not be possible.

During my research, I found two common sensors that seemed appropriate for the task, the MS5541 and the MS5803 (the 14Bar version of both). There were two reasons why I choose the MS5803, the first of which was the communication protocol. The MS5541 would have required an SPI 4 wire interface dedicated to it, it would not be able to share it with another, while the MS5803 can be used via I2C, requiring only 2 wires that could be combined with other devices if needed. The second reason was board availability, Sparkfun has created a breakout for the MS5803 which is widely available and well document making it both ideal for prototyping as well as potential use in a custom PCB.

While this board is well documented, the code is intended for an Arduino and so is written in c, rather than in the micropython that I am using. This meant either finding other code or writing my own driver. I was not able to find other code that I was completely happy with, and so via a combined process of reading the datasheet and referencing the Arduino code I have created a driver that can be found here: https://github.com/minyiky/ms5803-micropython

As part of this, I have included a couple of unit conversion functions that may be of use to some, although I may remove them in the dive computer to save on RAM usage. 

Discussions