MS5803 Pressure Sensor

💻

MS5803 Pressure Sensor

💻

Table of Contents

Setup and Usage

In the interest of collecting pressue data for my in-progress, underwater sensor platform, I decided to purchase an pressure sensor1. The decision to use the MS5803 sensor board from SparkFun1 was made after searching around for waterproof sensors that had a wide pressure range, good precision, relatively low cost and little soldering. I stumbled upon a wonderful underwater data logger project2 that used the MS5803 and found that the sensor met my requirements and was already proven by that project to work well in harsh, marine environments.

To test it, I used my Raspberry Pi 3 Model B+ and followed the ms5803py package tutorial3. In order to test the installed ms5803py package, I initially used the package’s github source code4 and its example.py. example.py has a syntax bug, but otherwise runs OK. Though, because the package is written for python3 only, I may have to rewrite it for python2 depending on how the underwater sensor platform progresses in its tech stack.

However, it became apparent after comparing the sensor’s pressure output to local weather stations’ pressure readings, that the ms5803py package has an order-of-magnitude error5 when reporting pressure. So, I forked6 the source repo and began testing the conversion math used in sensor.py. After sprinkling some print() calls at various points in the conversion math and verifying that all intermediate steps matched the expected output from the sensor’s datasheet7, I pushed a simple fix to my fork6 of the ms5803py package. Consequently, I’ll be using my forked version of the project going forward and not the pypi package, ms5803py (unless this error is fixed in it at some point).

To recap the issues with the ms5803py package:

  1. The ms5803py package is written only for python3.
  2. There is a simple, syntax bug in example.py in ms5803py’s source code4.
  3. There is a simple, order-of-magnitude math bug in sensor.py in ms5803py’s source code5.
  4. Temperature seems to be off from local stations’ readings. (can be somewhat handled by changing the OverSampling Rates (OSR) of the pressure and temperature sensors as mentioned in the github repository4)
I made the mistake of letting my curiosity get the best of me before reading the sensor's manufacturing process in its datasheet and lightly poked around with the tip of a mechanical pencil on the surface of the sensor diaphragm. The silicone used is very sticky and easily disturbed. Unfortunately, graphite residue on the tip of the pencil became embedded in the silicon, which is why the image of the sensor in this post has a black dot on the white diaphragm. I don't think I damaged the sensor, but it could easily be done and I will have to be mindful of the fragile silicone residing on it in the future.

As the underwater sensor platform moves forward and because the sensor board also supplies a temperature reading, I may investigate combining its temperature reading with the IMU’s temperature reading to hopefully gain a more accurate temperature readout.

UPDATE 7/18/2019

The package maintainer for ms5803py3 has corrected the installation issues mentioned above and allowed for variable accuracy of the presure and temperature sensors in both the github repository4 and pypi package 3 for the driver code.

Avatar
John Dallas Cast
Software Engineer

My research interests include computer vision and deep learning.

Related