The Adafruit-LPS2X is a versatile breakout board that integrates the LPS2X series of barometric pressure and temperature sensors. These sensors are designed to provide precise measurements of atmospheric pressure and ambient temperature, which are essential parameters in a variety of applications. The Adafruit-LPS2X is commonly used in weather stations for monitoring climatic conditions, in smartphones and GPS devices as an altimeter, and in HVAC systems for environmental control.
Pin Number | Pin Name | Description |
---|---|---|
1 | VDD | Power supply (1.7V to 3.6V) |
2 | GND | Ground |
3 | SDA | I2C Data |
4 | SCL | I2C Clock |
5 | SA0/SDO | I2C Address selection/ SPI Data Output |
6 | CS | SPI Chip Select (active low) |
7 | SDO/SA0 | SPI Data Output / I2C Address selection |
#include <Wire.h>
#include "Adafruit_LPS2X.h"
Adafruit_LPS22 lps; // Create an instance of the LPS22 class
void setup() {
Serial.begin(9600);
Wire.begin(); // Initialize I2C
if (!lps.begin_I2C()) { // Initialize the sensor
Serial.println("Failed to find LPS sensor");
while (1);
}
Serial.println("LPS sensor found!");
}
void loop() {
Serial.print("Pressure: ");
Serial.print(lps.readPressure());
Serial.println(" hPa");
Serial.print("Temperature: ");
Serial.print(lps.readTemperature());
Serial.println(" C");
delay(500); // Wait half a second between readings
}
Q: Can the Adafruit-LPS2X be used with a 5V microcontroller? A: Yes, but a level shifter is recommended for the I2C lines to ensure compatibility with the sensor's voltage levels.
Q: How can I change the I2C address of the sensor? A: The I2C address can be changed by connecting the SA0/SDO pin to either VDD or GND.
Q: Is the Adafruit-LPS2X waterproof? A: No, the sensor is not waterproof and should be protected from moisture and water exposure.
For further assistance, consult the Adafruit-LPS2X datasheet or contact technical support.