DPS310 barometric pressure sensor
The Infineon DPS310 reads air pressure to a fraction of a pascal, and temperature, over I2C at 0x77 or 0x76.
Aliases: Adafruit DPS310, Grove DPS310, barometer, altimeter. Precise enough to tell a table from the floor by altitude, it is the pressure sensor of drones and step counters.
Pins
| Pin | What it does |
|---|---|
VIN |
Supply, 3 to 5 V on the board. |
GND |
Ground. |
SCL, SDA |
I2C. The board carries the pull-ups. |
Properties
address is 0x77 or 0x76. pressure (hPa, 300 to 1200) and temperature are the
weather; the two sliders change them while the circuit runs.
Reading it on an Arduino
With Adafruit's library, which Mokxi ships as Adafruit_DPS310.h:
#include <Adafruit_DPS310.h>
Adafruit_DPS310 dps;
void setup() {
Serial.begin(9600);
if (!dps.begin_I2C()) Serial.println("No DPS310");
dps.configurePressure(DPS310_64HZ, DPS310_64SAMPLES);
dps.configureTemperature(DPS310_64HZ, DPS310_64SAMPLES);
}
void loop() {
sensors_event_t temp, pressure;
if (dps.temperatureAvailable() && dps.pressureAvailable()) {
dps.getEvents(&temp, &pressure);
Serial.println(pressure.pressure);
}
}
How it talks
- The product ID at
0x0Dreads0x10. After power on and a soft reset (0x09to0x0C)SENSOR_RDYcomes up in 12 ms andCOEF_RDYin 40 ms. MEAS_CFG(0x08) runs one pressure or temperature reading, or both continuously at the rates inPRS_CFGandTMP_CFG. A reading takes 3.6 ms at once up to 206.8 ms at 128 times oversampling; thenPRS_RDYorTMP_RDYis set, and reading the result clears it.- The results are raw 24-bit counts. The library turns them into pascals and degrees
with the coefficients at
0x10to0x21and the oversampling's scale factor.
What it does not model
The FIFO and the interrupt pin, and the noise oversampling removes.
Common mistakes
Reading before COEF_RDY: the coefficients are not loaded for the first 40 ms.
Expecting a new reading every loop: at 64 times oversampling each one takes 104 ms.