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?
2 Answers
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)).
As you can see there are two address bits - 0X76 and 0X77.
If you want to read both the sensors just set the address jumper on one sensor. So you will get two different addresses from 2 different sensors.
Then just hook up the sensor and from 2 different sensors you will get different output.
-
\$\begingroup\$ Note that you'll want to bridge only one of the two connections. So on one of the sensors you should remove the resistor ("0x76") and use it to connect the other pads ("0x77"). \$\endgroup\$– JimmyBCommented Apr 6, 2016 at 10:28
-
\$\begingroup\$ @chandan: You need to have your keyboard checked. It randomly capitalizes words and the . key always seems to double up when you press it. \$\endgroup\$– JRECommented Apr 6, 2016 at 10:43