MS554 MS5540-CM

Hi,

I am trying making the MS554 MS5540-CM work: https://www.banggood.com/MS554-MS5540-CM-10-1100mbar-Digital-Pressure-Sensor-Module-16bit-DC-2_2V-3_6V-100-Meters-Waterproof-p-1082310.html?rmmds=buy

I followed this code: http://www.fut-electronics.com/wp-content/uploads/2015/10/water_depth_sensor_MS5540C_Arduino_tutorial.pdf

However, I get these results (attached).

Is there a problem with the sensor itself or did I do something wrong?

Thank you for the help.

1 Like

No screencaps please, just copy/paste the output and post it between code [/] tags.

My crystal ball tells me you most likely did something wrong in your code or in your wiring but unfortunately it doesn’t manage to see the actual code you use. It did suggest to show me a Fritzing of your wiring but as we all know how worthless those images are that also doesn’t help.

So, long story short: code (remember the code tags!) and circuit diagrams are needed here!

1 Like

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png

OP's device

Thanks.. Tom.. :slight_smile:

That tutorial does the bit shifting backwards (for some reason) for the c1-c6 values. Reverse the bit shifting operators in the lines where the variables c1-c6 are set. You can look at the datasheet for the pressure sensor and it shows where in word1-word4 the c1-c6 values are obtained. If you know about bit shifting, you can see that the code provided in the tutorial has the bit shift operators for that particular part of the code backwards.
Here is what the tutorial code provides for values c1-c6.
long c1 = word1 << 1;
long c2 = ((word3 & 0x3F) >> 6) | ((word4 & 0x3F));
long c3 = (word4 << 6) ;
long c4 = (word3 << 6);
long c5 = (word2 << 6) | ((word1 & 0x1) >> 10);
long c6 = word2 & 0x3F;

Here is the corrected code
long c1 = word1 >> 1;
long c2 = ((word3 & 0x3F) << 6) | ((word4 & 0x3F));
long c3 = (word4 >> 6) ;
long c4 = (word3 >> 6);
long c5 = (word2 >> 6) | ((word1 & 0x1) << 10);
long c6 = word2 & 0x3F;