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?
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:
This declares and initializes a sensor object for the "high" address
0x76 and makes it available via a variable named
Then you can operate the sensor like
So all you'd have to do is to set up another sensor object like
and use it like
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.