{"id":24091894,"url":"https://github.com/luhuadong/rtt-bme680","last_synced_at":"2025-02-27T07:44:38.364Z","repository":{"id":109656434,"uuid":"301612424","full_name":"luhuadong/rtt-bme680","owner":"luhuadong","description":"BME680 sensor package for RT-Thread","archived":false,"fork":false,"pushed_at":"2022-08-03T08:20:29.000Z","size":1597,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-10T07:50:45.590Z","etag":null,"topics":["mcu","rt-thread","rt-thread-rtos","sensor"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luhuadong.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":"2020-10-06T04:21:51.000Z","updated_at":"2024-03-28T08:48:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"f4c7bb53-e3c5-49f1-9f38-edb112b6addd","html_url":"https://github.com/luhuadong/rtt-bme680","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luhuadong%2Frtt-bme680","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luhuadong%2Frtt-bme680/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luhuadong%2Frtt-bme680/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luhuadong%2Frtt-bme680/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luhuadong","download_url":"https://codeload.github.com/luhuadong/rtt-bme680/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240993951,"owners_count":19890419,"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":["mcu","rt-thread","rt-thread-rtos","sensor"],"created_at":"2025-01-10T07:44:45.998Z","updated_at":"2025-02-27T07:44:38.358Z","avatar_url":"https://github.com/luhuadong.png","language":"C","readme":"# rtt-bme680\n\nBME680 sensor package for RT-Thread\n\n\n\n## 1、介绍\n\nBME680 环境传感器是一款四合一 MEMS 环境传感器，可测量 VOC（挥发性有机物）、温度、湿度、气压这四个参数，非常适用于监测空气质量。由于采用了 MEMS 技术，该传感器体积小、功耗低，因此也适用于低功耗场合，如可穿戴等。BME680 同时支持 I2C（地址可配置为 0x76 或 0x77）和 SPI 接口。\n\n测量范围及精度：\n\n- 温度测量范围：-40℃~+85℃\n- 温度测量精度：±1.0℃(0~65℃)\n- 湿度测量范围：0-100%r.H.\n- 湿度测量精度：±3%r.H.(20-80% r.H.,25℃)\n- 气压测量范围：300-1100hPa\n- 气压测量精度：±0.6hPa(300-1100hPa,0~65℃)\n- IAQ（室内空气质量）范围：0-500（值越大，空气质量越差）\n\n\n\n### 1.1 特性\n\n- 支持 sensor 设备驱动框架。\n- 支持 I2C 和 SPI 接口。\n- 线程安全。\n\n\n\n### 1.2 工作模式\n\n|    传感器    | 气压 | 温度 | 湿度 | IAQ  |\n| :----------: | :--: | :--: | :--: | :--: |\n| **通信接口** |      |      |      |      |\n|     I2C      |  √   |  √   |  √   |  √   |\n|     SPI      |      |      |      |      |\n| **工作模式** |      |      |      |      |\n|     轮询     |  √   |  √   |  √   |  √   |\n|     中断     |      |      |      |      |\n|     FIFO     |      |      |      |      |\n\n\n\n### 1.3 目录结构\n\n| 名称          | 说明                                                         |\n| ------------- | ------------------------------------------------------------ |\n| docs          | 文档目录                                                     |\n| examples      | 例子目录                                                     |\n| inc           | 头文件目录                                                   |\n| src           | 源代码目录（对接 RT-Thread Sensor 接口）                     |\n| BME680_driver | [官方驱动库](https://github.com/BoschSensortec/BME680_drive)（略微改动） |\n\n\n\n\n\n### 1.4 许可证\n\n- bme680 软件包遵循 Apache license v2.0 许可，详见 `LICENSE` 文件。\n- BME680_driver 库遵循 BSD-3-Clause 许可，详见 `BME680_driver/LICENSE` 文件。\n\n\n\n### 1.5 依赖\n\n- RT-Thread 4.0+\n- 使用 sensor 设备接口需要开启 sensor 设备驱动框架模块\n- 需要完成 BSP 的 I2C 或 SPI 配置\n\n\n\n## 2、获取 bme680 软件包\n\n使用 bme680 package 需要在 RT-Thread 的包管理器中选择它，具体路径如下：\n\n```\nRT-Thread online packages ---\u003e\n    peripheral libraries and drivers ---\u003e\n        [*] sensors drivers  ---\u003e\n            [*] BME680: Digital 4-in-1 sensor with gas, humidity, pressure and temperature.\n```\n\n然后让 RT-Thread 的包管理器自动更新，或者使用 `pkgs --update` 命令更新包到 BSP 中。\n\n\n\n## 3、使用 bme680 软件包\n\n### 3.1 版本说明\n\n| 版本   | 说明                                                 |\n| ------ | ---------------------------------------------------- |\n| latest | 暂时只支持 I2C 接口（SPI 接口及 IAQ 测量功能待更新） |\n\n目前处于公测阶段，建议开发者使用 latest 版本。\n\n\n\n### 3.2 配置选项\n\n- 是否开启浮点补偿\n- 是否开启 LOG 调试信息输出\n- 是否开启 I2C 示例程序\n  - 设置设备挂载的 I2C 总线名称\n  - 选择 I2C 地址（0x76 或 0x77）\n\n\n\n## 4、API 说明\n\nbme680 软件包已对接 sensor 驱动框架，操作传感器模块之前，只需调用下面接口注册传感器设备即可。\n\n```c\nrt_err_t rt_hw_bme680_init(const char *name, struct rt_sensor_config *cfg);\n```\n\n| 参数      | 描述            |\n| --------- | --------------- |\n| name      | 传感器设备名称  |\n| cfg       | sensor 配置信息 |\n| **返回**  | ——              |\n| RT_EOK    | 创建成功        |\n| -RT_ERROR | 创建失败        |\n\n\n\n#### 初始化示例\n\n```c\n#include \u003crtthread.h\u003e\n#include \u003crtdevice.h\u003e\n#include \u003cboard.h\u003e\n#include \"bme680.h\"\n\n#define BME680_I2C_BUS_NAME       \"i2c1\"\n#define BME680_I2C_ADDRESS        0x77\n\nstatic int rt_hw_bme680_port(void)\n{\n    struct rt_sensor_config cfg;\n    \n    cfg.intf.type = RT_SENSOR_INTF_I2C;\n    cfg.intf.dev_name = BME680_I2C_BUS_NAME;\n    cfg.intf.user_data = (void *)BME680_I2C_ADDRESS;\n    rt_hw_bme680_init(\"be6\", \u0026cfg);\n    \n    return RT_EOK;\n}\nINIT_COMPONENT_EXPORT(rt_hw_bme680_port);\n```\n\n\n\n#### 传感器测试\n\n将上述 sensor 初始化示例代码加入工程，编译下载后即可进行测试。（注意：需要先配置好 i2c1 总线，并添加 sensor 组件）\n\n**检查传感器是否初始化成功**\n\n```shell\nmsh \u003elist_device\ndevice           type         ref count\n-------- -------------------- ----------\nhumi_be6 Sensor Device        0\ntemp_be6 Sensor Device        0\nbaro_be6 Sensor Device        0\n```\n\n**查看 BME680 信息**\n\n```shell\nmsh \u003esensor probe baro_be6\n[I/sensor.cmd] device id: 0x61!\n\nmsh \u003esensor info\nvendor    :Bosch\nmodel     :bme680\nunit      :pa\nrange_max :110000\nrange_min :30000\nperiod_min:1000ms\nfifo_max  :1\n```\n\n**使用 sensor 命令读取气压数据**\n\n```shell\nmsh \u003esensor read 1\n[I/sensor.cmd] num:  0, press:100120 pa, timestamp:1764982\n```\n\n**使用示例程序读取气压数据**\n\n```shell\nmsh \u003ebme680_read_baro\n[1817747] Baro: 1001.26 hPa\n```\n\n\n\n## 5、注意事项\n\n暂无。\n\n\n\n## 6、相关文档\n\n见 docs 目录。\n\n\n\n## 7、联系方式\n\n- 维护：luhuadong@163.com\n- 主页：\u003chttps://github.com/luhuadong/rtt-bme680\u003e\n","funding_links":[],"categories":["Packages"],"sub_categories":["Peripherals"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluhuadong%2Frtt-bme680","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluhuadong%2Frtt-bme680","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluhuadong%2Frtt-bme680/lists"}