The Adafruit BMP390 is a high-precision sensor module designed for measuring barometric pressure and altitude with great accuracy. It is an ideal choice for various applications, including weather stations, indoor navigation, drones, and altitude tracking for outdoor activities. The BMP390 is an upgrade to the earlier BMP280 and BMP388, offering improved accuracy and noise performance.
Pin Number | Pin Name | Description |
---|---|---|
1 | VDD | Power supply (1.65V to 3.6V) |
2 | GND | Ground |
3 | SCL/SCK | I2C Clock / SPI Clock |
4 | SDA/SDI | I2C Data / SPI Data Input |
5 | SD0/SDO | SPI Data Output |
6 | CSB | SPI Chip Select (active low) |
To use the BMP390 in a circuit, connect the VDD pin to a power supply between 1.65V and 3.6V and the GND pin to the ground. For I2C communication, connect the SCL pin to the I2C clock line and the SDA pin to the I2C data line. For SPI communication, connect SCK, SDI, SDO, and CSB to the corresponding SPI lines on your microcontroller.
#include <Wire.h>
#include <Adafruit_BMP3XX.h>
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BMP3XX bmp;
void setup() {
Serial.begin(9600);
if (!bmp.begin()) {
Serial.println("Could not find a valid BMP390 sensor, check wiring!");
while (1);
}
// Set up oversampling and filter initialization
bmp.setTemperatureOversampling(BMP3_OVERSAMPLING_8X);
bmp.setPressureOversampling(BMP3_OVERSAMPLING_4X);
bmp.setIIRFilterCoeff(BMP3_IIR_FILTER_COEFF_3);
}
void loop() {
if (!bmp.performReading()) {
Serial.println("Failed to perform reading :(");
return;
}
Serial.print("Temperature = ");
Serial.print(bmp.temperature);
Serial.println(" *C");
Serial.print("Pressure = ");
Serial.print(bmp.pressure / 100.0);
Serial.println(" hPa");
Serial.print("Approx. Altitude = ");
Serial.print(bmp.readAltitude(SEALEVELPRESSURE_HPA));
Serial.println(" m");
delay(2000);
}
Q: Can the BMP390 be used for both I2C and SPI communication? A: Yes, the BMP390 supports both I2C and SPI communication modes.
Q: What is the purpose of the CSB pin? A: The CSB pin is the chip select for SPI communication. It is active low and is used to initiate communication with the sensor.
Q: How can I improve the accuracy of altitude measurements? A: For best accuracy, calibrate the sensor at a known altitude and pressure, and use the temperature compensation feature.
Q: Is the BMP390 waterproof? A: No, the BMP390 is not waterproof. Protect it from moisture and other environmental conditions that could damage the sensor.
For further assistance, consult the Adafruit BMP390 datasheet and the community forums for additional support and resources.