3
Pressure Sensor
GY-BMP280
Pressure Sensor (GY-BMP280)
No. 3 • I2C

Pressure Sensor (GY-BMP280)

อ่านค่าความดันอากาศและอุณหภูมิผ่าน I2C

Component NamePressure Sensor
Part No. / ModelGY-BMP280
Interface TypeI2C
PinsVCC, GND, SCL, SDA

Note: ใช้ไฟ 3.3V เป็นหลัก และต้องติดตั้ง Adafruit BMP280 Library

Wiring Example

ตัวอย่างการต่อวงจรกับ Arduino UNO

Circuit diagram
Sensor PinArduino Pin
VCC3.3V
GNDGND
SCLA5
SDAA4

Arduino IDE Code

Download .ino file

gy-bmp280-pressure.ino
// Pressure Sensor (GY-BMP280)
// Board: Arduino UNO
// Library required: Adafruit BMP280 Library
// Wiring for Arduino UNO: SDA=A4, SCL=A5, VCC=3.3V, GND=GND

#include <Wire.h>
#include <Adafruit_BMP280.h>

Adafruit_BMP280 bmp;

void setup() {
  Serial.begin(9600);
  if (!bmp.begin(0x76)) {
    Serial.println("Could not find BMP280 sensor. Try address 0x77.");
    while (1);
  }
}

void loop() {
  Serial.print("Temperature: ");
  Serial.print(bmp.readTemperature());
  Serial.println(" °C");

  Serial.print("Pressure: ");
  Serial.print(bmp.readPressure() / 100.0F);
  Serial.println(" hPa");

  delay(1000);
}