Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino UNO with Adafruit BME680 Sensor Data Logger

Image of Arduino UNO with Adafruit BME680 Sensor Data Logger

Circuit Documentation

Summary of the Circuit

This circuit integrates an Adafruit BME680 environmental sensor with an Arduino UNO microcontroller. The BME680 sensor is capable of measuring temperature, pressure, humidity, and gas resistance, which can be used to calculate the approximate altitude. The Arduino UNO is programmed to collect these measurements and output the data to the serial console. The sensor communicates with the Arduino UNO via the I2C protocol, using the SCL and SDA lines.

Component List

Adafruit BME680

  • Description: Environmental sensor capable of measuring temperature, pressure, humidity, and gas resistance.
  • Pins: VCC, 3.3V, GND, SCK/SCL, SDO/ADR, SDI/SDA, CS

Arduino UNO

  • Description: Microcontroller board based on the ATmega328P, with digital and analog I/O pins.
  • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13

Wiring Details

Adafruit BME680

  • VCC: Connected to the 5V output on the Arduino UNO.
  • GND: Connected to a GND pin on the Arduino UNO.
  • SCK/SCL: Connected to the A5 pin on the Arduino UNO (I2C clock).
  • SDI/SDA: Connected to the A4 pin on the Arduino UNO (I2C data).

Arduino UNO

  • 5V: Provides power to the Adafruit BME680 VCC pin.
  • GND: Common ground with the Adafruit BME680.
  • A5: Serves as the SCL (I2C clock) line for the Adafruit BME680.
  • A4: Serves as the SDA (I2C data) line for the Adafruit BME680.

Documented Code

sketch.ino

/**
 * This example demonstrates how to collect basic measurements from the Adafruit BME680
 * board, including temperature, pressure, humidity, gas resistance, and altitude.
 * In this example, sensor measurements are printed out to the Arduino serial console,
 * which can be accessed within the Arduino IDE via (Tools -> Serial Monitor).
 * 
 * - If you are using the Arduino IDE to compile this code, make sure to first install the
 * Adafruit BME680 Library through the Arduino library manager.
 * - When you open the serial monitor to view measurements from the BME680 board, make sure
 * that you select 9600 baud so that the serial monitor can receive data from the Arduino.
 *
 * Originally written by Limor Fried & Kevin Townsend from Adafruit Industries.
 */

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BME680.h"

#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME680 bme; // I2C
//Adafruit_BME680 bme(BME_CS); // hardware SPI
//Adafruit_BME680 bme(BME_CS, BME_MOSI, BME_MISO,  BME_SCK);

void setup() {
  Serial.begin(9600);
  while (!Serial);
  Serial.println(F("BME680 test"));

  if (!bme.begin()) {
    Serial.println("Could not find a valid BME680 sensor, check wiring!");
    while (1);
  }

  // Set up oversampling and filter initialization
  bme.setTemperatureOversampling(BME680_OS_8X);
  bme.setHumidityOversampling(BME680_OS_2X);
  bme.setPressureOversampling(BME680_OS_4X);
  bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
  bme.setGasHeater(320, 150); // 320*C for 150 ms
}

void loop() {
  if (! bme.performReading()) {
    Serial.println("Failed to perform reading :(");
    return;
  }
  Serial.print("Temperature = ");
  Serial.print(bme.temperature);
  Serial.println(" *C");

  Serial.print("Pressure = ");
  Serial.print(bme.pressure / 100.0);
  Serial.println(" hPa");

  Serial.print("Humidity = ");
  Serial.print(bme.humidity);
  Serial.println(" %");

  Serial.print("Gas = ");
  Serial.print(bme.gas_resistance / 1000.0);
  Serial.println(" KOhms");

  Serial.print("Approx. Altitude = ");
  Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
  Serial.println(" m");

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

documentation.txt

This file is empty and does not contain any additional documentation.