{"id":21260500,"url":"https://github.com/s5uishida/bme280-driver","last_synced_at":"2025-04-14T04:51:54.589Z","repository":{"id":103742243,"uuid":"220975672","full_name":"s5uishida/bme280-driver","owner":"s5uishida","description":"a java library that operates combined humidity, pressure and temperature sensor called BME280","archived":false,"fork":false,"pushed_at":"2019-12-07T10:46:08.000Z","size":11,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T18:52:29.574Z","etag":null,"topics":["bme280","humidity","i2c","java","osgi","pi4j","pressure","sensor","temperature"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/s5uishida.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-11T12:22:48.000Z","updated_at":"2024-08-04T00:02:35.000Z","dependencies_parsed_at":"2023-07-08T08:45:13.548Z","dependency_job_id":null,"html_url":"https://github.com/s5uishida/bme280-driver","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s5uishida%2Fbme280-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s5uishida%2Fbme280-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s5uishida%2Fbme280-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s5uishida%2Fbme280-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s5uishida","download_url":"https://codeload.github.com/s5uishida/bme280-driver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248824693,"owners_count":21167343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bme280","humidity","i2c","java","osgi","pi4j","pressure","sensor","temperature"],"created_at":"2024-11-21T04:19:14.046Z","updated_at":"2025-04-14T04:51:54.584Z","avatar_url":"https://github.com/s5uishida.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bme280-driver\nbme280-driver is a java library that operates combined humidity, pressure and temperature sensor called [BME280](http://static.cactus.io/docs/sensors/barometric/bme280/BST-BME280_DS001-10.pdf) to connect BME280 to GPIO terminal of Raspberry Pi 3B and make it for use in java.\nI releases this in the form of the Eclipse plug-in project.\nYou need Java 8.\n\nI use [Pi4J](https://pi4j.com/)\nfor gpio communication in java and have confirmed that it works in Raspberry Pi 3B ([Raspbian Buster Lite OS](https://www.raspberrypi.org/downloads/raspbian/) (2019-07-10)).\n\n**Note. To use Pi4J 1.2's I2C functionality, sun.misc.SharedSecrets.class is required, but this class can only be used up to Java 8 and cannot be used since Java 9. Therefore, Java 8 is required to use this library.**\n\n## Connection of BME280 and Raspberry Pi 3B\n- `Pins` of [BME280](http://static.cactus.io/docs/sensors/barometric/bme280/BST-BME280_DS001-10.pdf) p.38 \"Figure 17: I2C connection diagram\"\n  - Vin (3.3V)\n  - GND\n  - SDA\n  - SCL\n  - SDO --\u003e I2C address is **0x76** when connected to GND and **0x77** when connected to Vin.\n- [GPIO of Raspberry Pi 3B](https://www.raspberrypi.org/documentation/usage/gpio/README.md)\n  - Vin --\u003e (1) or (17) / 3.3V\n  - GND --\u003e (6), (9), (14), (20), (25), (30), (34) or (39)\n  - SDA --\u003e (3) GPIO2 / I2C bus 1, (27) GPIO0 / I2C bus 0\n  - SCL --\u003e (5) GPIO3 / I2C bus 1, (28) GPIO1 / I2C bus 0\n\nThe connection terminals for SDA and SCL vary depending on the I2C bus number (`1` or `0`). For reference, it seems that some BME280 products are also compatible with 5V due to the voltage regulator.\n\n## Install Raspbian Buster Lite OS (2019-07-10)\nThe reason for using this version is that it is the latest as of July 2019 and [BlueZ](http://www.bluez.org/) 5.50 is included from the beginning, and use Bluetooth and serial communication simultaneously.\n\n## Configuration of Raspbian Buster Lite OS\n- Edit `/boot/cmdline.txt`\n```\nconsole=serial0,115200 --\u003e removed\n```\n- Edit `/boot/config.txt`\n```\n@@ -43,9 +43,10 @@\n #arm_freq=800\n \n # Uncomment some or all of these to enable the optional hardware interfaces\n-#dtparam=i2c_arm=on\n+dtparam=i2c_arm=on\n+dtparam=i2c_vc=on\n #dtparam=i2s=on\n-#dtparam=spi=on\n+dtparam=spi=on\n \n # Uncomment this to enable the lirc-rpi module\n #dtoverlay=lirc-rpi\n@@ -55,6 +56,10 @@\n # Enable audio (loads snd_bcm2835)\n dtparam=audio=on\n \n+enable_uart=1\n+dtoverlay=pi3-miniuart-bt\n+core_freq=250\n+\n [pi4]\n # Enable DRM VC4 V3D driver on top of the dispmanx display stack\n dtoverlay=vc4-fkms-v3d\n```\n- Edit `/etc/modules`\n```\ni2c-dev \u003c-- added\n```\nWhen editing is complete, reboot.\n\n## Install WiringPi Native Library\nPi4J depends on the [WiringPi](http://wiringpi.com/) native library by Gordon Henderson.\nThe Pi4J native library is dynamically linked to WiringPi.\n```\n# apt-get update\n# apt-get install wiringpi\n```\nWhen using with Raspberry Pi 4B, install the latest version as follows.\nPlease refer to [here](http://wiringpi.com/wiringpi-updated-to-2-52-for-the-raspberry-pi-4b/).\n```\n# wget https://project-downloads.drogon.net/wiringpi-latest.deb\n# dpkg -i wiringpi-latest.deb\n```\nPlease make sure it’s version 2.52.\n```\n# gpio -v\ngpio version: 2.52\n```\n**Note. In October 2019, I have not confirmed the official information that can use Raspberry Pi 4B with Pi4J and WiringPi.\nI've simply checked that it works, but some problems may occur.**\n\n## Install jdk8 on Raspberry Pi 3B\nFor example, the installation of OpenJDK 8 is shown below.\n```\n# apt-get update\n# apt-get install openjdk-8-jdk\n```\n\n## Install git\nIf git is not included, please install it.\n```\n# apt-get install git\n```\n\n## Install i2c-tools\nInstall i2c-tools to use `i2cdetect` command.\n```\n# apt-get install i2c-tools\n```\nIf BME280 is connected to I2C bus 1 and I2C address 0x76, the `i2cdetect` command displays the following.\n```\n# i2cdetect -y 1\n     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f\n00:          -- -- -- -- -- -- -- -- -- -- -- -- -- \n10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \n20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \n30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \n40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \n50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \n60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \n70: -- -- -- -- -- -- 76 --   \n```\n\n## Use this with the following bundles\n- [SLF4J 1.7.26](https://www.slf4j.org/)\n- [Pi4J 1.2 (pi4j-core.jar)](https://github.com/s5uishida/pi4j-core-osgi)\n\nI would like to thank the authors of these very useful codes, and all the contributors.\n\n## How to use\nThe following sample code will be helpful. A strange value may be returned at the first time, but I think that the normal values will be obtained after the second time.\n```java\nimport com.pi4j.io.i2c.I2CBus;\n\nimport io.github.s5uishida.iot.device.bme280.driver.BME280Driver;\n\npublic class MyBME280 {\n    private static final Logger LOG = LoggerFactory.getLogger(MyBME280.class);\n    \n    public static void main(String[] args) {\n        BME280Driver bme280 = null;\n        try {\n            bme280 = BME280Driver.getInstance(I2CBus.BUS_1, BME280Driver.I2C_ADDRESS_76);\n            bme280.open();\n            \n            while (true) {\n                float[] values = bme280.getSensorValues();\n                LOG.info(\"temperature:\" + values[0]);\n                LOG.info(\"humidity:\" + values[1]);\n                LOG.info(\"pressure:\" + values[2]);\n                \n                Thread.sleep(10000);\n            }\n        } catch (InterruptedException e) {\n            LOG.warn(\"caught - {}\", e.toString());\n        } catch (IOException e) {\n            LOG.warn(\"caught - {}\", e.toString());\n        } finally {\n            if (bme280 != null) {\n                bme280.close();\n            }\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs5uishida%2Fbme280-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs5uishida%2Fbme280-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs5uishida%2Fbme280-driver/lists"}