### begin() Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Initializes the I2C connection to the sensor, verifies chip identity, and loads calibration data. Must be called before any measurement functions. Returns true on success and false otherwise. ```APIDOC ## begin() ### Description Initializes the I2C connection to the sensor at address `0x77`, verifies chip identity, and reads all 11 factory calibration coefficients from the sensor's EEPROM. Must be called before any measurement functions. Returns `true` on success and `false` if the sensor is not found or the chip ID does not match. ### Method `bool begin()` ### Parameters None ### Request Example ```cpp #include Adafruit_BMP085 bmp; void setup() { Serial.begin(9600); // Default: BMP085_ULTRAHIGHRES mode, uses Wire (I2C0) if (!bmp.begin()) { Serial.println("ERROR: BMP085/BMP180 not found. Check wiring!"); // SDA -> A4, SCL -> A5 on Uno; 3.3V power only! while (1); } // Optional: specify oversampling mode // Modes: BMP085_ULTRALOWPOWER (0), BMP085_STANDARD (1), // BMP085_HIGHRES (2), BMP085_ULTRAHIGHRES (3) // if (!bmp.begin(BMP085_STANDARD)) { ... } // Optional: specify alternate I2C bus (e.g., Wire1) // if (!bmp.begin(BMP085_ULTRAHIGHRES, &Wire1)) { ... } Serial.println("BMP085 sensor initialized successfully."); } ``` ### Response #### Success Response (true) Returns `true` if the sensor is successfully initialized. #### Failure Response (false) Returns `false` if the sensor is not found or the chip ID does not match. ``` -------------------------------- ### Complete Sketch - Adafruit BMP085 Library Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt A complete Arduino sketch demonstrating how to initialize and use the Adafruit BMP085 sensor to read temperature, pressure, and altitude in a polling loop. Ensure correct wiring and include the Adafruit BMP085 library. ```cpp #include // Wiring (Arduino Uno): // BMP085 VCC -> 3.3V (NOT 5V!) // BMP085 GND -> GND // BMP085 SCL -> A5 // BMP085 SDA -> A4 Adafruit_BMP085 bmp; void setup() { Serial.begin(9600); if (!bmp.begin(BMP085_STANDARD)) { Serial.println("Could not find a valid BMP085 sensor, check wiring!"); while (1) {} } Serial.println("BMP085 ready."); } void loop() { float tempC = bmp.readTemperature(); // °C int32_t pressure = bmp.readPressure(); // Pa float altitude = bmp.readAltitude(); // m (std atm) float altitudePrecise = bmp.readAltitude(101500); // m (local QNH) int32_t seaLevel = bmp.readSealevelPressure(150.0); // Pa, 150 m site Serial.print("Temp: "); Serial.print(tempC); Serial.println(" *C"); Serial.print("Pressure: "); Serial.print(pressure); Serial.println(" Pa"); Serial.print("Altitude: "); Serial.print(altitude); Serial.println(" m"); Serial.print("Alt(QNH): "); Serial.print(altitudePrecise);Serial.println(" m"); Serial.print("QNH(calc): "); Serial.print(seaLevel); Serial.println(" Pa"); Serial.println("---"); // Expected serial output (values vary with environment): // Temp: 24.3 *C // Pressure: 100832 Pa // Altitude: 148.7 m // Alt(QNH): 131.2 m // QNH(calc): 102601 Pa // --- delay(500); } ``` -------------------------------- ### readPressure() Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Triggers temperature and pressure measurements, applies compensation, and returns the absolute pressure in Pascals. ```APIDOC ## readPressure() ### Description Triggers both a temperature and a pressure measurement (temperature is needed for pressure compensation), applies the full BMP085 compensation sequence, and returns the true barometric pressure as an `int32_t` in Pascals. The oversampling mode set in `begin()` affects conversion time (5–26 ms) and noise. ### Method `int32_t readPressure()` ### Parameters None ### Request Example ```cpp int32_t pressure = bmp.readPressure(); Serial.print("Pressure = "); Serial.print(pressure); // e.g., 100832 Serial.println(" Pa"); // 101325 Pa = standard sea-level atmosphere // Expected output: "Pressure = 100832 Pa" ``` ### Response #### Success Response - **pressure** (int32_t) - Compensated absolute pressure in Pascals. ``` -------------------------------- ### Initialize BMP085 Sensor Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Initializes the I2C connection, verifies the sensor, and loads calibration data. Must be called before any measurement functions. Returns true on success, false otherwise. Supports optional oversampling modes and alternate I2C buses. ```cpp #include Adafruit_BMP085 bmp; void setup() { Serial.begin(9600); // Default: BMP085_ULTRAHIGHRES mode, uses Wire (I2C0) if (!bmp.begin()) { Serial.println("ERROR: BMP085/BMP180 not found. Check wiring!"); // SDA -> A4, SCL -> A5 on Uno; 3.3V power only! while (1); } // Optional: specify oversampling mode // Modes: BMP085_ULTRALOWPOWER (0), BMP085_STANDARD (1), // BMP085_HIGHRES (2), BMP085_ULTRAHIGHRES (3) // if (!bmp.begin(BMP085_STANDARD)) { ... } // Optional: specify alternate I2C bus (e.g., Wire1) // if (!bmp.begin(BMP085_ULTRAHIGHRES, &Wire1)) { ... } Serial.println("BMP085 sensor initialized successfully."); } ``` -------------------------------- ### readTemperature() Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Triggers a temperature measurement, applies compensation, and returns the result in degrees Celsius. ```APIDOC ## readTemperature() ### Description Triggers a temperature measurement over I2C, applies the datasheet two-step compensation algorithm using the stored calibration coefficients, and returns the result as a `float` in degrees Celsius. Resolution is approximately 0.1°C. ### Method `float readTemperature()` ### Parameters None ### Request Example ```cpp float temp = bmp.readTemperature(); Serial.print("Temperature = "); Serial.print(temp); // e.g., 24.3 Serial.println(" *C"); // Expected output: "Temperature = 24.3 *C" ``` ### Response #### Success Response - **temp** (float) - Compensated temperature in degrees Celsius. ``` -------------------------------- ### readTemperature() Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Reads the compensated temperature in Celsius from the BMP085 sensor. ```APIDOC ## `readTemperature()` — Read temperature Returns the compensated temperature in degrees Celsius (°C). ### Method ```cpp float tempC = bmp.readTemperature(); ``` ### Example Usage ```cpp Serial.print("Temp: "); Serial.print(tempC); Serial.println(" *C"); ``` ``` -------------------------------- ### Read Temperature Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Triggers a temperature measurement, applies compensation, and returns the result in degrees Celsius. Resolution is approximately 0.1°C. ```cpp float temp = bmp.readTemperature(); Serial.print("Temperature = "); Serial.print(temp); // e.g., 24.3 Serial.println(" *C"); // Expected output: "Temperature = 24.3 *C" ``` -------------------------------- ### readPressure() Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Reads the compensated pressure in Pascals from the BMP085 sensor. ```APIDOC ## `readPressure()` — Read pressure Returns the compensated pressure in Pascals (Pa). ### Method ```cpp int32_t pressure = bmp.readPressure(); ``` ### Example Usage ```cpp Serial.print("Pressure: "); Serial.print(pressure); Serial.println(" Pa"); ``` ``` -------------------------------- ### readSealevelPressure(altitude) Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Calculates the sea-level pressure in Pascals given the current altitude. ```APIDOC ## `readSealevelPressure(altitude)` — Calculate sea-level pressure Calculates and returns the sea-level pressure in Pascals (Pa) based on the current sensor readings and a given altitude. ### Parameters #### Path Parameters - **altitude** (float) - Required - The current altitude in meters (m). ### Method ```cpp int32_t seaLevel = bmp.readSealevelPressure(150.0); // Example with 150 m altitude ``` ### Example Usage ```cpp Serial.print("QNH(calc): "); Serial.print(seaLevel); Serial.println(" Pa"); ``` ``` -------------------------------- ### Read Raw Temperature - Adafruit BMP085 Library Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Reads the uncompensated temperature register. Useful for debugging calibration issues or implementing custom compensation routines. Requires the BMP085 library. ```cpp uint16_t rawTemp = bmp.readRawTemperature(); Serial.print("Raw temperature ADC = "); Serial.println(rawTemp); // e.g., 27898 (datasheet example value) ``` -------------------------------- ### Read Pressure Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Triggers temperature and pressure measurements, applies compensation, and returns the absolute pressure in Pascals. The oversampling mode affects conversion time and noise. ```cpp int32_t pressure = bmp.readPressure(); Serial.print("Pressure = "); Serial.print(pressure); // e.g., 100832 Serial.println(" Pa"); // 101325 Pa = standard sea-level atmosphere // Expected output: "Pressure = 100832 Pa" ``` -------------------------------- ### readAltitude() Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Calculates altitude in meters from the current pressure reading, optionally using a reference sea-level pressure. ```APIDOC ## readAltitude() ### Description Computes the current altitude in meters using the hypsometric formula, derived from the live pressure reading and a reference sea-level pressure. Defaults to the ISA standard atmosphere (101325 Pa). For greater accuracy, supply the current actual sea-level pressure from a weather service. ### Method `float readAltitude()` `float readAltitude(int32_t sealevelPressure)` ### Parameters #### Path Parameters - **sealevelPressure** (int32_t) - Optional - The reference sea-level pressure in Pascals. Defaults to 101325 Pa if not provided. ### Request Example ```cpp // Using standard atmosphere default (101325 Pa) float altitude = bmp.readAltitude(); Serial.print("Altitude = "); Serial.print(altitude); // e.g., 148.7 Serial.println(" meters"); // Using precise local sea-level pressure (e.g., 1015 hPa = 101500 Pa) float preciseAltitude = bmp.readAltitude(101500); Serial.print("Precise altitude = "); Serial.print(preciseAltitude); // e.g., 131.2 Serial.println(" meters"); // Expected output: "Altitude = 148.7 meters" // "Precise altitude = 131.2 meters" ``` ### Response #### Success Response - **altitude** (float) - Calculated altitude in meters. ``` -------------------------------- ### Read Raw Pressure - Adafruit BMP085 Library Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Reads the uncompensated pressure register. Useful for custom pressure compensation or diagnostics. The actual value depends on the oversampling mode set in begin(). Requires the BMP085 library. ```cpp uint32_t rawPressure = bmp.readRawPressure(); Serial.print("Raw pressure ADC = "); Serial.println(rawPressure); // e.g., 23843 (datasheet example value) // Actual value depends on oversampling mode set in begin() ``` -------------------------------- ### readSealevelPressure() Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Calculates pressure normalized to sea level using the current absolute pressure and a known altitude. ```APIDOC ## readSealevelPressure() ### Description Takes the current absolute pressure reading and adjusts it to equivalent sea-level pressure using the barometric formula, given the sensor's known altitude above sea level. Useful for weather-station applications where QNH (sea-level pressure) is needed. Returns `int32_t` in Pascals. ### Method `int32_t readSealevelPressure(float altitude)` ### Parameters #### Path Parameters - **altitude** (float) - Required - The known altitude of the sensor above sea level in meters. ### Request Example ```cpp // Device is installed 150 meters above sea level float myAltitude = 150.0; // meters int32_t seaLevelPressure = bmp.readSealevelPressure(myAltitude); Serial.print("Sea-level pressure = "); Serial.print(seaLevelPressure); // e.g., 102601 Serial.println(" Pa"); // Expected output: "Sea-level pressure = 102601 Pa" ``` ### Response #### Success Response - **seaLevelPressure** (int32_t) - Calculated pressure normalized to sea level in Pascals. ``` -------------------------------- ### readAltitude() Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Reads the compensated altitude in meters from the BMP085 sensor. ```APIDOC ## `readAltitude()` — Read altitude Returns the compensated altitude in meters (m) based on standard atmospheric pressure. ### Method ```cpp float altitude = bmp.readAltitude(); ``` ### Example Usage ```cpp Serial.print("Altitude: "); Serial.print(altitude); Serial.println(" m"); ``` ``` -------------------------------- ### Calculate Sea-Level Pressure Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Calculates pressure normalized to sea level using the current absolute pressure and the sensor's altitude. Useful for weather stations. Returns Pascals. ```cpp // Device is installed 150 meters above sea level float myAltitude = 150.0; // meters int32_t seaLevelPressure = bmp.readSealevelPressure(myAltitude); Serial.print("Sea-level pressure = "); Serial.print(seaLevelPressure); // e.g., 102601 Serial.println(" Pa"); // Expected output: "Sea-level pressure = 102601 Pa" ``` -------------------------------- ### readAltitude(sealevelPressure) Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Reads the compensated altitude in meters using a specified sea-level pressure value. ```APIDOC ## `readAltitude(sealevelPressure)` — Read altitude with local QNH Returns the compensated altitude in meters (m) using a provided local sea-level pressure (QNH). ### Parameters #### Path Parameters - **sealevelPressure** (int32_t) - Required - The local sea-level pressure in Pascals (Pa). ### Method ```cpp float altitudePrecise = bmp.readAltitude(101500); // Example with 101500 Pa ``` ### Example Usage ```cpp Serial.print("Alt(QNH): "); Serial.print(altitudePrecise); Serial.println(" m"); ``` ``` -------------------------------- ### Calculate Altitude Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Computes altitude in meters using the current pressure reading and a reference sea-level pressure. Defaults to the standard atmosphere (101325 Pa) or can use a precise local sea-level pressure. ```cpp // Using standard atmosphere default (101325 Pa) float altitude = bmp.readAltitude(); Serial.print("Altitude = "); Serial.print(altitude); // e.g., 148.7 Serial.println(" meters"); // Using precise local sea-level pressure (e.g., 1015 hPa = 101500 Pa) float preciseAltitude = bmp.readAltitude(101500); Serial.print("Precise altitude = "); Serial.print(preciseAltitude); // e.g., 131.2 Serial.println(" meters"); // Expected output: "Altitude = 148.7 meters" // "Precise altitude = 131.2 meters" ``` -------------------------------- ### readRawPressure() Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Reads the uncompensated pressure register from the BMP085 sensor. This function is useful for custom pressure compensation or diagnostics. ```APIDOC ## `readRawPressure()` — Read uncompensated pressure register Writes the pressure measurement command (with oversampling bits) to the control register, waits for the mode-dependent conversion time, and returns the raw 19-bit-or-less pressure ADC value as a `uint32_t`. Useful for custom pressure compensation or diagnostics. ### Method ```cpp uint32_t rawPressure = bmp.readRawPressure(); ``` ### Example Usage ```cpp Serial.print("Raw pressure ADC = "); Serial.println(rawPressure); // e.g., 23843 (datasheet example value) // Actual value depends on oversampling mode set in begin() ``` ``` -------------------------------- ### readRawTemperature() Source: https://context7.com/adafruit/adafruit-bmp085-library/llms.txt Reads the uncompensated temperature register from the BMP085 sensor. This function is useful for debugging calibration issues or implementing custom compensation routines. ```APIDOC ## `readRawTemperature()` — Read uncompensated temperature register Writes the temperature measurement command to the control register, waits 5 ms for conversion, and returns the raw 16-bit ADC value from the sensor. Useful for debugging calibration issues or implementing custom compensation routines. ### Method ```cpp uint16_t rawTemp = bmp.readRawTemperature(); ``` ### Example Usage ```cpp Serial.print("Raw temperature ADC = "); Serial.println(rawTemp); // e.g., 27898 (datasheet example value) ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.