Electrical – Using two pressure sensors with same address over I2C

arduinobusi2cpressuresensor

I'm a novice programmer and I have recently purchased the SparkFun Pressure Sensor Breakout – MS5803-14BA and used it to take pressure readings quiet easily with the sample code provided and an arduino uno. However, I actually need to hook up two pressure sensors to the arduino and get two pressure readings for measuring the pressures inside a pressurised vessel. Does anybody know how I could extend the current example code provided to give two pressure readings?

Best Answer

For the hardware part, look at page 6 of the datasheet and move the resistor at the 0x76 label to the 0x77 position on one of the sensors.

Does anybody know how I could extend the current example code provided to give two pressure readings?

If you're using the library linked to from SparkFun, have a look at line #39 of the code:

MS5803 sensor(ADDRESS_HIGH);

This declares and initializes a sensor object for the "high" address 0x76 and makes it available via a variable named sensor.

Then you can operate the sensor like

sensor.getPressure(ADC_4096);

So all you'd have to do is to set up another sensor object like

MS5803 myOtherSensor(ADDRESS_LOW);

and use it like

myOtherSensor.getPressure(ADC_4096);

to query data from the other sensor (the one with 0x77 ("low" address)).