MS5611-01BA Arduino library: first developments results

Last updated on Sun, 2012-09-09 18:08. Originally submitted by fabio on 2011-06-12 20:16.

I spent the last days working on the MS5611-01BA high resolution pressure sensor. I wrote an Arduino library for it which you can find on my bzr repository:

  • browse repository
  • download library
  • use bzr co http://repository.varesano.net/MS561101BA/ to get a copy directly using bzr.
  • the MS5611 library is now part of the FreeIMU library. Please refer to the FreeIMU library for newer code.

The library comes associated with a Processing visualization sketch which you can use to visualize a the readings coming from the sensor using a graphical tool.

The results I've got so fare are pretty good. Precision is about 0.02-0.03 mbar and altitude estimation resolution is about 10-15 cm. Relative measurement of altitude using the sensor looks very good but I'm still looking for a better approach on absolute altitude estimation.

In the video below you find an example of my initial developments.

AttachmentSize
MS5611_Arduino_20120909.zip21.26 KB

and Ms5611 by SPI

Submitted by CAF (not verified) on Tue, 2012-11-06 22:18.

Any body havea example sketch for MS5611 using SPI interface??

thanks

I seem to get the same

Submitted by Jim (not verified) on Wed, 2012-10-03 16:21.

I seem to get the same results as Angel like
temp: 24.67 degC pres: 335.75 mbar altitude: 10713.03 m
even using the MS5611_Arduino_20120909.zip code on an UNO, confused as Angel seems to have it working.

That's very strange.. I've

Submitted by fabio on Wed, 2012-10-03 17:33.

That's very strange.. I've been using the new code personally a lot lately and it worked fine here. Are you sure that you are using the correct version? Which example sketch are you using?

I am using your

Submitted by Jim (not verified) on Fri, 2012-10-05 12:04.

I am using your MS561101BA_altitude.pde sketch Fabio.

Fixed? It seems so..

Submitted by fabio on Sun, 2012-09-09 18:11.

Looks like I've been finally able to fix this f***ing code.. Fixed code is on http://www.varesano.net/files/MS5611_Arduino_20120909.zip or on FreeIMU library repository.

Values obtained using the new code are in line with a local weather station.

Any improvement welcome.

In MS561101BA::getConversion

Submitted by ala42 (not verified) on Sun, 2012-09-09 18:40.

In MS561101BA::getConversion initialize conversion.raw[3] to 0.

Right. Thanks for pointing

Submitted by fabio on Mon, 2012-09-10 00:28.

Right. Thanks for pointing this out. I went with changing the initialization to

union {uint32_t val; uint8_t raw[4]; } conversion = {0};

which looks clearer to me and should serve the same purpose.

Works!

Submitted by Angel (not verified) on Sun, 2012-09-09 18:28.

Thanks! Yes, the new code seems to work fine here also!!
Sorry for being a pain in the ass ;-)

Wrong readings for both temperature and barometer

Submitted by Angel (not verified) on Sun, 2012-09-09 10:48.

I haven't been able to get correct readings from MS5611-01BA (FreeIMU v.0.4) and the FreeIMU library. The readings are completely offset and they drift a lot, some example results:
temp: 24.67 degC pres: 335.75 mbar altitude: 10713.03 m
temp: 24.67 degC pres: 335.75 mbar altitude: 10713.04 m
temp: 24.67 degC pres: 335.75 mbar altitude: 10713.04 m
temp: 24.67 degC pres: 335.75 mbar altitude: 10713.04 m
temp: 24.67 degC pres: 335.75 mbar altitude: 10713.02 m
temp: 24.67 degC pres: 335.75 mbar altitude: 10713.02 m
temp: 24.67 degC pres: 335.75 mbar altitude: 10713.02 m
temp: 24.67 degC pres: 335.75 mbar altitude: 10713.04 m
temp: 24.67 degC pres: 335.75 mbar altitude: 10713.04 m
temp: 24.67 degC pres: 335.75 mbar altitude: 10713.04 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.20 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.20 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.20 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.21 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.21 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.21 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.18 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.18 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.18 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.20 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.20 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.20 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.20 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.20 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.20 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.20 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.20 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.20 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.25 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.25 m
temp: 24.68 degC pres: 335.75 mbar altitude: 10713.25 m

after a couple of minutes:
temp: 26.00 degC pres: 336.61 mbar altitude: 10733.22 m
temp: 26.00 degC pres: 336.62 mbar altitude: 10733.22 m
temp: 26.00 degC pres: 336.62 mbar altitude: 10733.22 m
temp: 26.00 degC pres: 336.62 mbar altitude: 10733.22 m
temp: 26.01 degC pres: 336.62 mbar altitude: 10733.30 m
temp: 26.01 degC pres: 336.62 mbar altitude: 10733.30 m
temp: 26.01 degC pres: 336.62 mbar altitude: 10733.30 m
temp: 26.01 degC pres: 336.62 mbar altitude: 10733.29 m
temp: 26.01 degC pres: 336.62 mbar altitude: 10733.29 m
temp: 26.01 degC pres: 336.62 mbar altitude: 10733.29 m
temp: 26.00 degC pres: 336.62 mbar altitude: 10733.24 m
temp: 26.00 degC pres: 336.62 mbar altitude: 10733.24 m
temp: 26.00 degC pres: 336.62 mbar altitude: 10733.24 m
temp: 26.00 degC pres: 336.62 mbar altitude: 10733.24 m

I live more or less 100m above sealevel and temperature was around 21 degrees.
In the video the readings are also offset, has this problem been solved?
Has anyone managed to get correct readings with the FreeIMU library?
Thanks

Would you guys give a try to

Submitted by fabio on Sun, 2012-09-09 14:38.

Would you guys give a try to this code? http://sprunge.us/OSAU

Working as expected here.

MS5611 1.0 library bugfix

Submitted by Guz (not verified) on Tue, 2012-08-28 08:44.

Hi,

I bug fixed the 1.0 version of the library (overflow) problem with some cast.

Now the lib works properly for both of my MS5611.

I'll do some code cleaning tonight and I'll post code to you.

Regards.

Guz.

Awesome, looking forward to

Submitted by fabio on Tue, 2012-08-28 12:00.

Awesome, looking forward to your bug fixes! Please, it would help if you could use the version on the FreeIMU library as starting version for your fixes.

That's what I've done. I took

Submitted by Guz (not verified) on Tue, 2012-08-28 15:01.

That's what I've done.

I took the last official FreeIMU version and modify MS5611 lib.

Post it as soon as possible.

Guz.

Hi, Sorry that I could not

Submitted by Guz (not verified) on Thu, 2012-09-06 10:19.

Hi,

Sorry that I could not find some time these past days to release the fixed library.

I comment again to tell that altitude estimation is really weather dependant as the "sea-level" pressure can vary with the weather.

For my project I push the pression and temperature info and process it on my PC to take the actual pressure at ground level and then get a more reliable altitude.

Does someone else worked on that problem ?

I need a good solution to get the altitude.

Another point I got few meters difference between to FreeIMU. So I'll check my code again as I remove the extra_precision code.

Hi Guz, in my comments above

Submitted by fabio on Mon, 2012-09-10 14:32.

Hi Guz, in my comments above you should see that I fixed the code.. but I'm still interested in seeing your improvements.. yeah, for greater reliability one would need to take into account sea level pressure readings. I'm very interesting in knowing more details about your approach on this.

Prom base address

Submitted by tangodp (not verified) on Mon, 2012-07-30 16:53.

in the file MS5611-01BA.h, I see

#define MS561101BA_PROM_BASE_ADDR 0xA2 // by adding ints from

But in the documentation page 9, I read : PROM Read 0xA0

I am not a programmer, 0xA2 is it true or is it a mistake ?

my pression read is no good !

Yes 0xA2 is OK, I undestand

Submitted by tangodp (not verified) on Tue, 2012-07-31 12:31.

Yes 0xA2 is OK, I undestand with the documentation page 12 : A0 resrved for the manufacturer

Bad readings from baro

Submitted by cbarreto (not verified) on Fri, 2012-06-08 11:53.

Ciao Fabio
first of all i wanna thank you for the great job you have done. i got my freeimu v4 last week, yesterday i was working with the baro and noticed that the mbar readings are not right, it measures around -4000 mbar, so it translates the altitude to -10.000 m ??????
i want to know if have you had a problem like this?, or maybe is just that my baro is broke.
Thanks. :)

Carlos

Some people reported strange

Submitted by fabio on Sat, 2012-06-09 09:23.

Some people reported strange readings when using my software.. while the sensors worked fine with other softwares. You can try using the MultiWii software and see with the guys what readings you get.

Ciao Fabio, Ho visto che

Submitted by Kylix (not verified) on Thu, 2012-05-03 21:31.

Ciao Fabio,

Ho visto che utilizzi il Logic Lever Converter per alimentare l'MS5611. C'è qualche problema se io l'alimentazione la prendo direttamente dal pin 3.3V dell'Arduino Uno?

Volevo dire Logic Level

Submitted by Kylix (not verified) on Thu, 2012-05-03 21:32.

Volevo dire Logic Level Converter

Non dovrebbe.. magari

Submitted by fabio on Fri, 2012-05-04 01:05.

Non dovrebbe.. magari aggiungici un condensatore grosso in parallelo vicino alla scheda breakout.. magari un elettrolitico da 10uF, giusto da esser sicuro di avere un'alimentazione pulita.

3.3V

Submitted by Kylix (not verified) on Fri, 2012-05-04 06:55.

Utilizzando i 3.3V dell'Arduino Uno devo disabilitare le resistenze pullup interne? (Ho letto da qualche parte ma non sono sicuro se è necessario o no).

Il condensatore elettrolitico come dovrei collegarlo? (sono un principiante nel campo dell'elettronica).

Grazie

Si, devi disabilitarle. Ma la

Submitted by fabio on Fri, 2012-05-04 11:18.

Si, devi disabilitarle. Ma la libreria in questa pagina le disabilita da sola.

Per la connessione, vedi immagine sotto:

Gli elettrolitici li conosco

Submitted by Kylix (not verified) on Fri, 2012-05-04 11:21.

Gli elettrolitici li conosco ... Quello che mi sfugge è: collegare il condensatore fra GND e 3.3V dell'Arduino?

Il capo positivo del

Submitted by fabio on Fri, 2012-05-04 11:23.

Il capo positivo del condensatore sul +3.3V positivo vicino alla breakout board e il capo negativo vicono al GND sulla breakout board.

MS5611 Sketch is working perfect

Submitted by Jürgen (not verified) on Wed, 2012-05-02 18:44.

Here is a Link to a working Sketch in the Arduino Forum:

http://arduino.cc/forum/index.php/topic,103377.0.html

Look at the posting from Leo and use his sketch, its working perfect :-)

Jürgen

Different MS5611

Submitted by Anonymous (not verified) on Fri, 2012-04-20 21:08.

After some trying the MS5611 gave quite good result. What I did NOT like were the absolute high values.

So I ordered a second MS5611 from another source.

Made a short test with Fabio's sketch today.

Arduino uno, LLC, 2 min run with sensor #1, then 2 min run with sensor #2.

Sensor #1:

temp: 22.48 degC pres: 975.18 mbar altitude: 185.71 m
temp: 22.50 degC pres: 975.18 mbar altitude: 185.72 m
temp: 22.47 degC pres: 975.19 mbar altitude: 185.69 m
temp: 22.49 degC pres: 975.18 mbar altitude: 185.73 m
temp: 22.49 degC pres: 975.18 mbar altitude: 185.73 m
temp: 22.49 degC pres: 975.17 mbar altitude: 185.80 m
temp: 22.49 degC pres: 975.17 mbar altitude: 185.81 m
temp: 22.49 degC pres: 975.18 mbar altitude: 185.80 m
temp: 22.49 degC pres: 975.18 mbar altitude: 185.76 m
temp: 22.48 degC pres: 975.18 mbar altitude: 185.77 m

Sensor #2:

temp: 22.59 degC pres: 991.57 mbar altitude: 41.22 m
temp: 22.60 degC pres: 991.58 mbar altitude: 41.15 m
temp: 22.60 degC pres: 991.58 mbar altitude: 41.10 m
temp: 22.60 degC pres: 991.58 mbar altitude: 41.11 m
temp: 22.61 degC pres: 991.58 mbar altitude: 41.10 m
temp: 22.59 degC pres: 991.58 mbar altitude: 41.10 m
temp: 22.60 degC pres: 991.58 mbar altitude: 41.11 m
temp: 22.60 degC pres: 991.59 mbar altitude: 41.05 m
temp: 22.60 degC pres: 991.59 mbar altitude: 41.04 m
temp: 22.60 degC pres: 991.59 mbar altitude: 41.01 m

Airport nearby 37 m above sea level reported QNH 996.3 mbar

(QNH = pressure calculated at sea level)

Seems to me, there a B quality sensors (or sensors with faulty calibration) around......

Me too, I have purchased 2

Submitted by Marco (not verified) on Mon, 2012-04-23 08:49.

Me too, I have purchased 2 sensors from Drotek and i've same results...
They are marked 5611ba but works only with old library.
The sensors works fine for 2/3 minutes and after seems be "crazy" and pressure reads change of 20/30 mbar.
They are unusable, I don't know why...
Marco

Different MS 56111

Submitted by Anonymous (not verified) on Sat, 2012-04-21 11:31.

I have wrong results with my Sensor too, the baro-readings changes with the temperature! Can you tell me which Fabios sketch you´ve used and if possible did you share the sketch with me.

My MS 5611 read this im moment: temp: 21.85 decC baro: 945.55 mbar

My wheater-station reads 959.51 mbar!

Jürgen

problemi con java

Submitted by Marco (not verified) on Tue, 2012-03-20 15:51.

Ciao Fabio,
sto cercando di provare sto sensore con le tue librerie ma non riesco a compilarlo con l'ide su Mac.
Mi da una serie di errori relativi alle librerie java.. non ho mai usato java con arduino...
Ho provato a installare la libreria java rxtx ma niente..
Secondo te cosa potrebbe essere
Marco, Torino

Yeah, I've got like all

Submitted by Joost (not verified) on Fri, 2012-03-16 02:22.

Yeah, I've got like all symptoms listed below.
I had got 2 pieces of droktek of the MS5607, I now have the MS5611's but the temperature as well as the pressure seem to jump around.

With the NEW library I got:
temp: 28.45 degC pres: 388.60 mbar
temp: 26.45 degC pres: 383.28 mbar
(These are combined results!)
+/- 2 degrees temperature jump.
+/- 5 mbar pressure jump.

With the OLD library I got:
temp: 24.81 degC pres: 1015.38 mbar
temp: 27.98 degC pres: 1020.79 mbar
temp: 29.69 degC pres: 1004.85 mbar
temp: 27.11 degC pres: 999.62 mbar
+/- 2 degrees temperature jump.
+/- 5 mbar pressure jump but now really unstable, ranging 20 mbar!?

I gradually heat them under my desk lamp, and shift the pressure in my mouth :) During changes, the results gradually go up or down as expected, but also jump up and down. Sometimes it stays "jumped" for minutes.

My physical barometer shows about 1021 mbar and 24 degrees.

Is the drotek board crap? they seem to be stamped according to the MS5611-01BA01 datasheet...

Sorry for the late reply..

Submitted by fabio on Wed, 2012-05-02 11:36.

Sorry for the late reply.. keeping up with all the comments on the website is very hard.

How are you powering the board? That's pretty unlikely that such noisy readings are caused by bad software.. so, I'd rather think this may be caused by some noisy power source or something similay.. I'd suggest adding some 10uF tantalum/electrolitic caps in parallel to the sensor power source or use a low noise voltage regulator as the MIC5203 used in FreeIMU.

I'm using an arduino pro mini

Submitted by Joost (not verified) on Fri, 2012-03-16 02:36.

I'm using an arduino pro mini 3.3v and arduino v1.0 software.
(wire.send = wire.write; wire.recieve = wire.read; WProgram.h = Arduino.h)
I've got 1 soldered as 0x77 (CSB_LOW) and 1 as 0x76 (CSB_HIGH)

I'm about to solder them back to back and update the library to handle them both. I've tried to get them working at my mbed (LPC1768) micro but didn't succeed yet. I'm also about to order different breakout's... will mail drotek (again as well)

argh.. :)

use with freeIMU 0.3.5MS

Submitted by raune (not verified) on Mon, 2012-03-12 10:35.

Hi Fabio,

can I use this with my 3.5MS? and the freeImu lib? - been trying to get some values out of the presure sensor but without success and this would be great as the relative value is all i really need.

regards,
raune

This code is already

Submitted by fabio on Tue, 2012-03-13 19:44.

This code is already available in the FreeIMU library. Look under the examples. Yes you can use it with FreeIMU v0.3.5_MS

Pressure accuracy

Submitted by freto (not verified) on Sun, 2012-02-26 12:21.

Same as some of the comments above. the absolute pressure value is wrong on the two sensors I bought.
I tried Fabio's library and then my own code (result matching the example on page 7 of the datasheet), but in fact the raw pressure is always around 6400000 instead of around 9000000 like it should be.
My simple test was posted here.

In this document from MEAS the calculation is different and result is closer to reality, but still the pressure is too low.

Problem solved

Submitted by freto (not verified) on Mon, 2012-02-27 13:29.

I found out with a microscope that the sensors I bought from drotek.fr are in fact MS5607 with 20cm accuracy sold under MS5611 names. Problem is solved using the equations in the proper datasheet.
Waist of time and money on this one!

same thing here from this vendor

Submitted by lucky13 (not verified) on Fri, 2012-11-02 23:15.

strugling for 2 days to make the supposed ms5611 to work and i found that mine was also the ms5607.. im getting correct temperature but the altitute is tottaly off.
I changed the code to this
int64_t off = (((int64_t)_C[1]) << 17) + ((_C[3] * dT) >> 6);
int64_t sens = (((int64_t)_C[0]) << 16) + ((_C[2] * dT) >> 7);
but still im not getting the correct altitude, im getting a pressure of 1361.70,
do i have to do any other change in order to work?
thanx

Hehe, same supplier, same

Submitted by NelsonB (not verified) on Mon, 2012-02-27 14:11.

Hehe, same supplier, same mistake :)

I got the supplier this morning, he 'll send me the good reference once I send him back the bad ones.

Regards,
Nelson.

Absolute Pressure

Submitted by NelsonB (not verified) on Tue, 2012-02-21 11:39.

Hi!
Very nice work.
I recently moved from BMP085 to MS5611 in a personnal project.
I read absolute pressure not in line with the local meteo pressure.
Pressure variation seems good when I move the captor up and down, but I am not able to interpret the absolute value I compute from the sensor.

Did you find something on that point?

Best regards,

Nelson.

Yeah, there may be some bug

Submitted by fabio on Tue, 2012-02-21 11:45.

Yeah, there may be some bug in the library.. probably in the shifting part.. they also told me that the old version of the library for Arduino 022 worked just fine. Are you able to find the bug? I'm quite busy right now and can't work on it.

The old code is available from http://www.varesano.net/files/Arduino%200.22%20MS561101BA.zip

Well, 022 version doesn't

Submitted by NelsonB (not verified) on Tue, 2012-02-21 15:09.

Well, 022 version doesn't work better.
I have corrected a bug in your temperature computation, I now have a correct temperature measurement:
_TEMP = (int32_t) REF_TEMP_DEG + (((int64_t)_dT*_c6)>> 23);
I cast in 64bits the dt*c6 computation.

But it doesn't interfere in the absolute pressure computation. I have values in the range of 50000 for à current weather pressure of 1030 mBar.

If you have some infos on this subject, I can spend some time on it.

Best regards,

Nelson.

Got the 5607 instead of 5611

Submitted by NelsonB (not verified) on Mon, 2012-02-27 11:37.

My supplier made a mistake. I was using the 5607 with the datasheet of the 5611...
I should have the true 5611 by the end of the week.
Best regards,
Nelson.

I 'll check the 022 version,

Submitted by NelsonB (not verified) on Tue, 2012-02-21 14:49.

I 'll check the 022 version, thanks.

Library not usefull

Submitted by Jürgen (not verified) on Thu, 2011-08-04 09:52.

I use your library, but the pressure and temperature readings are not correct.

Example: Temp: 24.00 Pressure: 956.0 mbar!
BMP085 reads 972 mbar!

If i touch the sensor, the temp increase, then suddenly it jumps 2 decC
down, the baro-readings jumps too.

Did you see this too?

Not really.. it's working

Submitted by fabio on Thu, 2011-08-04 10:01.

Not really.. it's working pretty good here.

But there may be bugs of course.. if you are able to send improved code that would be great!

MS5611

Submitted by Ethan (not verified) on Sun, 2011-07-10 20:06.

Could someone please tell me where i can buy these sensors in small quantities (less than 5)? Major distributors such as digikey, mouser and farnell don't seem to carry these.

Same question, where can we

Submitted by Anonymous (not verified) on Sat, 2011-07-23 00:25.

Same question, where can we buy these MS5611 sensors !

According to Rob in one

Submitted by fabio on Sat, 2011-07-23 11:41.

According to Rob in one comment on another blog post:
1) USA: www.servoflo.com contact David Ezekiel david [at] servoflo [dot] com
2) EU: www.amsys.de contact Norbert Rauch vertrieb [at] amsys [dot] de
3) APAC: www.everestpacific.com contact Kenny Yip kenny [at] everestpacific [dot] com

Note that these are raw sensors distributors, so you won't get a handy breakout board but only the sensor which you'll have to solder by yourself. There are some sellers of MS5611 breakout boards, just google for that.

Post new comment

The content of this field is kept private and will not be shown publicly.
If you have a personal or company website insert its address in the form http://www.example.com/ .
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <small> <del> <img> <h2> <h3> <h4> <b> <video> <sub> <sup>
  • Lines and paragraphs break automatically.
  • Images can be added to this post.
  • You may use [inline:xx] tags to display uploaded files or images inline.
  • You may insert videos with [video:URL]
  • Each email address will be obfuscated in a human readable fashion or (if JavaScript is enabled) replaced with a spamproof clickable link.

More information about formatting options