forked from libdriver/sgp30
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
91 changed files
with
302 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
## LibDriver SGP30 | ||
|
||
[English](/README.md) | [ 简体中文](/README_CN.md) | ||
[English](/README.md) | [ 简体中文](/README_zh-Hans.md) | [繁體中文](/README_zh-Hant.md) | ||
|
||
The SGP30 is a digital multi-pixel gas sensor designed for easy integration into air purifier, demand-controlled ventilation, and IoT applications. Sensirion’s CMOSens technology offers a complete sensor system on a single chip featuring a digital I2C interface, a temperature controlled micro hotplate, and two preprocessed indoor air quality signals. As the first metal-oxide gas sensor featuring multiple sensing elements on one chip, the SGP30 provides more detailed information about the air quality.The sensing element features an unmatched robustness against contaminating gases present in real-world applications enabling a unique long-term stability and low drift. The very small 2.45 x 2.45 x 0.9 mm3 DFN package enables applications in limited spaces. Sensirion’s state-of-the-art production process guarantees high reproducibility and reliability. Tape and reel packaging, together with suitability for standard SMD assembly processes make the SGP30 predestined for high-volume applications. | ||
|
||
|
@@ -184,7 +184,7 @@ Please sent an e-mail to [email protected] | |
### License | ||
Copyright (C) LibDriver 2015-2021 All rights reserved | ||
Copyright (c) 2015 - present LibDriver All rights reserved | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
<div align=center> | ||
<img src="/doc/image/logo.png"/> | ||
</div> | ||
|
||
## LibDriver SGP30 | ||
|
||
[English](/README.md) | [ 简体中文](/README_zh-Hans.md) | [繁體中文](/README_zh-Hant.md) | ||
|
||
SGP30是一個數字化多像素氣體傳感器平台,專為輕鬆集成到空氣淨化器、按需新風控制和物聯網應用中而設計。 SGP30 是一個數字化多像素氣體傳感器平台,專為輕鬆集成到空氣淨化器、按需新風控制和物聯網應用中而設計。 SGP30 設計用於智能家居、家電和物聯網應用,它提供兩個經過校準的空氣質量信號和濕度補償功能。 Sensirion的CMOSens 技術在單個芯片上提供完整的傳感器系統,該系統採用一個數字化 I2C 接口、一個溫度控制的微加熱器和兩個經過預處理的室內空氣質量信號。作為首款在單個芯片上採用多個傳感元件的金屬氧化物氣體傳感器,SGP30 可提供有關空氣質量的更詳盡指數。針對現實生活環境中的污染氣體,該傳感器具有無與倫比的可靠性,可以實現獨一無二的長期穩定性和低漂移。 2.45 x 2.45 x 0.9 mm3 DFN 封裝支持對空間有要求的應用,Sensirion 的先進生產工藝保證了高度的可再現性和可靠性,膠帶和捲軸封裝加上標準 SMD 裝配工藝使得 SGP30 十分適合大規模生產的應用。 | ||
|
||
LibDriver SGP30是LibDriver推出的SGP30的全功能驅動,該驅動提供TVOC、CO2 eq讀取、溫濕度矯正等功能。 | ||
|
||
### 目錄 | ||
|
||
- [說明](#說明) | ||
- [安裝](#安裝) | ||
- [使用](#使用) | ||
- [example basic](#example-basic) | ||
- [example advance](#example-advance) | ||
- [文檔](#文檔) | ||
- [貢獻](#貢獻) | ||
- [版權](#版權) | ||
- [聯繫我們](#聯繫我們) | ||
|
||
### 說明 | ||
|
||
/src目錄包含了LibDriver SGP30的源文件。 | ||
|
||
/interface目錄包含了LibDriver SGP30與平台無關的IIC總線模板。 | ||
|
||
/test目錄包含了LibDriver SGP30驅動測試程序,該程序可以簡單的測試芯片必要功能。 | ||
|
||
/example目錄包含了LibDriver SGP30編程範例。 | ||
|
||
/doc目錄包含了LibDriver SGP30離線文檔。 | ||
|
||
/datasheet目錄包含了SGP30數據手冊。 | ||
|
||
/project目錄包含了常用Linux與單片機開發板的工程樣例。所有工程均採用shell腳本作為調試方法,詳細內容可參考每個工程裡面的README.md。 | ||
|
||
### 安裝 | ||
|
||
參考/interface目錄下與平台無關的IIC總線模板,完成指定平台的IIC總線驅動。 | ||
|
||
將/src目錄,/interface目錄和/example目錄加入工程。 | ||
|
||
### 使用 | ||
|
||
#### example basic | ||
|
||
```C | ||
uint8_t res; | ||
uint8_t i; | ||
uint16_t co2_eq_ppm; | ||
uint16_t tvoc_ppb; | ||
|
||
res = sgp30_basic_init(); | ||
if (res) | ||
{ | ||
return 1; | ||
} | ||
|
||
... | ||
|
||
for (i = 0; i < 3; i++) | ||
{ | ||
sgp30_interface_delay_ms(1000); | ||
res = sgp30_basic_read((uint16_t *)&co2_eq_ppm, (uint16_t *)&tvoc_ppb); | ||
if (res) | ||
{ | ||
sgp30_basic_deinit(); | ||
|
||
return 1; | ||
} | ||
sgp30_interface_debug_print("sgp30: co2 eq is %d ppm.\n", co2_eq_ppm); | ||
sgp30_interface_debug_print("sgp30: tvoc is %d ppb.\n", tvoc_ppb); | ||
|
||
... | ||
|
||
} | ||
|
||
... | ||
|
||
sgp30_basic_deinit(); | ||
|
||
return 0; | ||
``` | ||
|
||
#### example advance | ||
|
||
```C | ||
uint8_t res; | ||
uint8_t i; | ||
uint16_t co2_eq_ppm; | ||
uint16_t tvoc_ppb; | ||
uint16_t id[3]; | ||
uint8_t product_type; | ||
uint8_t product_version; | ||
|
||
res = sgp30_advance_init(); | ||
if (res) | ||
{ | ||
return 1; | ||
} | ||
|
||
... | ||
|
||
res = sgp30_advance_get_serial_id((uint16_t *)id); | ||
if (res) | ||
{ | ||
sgp30_advance_deinit(); | ||
|
||
return 1; | ||
} | ||
sgp30_interface_debug_print("sgp30: serial id 0x%04X 0x%04X 0x%04X.\n", (uint16_t)(id[0]), (uint16_t)(id[1]), (uint16_t)(id[2])) | ||
|
||
... | ||
|
||
res = sgp30_advance_get_feature((uint8_t *)&product_type, (uint8_t *)&product_version); | ||
if (res) | ||
{ | ||
sgp30_advance_deinit(); | ||
|
||
return 1; | ||
} | ||
sgp30_interface_debug_print("sgp30: product type is 0x%02X.\n", product_type); | ||
sgp30_interface_debug_print("sgp30: product version is 0x%02X.\n", product_version); | ||
|
||
... | ||
|
||
res = sgp30_advance_set_iaq_baseline(0x01, 0x02); | ||
if (res) | ||
{ | ||
sgp30_advance_deinit(); | ||
|
||
return 1; | ||
} | ||
|
||
... | ||
|
||
res = sgp30_advance_set_absolute_humidity(25.6, 30.2f); | ||
if (res) | ||
{ | ||
sgp30_advance_deinit(); | ||
|
||
return 1; | ||
} | ||
|
||
... | ||
|
||
for (i = 0; i < 3; i++) | ||
{ | ||
sgp30_interface_delay_ms(1000); | ||
res = sgp30_advance_read((uint16_t *)&co2_eq_ppm, (uint16_t *)&tvoc_ppb); | ||
if (res) | ||
{ | ||
sgp30_advance_deinit(); | ||
|
||
return 1; | ||
} | ||
sgp30_interface_debug_print("sgp30: co2 eq is %d ppm.\n", co2_eq_ppm); | ||
sgp30_interface_debug_print("sgp30: tvoc is %d ppb.\n", tvoc_ppb); | ||
|
||
... | ||
|
||
} | ||
|
||
... | ||
|
||
sgp30_advance_deinit(); | ||
|
||
return 0; | ||
``` | ||
### 文檔 | ||
在線文檔: https://www.libdriver.com/docs/sgp30/index.html | ||
離線文檔: /doc/html/index.html | ||
### 貢獻 | ||
請聯繫[email protected] | ||
### 版權 | ||
版權 (c) 2015 - 現在 LibDriver 版權所有 | ||
MIT 許可證(MIT) | ||
特此免費授予任何獲得本軟件副本和相關文檔文件(下稱“軟件”)的人不受限制地處置該軟件的權利,包括不受限制地使用、複製、修改、合併、發布、分發、轉授許可和/或出售該軟件副本,以及再授權被配發了本軟件的人如上的權利,須在下列條件下: | ||
上述版權聲明和本許可聲明應包含在該軟件的所有副本或實質成分中。 | ||
本軟件是“如此”提供的,沒有任何形式的明示或暗示的保證,包括但不限於對適銷性、特定用途的適用性和不侵權的保證。在任何情況下,作者或版權持有人都不對任何索賠、損害或其他責任負責,無論這些追責來自合同、侵權或其它行為中,還是產生於、源於或有關於本軟件以及本軟件的使用或其它處置。 | ||
### 聯繫我們 | ||
請聯繫[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.