https://github.com/chakflying/bme-sensors
Rust program reading the BME688 sensor using the BSEC library.
https://github.com/chakflying/bme-sensors
bme688 iot raspberry-pi rust
Last synced: 2 months ago
JSON representation
Rust program reading the BME688 sensor using the BSEC library.
- Host: GitHub
- URL: https://github.com/chakflying/bme-sensors
- Owner: chakflying
- License: gpl-3.0
- Created: 2023-01-05T22:30:09.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-17T08:34:12.000Z (over 1 year ago)
- Last Synced: 2025-01-24T07:09:05.063Z (4 months ago)
- Topics: bme688, iot, raspberry-pi, rust
- Language: Rust
- Homepage: https://medium.com/@nelcc/monitor-air-quality-when-resin-3d-printing-with-a-raspberry-pi-and-gas-sensor-bme688-53de18ce55c
- Size: 234 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BME688 Data Logger
This combines the BSEC library from Bosch and `bme68x-rust` to read and process data from the BME688 sensor, and send it to a graphite server. The project runs on a Raspberry Pi 4B with a armv7l 32-bit OS, with the sensor on a Adafruit breakout board connected with I2C.
## Hardware
- Raspberry Pi 4B
- Adafruit BME688
- STEMMA QT / Qwiic JST SH 4-pin Cable with Premium Female Sockets## Dependencies
- Bosch BSEC Library `2.2.0`
Download from the [Bosch website](https://www.bosch-sensortec.com/software-tools/software/bme688-software/#Library).
Located in the dowloaded zip archive, `algo/normal_version/bin/RaspberryPi/PiThree_ArmV6/`, copy the files
- `bsec_datatypes.h`,
- `bsec_interface.h`,
- `libalgobsec.a`into the project folder `lib/`.
## Configuration
The Graphite server location is configured via environment variables. You can also create file `.env` in the project root, and input the graphite server location:
```shell
GRAPHITE_URL=:2003
```## Usage
Build the program in release mode:
```shell
cargo build --release
```Then the CLI program can be run in the background with:
```shell
nohup {project directory}/target/release/bme-sensors & disown
```You can also setup a systemd service such that it runs on startup.
```shell
[Unit]
Description=BME Sensors service
After=network.target
StartLimitIntervalSec=0[Service]
Type=simple
Restart=always
RestartSec=1
Environment="RUST_LOG=warn"
User=
WorkingDirectory=/
ExecStart=//target/release/bme-sensors[Install]
WantedBy=multi-user.target
```Use VictoriaMetrics Agent to buffer data in case of network issues:
```shell
[Unit]
Description=Victoria Metrics Agent service
After=network.target
StartLimitIntervalSec=0[Service]
Type=simple
Restart=always
RestartSec=1
User=root
WorkingDirectory=/tmp
ExecStart=/usr/local/bin/vmagent -remoteWrite.url=http://:8428/api/v1/write -graphiteListenAddr=:2003[Install]
WantedBy=multi-user.target
```