Op werkdagen vóór 14:00 uur besteld = dezelfde dag verzonden en in 98% van de gevallen de volgende dag in huis. Gratis retourneren 30 dagen bedenktijd 1 jaar garantie
← Tillbaka till översikten

Kopplingsschema och kodexempel

Så här kopplar du 3-i-1 sensor Temperatur Luftfuktighet och Lufttryck | 3.3V | I2C och SPI | Bosch BME280 till en Arduino UNO eller ESP32, med ett exempel­sketch som du kan ladda upp direkt.

BME280 Temperature, Humidity & Pressure Sensor Demo

This project reads ambient temperature, relative humidity, and atmospheric pressure using a 3.3V BME280 sensor connected to an Arduino Uno. A 4-channel bidirectional logic level shifter safely translates the 5V I2C signals down to 3.3V. Sensor readings are output to the Serial Monitor every two seconds.

Kopplingsschema: 3-i-1 sensor Temperatur Luftfuktighet och Lufttryck | 3.3V | I2C och SPI | Bosch BME280 på en Arduino UNO
Kopplingsschema · Klicka för att förstora
Kopplingstabell: 3-i-1 sensor Temperatur Luftfuktighet och Lufttryck | 3.3V | I2C och SPI | Bosch BME280 på en Arduino UNO
Kopplingstabell · Klicka för att förstora
BME280_Temperature_Humidity_Pressure_Sen.ino · kompilerad och testad
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : BME280 Temperature, Humidity & Pressure Sensor Demo
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : Bosch BME280 3.3v 3-in-1 sensor Temperature Humidity and Air Pressure
 *  Libraries : Adafruit BME280 Library 2.3.0, Adafruit Unified Sensor 1.1.15
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

Adafruit_BME280 bme;

void setup() {
  Serial.begin(115200);
  while (!Serial) delay(10);

  Serial.println(F("Initializing BME280 sensor..."));

  // SDO tied to GND sets address to 0x76
  if (!bme.begin(0x76, &Wire)) {
    Serial.println(F("Could not find BME280 sensor. Check wiring!"));
    while (1) delay(100);
  }

  Serial.println(F("BME280 sensor ready!"));
}

void loop() {
  float temperature = bme.readTemperature();
  float humidity = bme.readHumidity();
  float pressure = bme.readPressure() / 100.0F; // Convert Pa to hPa

  Serial.print(F("Temperature: "));
  Serial.print(temperature, 1);
  Serial.print(F(" °C | Humidity: "));
  Serial.print(humidity, 1);
  Serial.print(F(" % | Pressure: "));
  Serial.print(pressure, 1);
  Serial.println(F(" hPa"));

  delay(2000);
}

Nödvändiga bibliotek: Adafruit BME280 Library 2.3.0, Adafruit Unified Sensor 1.1.15

Wiring diagram and example code generated by Codey.online — https://www.codey.online

ESP32 BME280 Weather Sensor Monitor

This project reads ambient temperature, relative humidity, and barometric pressure from the Bosch BME280 sensor using the I2C interface. Connect the 3.3V sensor directly to the ESP32 power and default I2C pins (GPIO 21 and 22). Open the Serial Monitor at 115200 baud to view real-time environmental measurements updated every two seconds.

Kopplingsschema: 3-i-1 sensor Temperatur Luftfuktighet och Lufttryck | 3.3V | I2C och SPI | Bosch BME280 på en ESP32 DevKit V1
Kopplingsschema · Klicka för att förstora
Kopplingstabell: 3-i-1 sensor Temperatur Luftfuktighet och Lufttryck | 3.3V | I2C och SPI | Bosch BME280 på en ESP32 DevKit V1
Kopplingstabell · Klicka för att förstora
ESP32_BME280_Weather_Sensor_Monitor.ino · kompilerad och testad
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : ESP32 BME280 Weather Sensor Monitor
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : Bosch BME280 3.3v 3-in-1 sensor Temperature Humidity and Air Pressure
 *  Libraries : Adafruit BME280 Library 2.3.0, Adafruit Unified Sensor 1.1.15
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

Adafruit_BME280 bme;

void setup() {
  Serial.begin(115200);
  while (!Serial) delay(10);

  Serial.println("Initializing BME280 sensor...");

  // Default I2C address is usually 0x76 or 0x77
  if (!bme.begin(0x76) && !bme.begin(0x77)) {
    Serial.println("Could not find a valid BME280 sensor! Check wiring.");
    while (1) delay(100);
  }

  Serial.println("BME280 initialized successfully.");
}

void loop() {
  float temperature = bme.readTemperature();
  float humidity = bme.readHumidity();
  float pressure = bme.readPressure() / 100.0F; // Convert Pa to hPa

  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" °C");

  Serial.print("Humidity:    ");
  Serial.print(humidity);
  Serial.println(" %");

  Serial.print("Pressure:    ");
  Serial.print(pressure);
  Serial.println(" hPa");

  Serial.println("------------------------");
  delay(2000);
}

Nödvändiga bibliotek: Adafruit BME280 Library 2.3.0, Adafruit Unified Sensor 1.1.15

Wiring diagram and example code generated by Codey.online — https://www.codey.online

Tidigare visade

3296W 20K (W203) Trimpot Trimmer Potentiometer

3296W 20K (W203) Trimpot Trimmer Potentiometer

€ 0,70
Miniatyr träflygplan med solenergi (Pedagogiskt)

Miniatyr träflygplan med solenergi (Pedagogiskt)

€ 22,00
Visa