RaspberryPi-BME280-GUI/docs at main · RaspberryFpc/RaspberryPi-BME280-GUI · GitHub
Skip to content

Latest commit

 

History

History

Folders and files

readme.md


layout: default title: BME280 Free Pascal Driver for Raspberry Pi description: Free Pascal driver for BME280 sensor measuring temperature, humidity, and air pressure. Includes accurate dewpoint calculation.

BME280 Free Pascal Driver for Raspberry Pi

This is a Free Pascal driver for the BME280 sensor that measures temperature, humidity, and air pressure. The driver supports both default and user-configured settings and includes accurate dewpoint calculation.

Screenshot

📄 Introduction

This driver provides functions for interacting with the BME280 sensor via I2C on the Raspberry Pi. It offers two initialization methods: one with default settings and one for user-defined configurations.


🛠️ Features

  • Supports both I2C addresses $76 and $77.
  • Two initialization functions: one with default settings and one for custom configuration.
  • All parameters are defined as constants for ease of use.
  • Simple integration with Raspberry Pi (requires I2C enabled).

🛠️ Funktionen

  • Unterstützt sowohl die I2C-Adressen $76 als auch $77.
  • Zwei Initialisierungsfunktionen: eine mit Standardeinstellungen und eine für benutzerdefinierte Konfiguration.
  • Alle Parameter sind als Konstanten definiert, um die Verwendung zu erleichtern.
  • Einfache Integration mit Raspberry Pi (erfordert aktiviertes I2C).

🧰 Installation

  1. Enable I2C on your Raspberry Pi (run sudo raspi-config, then navigate to Interfacing OptionsI2C and enable it).
  2. Clone this repository:
git clone https://github.com/RaspberryFpc/BME280-FreePascal-Driver.git
  1. Add the bme280.pas file to your project.

📜 Predefined Constants / Vordefinierte Konstanten

1. Mode / Modus

Name Description (EN) Beschreibung (DE) Binary
Sleepmode Sleep mode of the sensor Schlafmodus des Sensors %0
Forcedmode Forced mode (sensor reads once and then returns to sleep mode) Zwangsmodus %1
Normalmode Normal mode, continuous measurements Normalmodus %11

2. Oversampling

Name Description (EN) Beschreibung (DE) Binary
PressureOversampling1 Pressure oversampling (x1) Oversampling für Luftdruck (x1) %00100
PressureOversampling2 Pressure oversampling (x2) Oversampling für Luftdruck (x2) %01000
PressureOversampling4 Pressure oversampling (x4) Oversampling für Luftdruck (x4) %01100
PressureOversampling8 Pressure oversampling (x8) Oversampling für Luftdruck (x8) %10000
PressureOversampling16 Pressure oversampling (x16) Oversampling für Luftdruck (x16) %10100
TemperatureOversampling1 Temperature oversampling (x1) Oversampling für Temperatur (x1) %00100000
TemperatureOversampling2 Temperature oversampling (x2) Oversampling für Temperatur (x2) %01000000
TemperatureOversampling4 Temperature oversampling (x4) Oversampling für Temperatur (x4) %01100000
TemperatureOversampling8 Temperature oversampling (x8) Oversampling für Temperatur (x8) %10000000
TemperatureOversampling16 Temperature oversampling (x16) Oversampling für Temperatur (x16) %10100000
HumidityOversampling1 Humidity oversampling (x1) Oversampling für Luftfeuchtigkeit (x1) 0
HumidityOversampling2 Humidity oversampling (x2) Oversampling für Luftfeuchtigkeit (x2) 1
HumidityOversampling4 Humidity oversampling (x4) Oversampling für Luftfeuchtigkeit (x4) 2
HumidityOversampling8 Humidity oversampling (x8) Oversampling für Luftfeuchtigkeit (x8) 3
HumidityOversampling16 Humidity oversampling (x16) Oversampling für Luftfeuchtigkeit (x16) 4

3. Repeat Time / Wiederholrate

Name Description (EN) Beschreibung (DE) Binary
Repeat0_5ms Repeat time every 0.5ms Wiederholrate alle 0,5ms %00000000
Repeat_62_5ms Repeat time every 62.5ms Wiederholrate alle 62,5ms %00100000
Repeat_125ms Repeat time every 125ms Wiederholrate alle 125ms %01000000
Repeat_250ms Repeat time every 250ms Wiederholrate alle 250ms %01100000
Repeat_500ms Repeat time every 500ms Wiederholrate alle 500ms %10000000
Repeat_1000ms Repeat time every 1000ms Wiederholrate alle 1000ms %10100000
Repeat_10ms Repeat time every 10ms Wiederholrate alle 10ms %11000000
Repeat_20ms Repeat time every 20ms Wiederholrate alle 20ms %11100000

4. Filter

Name Description (EN) Beschreibung (DE) Binary
filterOff No filter Kein Filter %00000000
filter2 Filter level 2 Filterstufe 2 %00000100
filter4 Filter level 4 Filterstufe 4 %00001000
filter8 Filter level 8 Filterstufe 8 %00001100
filter16 Filter level 16 Filterstufe 16 %00010000

5. SPI Enable

Name Description (EN) Beschreibung (DE) Binary
EnableSPI Enable SPI SPI aktivieren 00000001

⚙️ Functions / Funktionen

1. Initbme280

Initializes the BME280 sensor with user-defined configurations.

function Initbme280(HumidityOversampling, PressureOversampling, TemperatureOversampling, mode, Repeattime, filter: byte): integer;

2. Initbme280_WithDefaults

Initializes the BME280 sensor with default settings.

function Initbme280_WithDefaults: integer;

🔒 License / Lizenz

MIT License
Copyright (c) 2025 [Your Name]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is provided to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.

🌐 Other Projects by the Author

  • pibackup – Portable live backup and restore tool with GUI, Zstandard compression, auto-shrinking (resize2fs) and flexible restore options.
  • Raspberry-UDP_audio_receiver – Network audio receiver (UDP) with direct ALSA output and very low latency.
  • DS18B20-FPC-Pi-GUI – GUI tool to read DS18B20 temperature sensors with linearization for high accuracy.
  • RaspberryPi-GPIOv2-FPC – Simple and fast Pascal unit for controlling GPIO pins via the Linux GPIO character device interface.