Ordinato entro le 14:00 nei giorni lavorativi = spedito in giornata 30 giorni per il recesso Garanzia di 1 anno
← Torna alla panoramica

Schema di collegamento ed esempio di codice

Ecco come collegare il Sensore 3-in-1 Temperatura Umidità e Pressione Atmosferica | 5V | I2C | Bosch BME280 a un Arduino UNO o ESP32, con uno sketch di esempio che puoi caricare subito.

Sensore BME280 di temperatura, umidità e pressione

Questo progetto legge la temperatura, l'umidità relativa e la pressione barometrica utilizzando il sensore BME280 tramite I2C. Le letture ambientali vengono mostrate nel Serial Monitor ogni due secondi. Basta collegare il sensore direttamente ai pin 5V, GND e I2C dell'Arduino Uno.

Schema di collegamento: Sensore 3-in-1 Temperatura Umidità e Pressione Atmosferica | 5V | I2C | Bosch BME280 su un Arduino UNO
Schema di collegamento · Clicca per ingrandire
Tabella di collegamento: Sensore 3-in-1 Temperatura Umidità e Pressione Atmosferica | 5V | I2C | Bosch BME280 su un Arduino UNO
Tabella di collegamento · Clicca per ingrandire
BME280_Temperature_Humidity_Pressure_Sen.ino · compilato e testato
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : BME280 Temperature, Humidity & Pressure Sensor
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : Bosch BME280 5V 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("--- BME280 Sensor Test ---"));

  // Try I2C address 0x76 first, fallback to 0x77 if needed
  if (!bme.begin(0x76) && !bme.begin(0x77)) {
    Serial.println(F("Could not find a valid BME280 sensor! Check wiring."));
    while (1) {
      delay(100);
    }
  }

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

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, 2);
  Serial.println(F(" °C"));

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

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

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

Librerie necessarie: 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

BME280 Weather Sensor on ESP32

Reads ambient temperature, relative humidity, and barometric pressure from the Bosch BME280 sensor via I2C. The readings are output to the Serial Monitor every two seconds. Powered directly from the ESP32 3.3V pin to ensure safe I2C voltage levels.

Schema di collegamento: Sensore 3-in-1 Temperatura Umidità e Pressione Atmosferica | 5V | I2C | Bosch BME280 su un ESP32 DevKit V1
Schema di collegamento · Clicca per ingrandire
Tabella di collegamento: Sensore 3-in-1 Temperatura Umidità e Pressione Atmosferica | 5V | I2C | Bosch BME280 su un ESP32 DevKit V1
Tabella di collegamento · Clicca per ingrandire
BME280_Weather_Sensor_on_ESP32.ino · compilato e testato
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : BME280 Weather Sensor on ESP32
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : Bosch BME280 5V 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("BME280 Sensor Test");

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

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

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

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

  delay(2000);
}

Librerie necessarie: 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

Visti di recente

Breakout board per ESP32-S3 N16R8 44-Pin 23mm e 25.5mm boards

Breakout board per ESP32-S3 N16R8 44-Pin 23mm e 25.5mm boards

€ 6,99
Relè regolabile STC-3028 12V per temperatura e umidità

Relè regolabile STC-3028 12V per temperatura e umidità

€ 17,90
Custodia in acrilico trasparente per generatore di segnale XR2206

Custodia in acrilico trasparente per generatore di segnale XR2206

€ 2,35
Mini sensore di movimento infrarosso PIR piroelettrico

Mini sensore di movimento infrarosso PIR piroelettrico

€ 2,20