Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

C implementation of BME680 with pressure, temp, hum and gas resistance

NotificationsYou must be signed in to change notification settings

wrclark/bme680

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example implementation of BME680 software. The I2C/SPI drivers are meant to run on a Raspberry Pi 4.

Raspberry Pi

Connecting the purple BME680 module board to SPI:

SPI funcBME680 PinRaspberry Pi Pin
MISO"SDO"GPIO 9 (Pin 21)
MOSI"SDA"GPIO 10 (Pin 19)
SCLK"SCL"GPIO 11 (Pin 23)
CS"CS"GPIO 8 (Pin 24)

build

$ make

This will create demo programsbme680_i2c andbme680_spi, and logging programsbme680_log_i2c andbme680_log_spi. They all expect the pin/devices specified inspi.c andi2c.c.

The loggers spit out the following every minute:

2024-08-19T18:20:00+0100 22.2358 101068 65.8092 11054.4 1

Date,Temperature °C,Pressure Pa,% RH,Measured Gas resistance Ω,Heat stability bit

Note: disregard measured gas resistance if the heat stability bit is not 1.

bme680_{i2c,spi} demo output

par_t1: 26203par_t2: 26519par_t3: 3par_p1: 35008par_p2: -10284par_p3: 88par_p4: 9692par_p5: -202par_p6: 30par_p7: 24par_p8: -4par_p9: -3469par_p10: 30par_h1: 794par_h2: 1007par_h3: 0par_h4: 45par_h5: 20par_h6: 120par_h7: -100par_g1: 208par_g2: 59781par_g3: 18range_switching_error: 19res_heat_range: 1res_heat_val: 46float modetfine: 104906.162500temp: 20.489485 degCpress: 100089.609193 Pahumidity: 64.456540 % RHgas resistance: 12100.310308 Ohm== for heater target=300.0 and ambient temp=19.0 (degC)=== gas_valid_r: 1=== heat_stab_r: 1

Burn-in / logging

See filecmd/log.c

Graph of gas resistance measured over timeGraph of temperature measured over timeGraph of pressure measured over timeGraph of humidity measured over time

Compile and run

$ make$ mkdir data$ stdbuf -o0 ./bme680_log_i2c2>&1| tee -a data/i2c.txt&$ stdbuf -o0 ./bme680_log_spi2>&1| tee -a data/spi.txt&# wait a couple of hours or days ..$cd plot$ ./plot.sh

About

C implementation of BME680 with pressure, temp, hum and gas resistance

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp