English | 简体中文 | 繁體中文 | 日本語 | Deutsch | 한국어
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讀取、溫濕度矯正等功能並且它符合MISRA標準。
/src目錄包含了LibDriver SGP30的源文件。
/interface目錄包含了LibDriver SGP30與平台無關的IIC總線模板。
/test目錄包含了LibDriver SGP30驅動測試程序,該程序可以簡單的測試芯片必要功能。
/example目錄包含了LibDriver SGP30編程範例。
/doc目錄包含了LibDriver SGP30離線文檔。
/datasheet目錄包含了SGP30數據手冊。
/project目錄包含了常用Linux與單片機開發板的工程樣例。所有工程均採用shell腳本作為調試方法,詳細內容可參考每個工程裡面的README.md。
/misra目錄包含了LibDriver MISRA程式碼掃描結果。
參考/interface目錄下與平台無關的IIC總線模板,完成指定平台的IIC總線驅動。
將/src目錄,/interface目錄和/example目錄加入工程。
#include "driver_sgp30_basic.h"
uint8_t res;
uint8_t i;
uint16_t co2_eq_ppm;
uint16_t tvoc_ppb;
res = sgp30_basic_init();
if (res != 0)
{
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 != 0)
{
(void)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);
...
}
...
(void)sgp30_basic_deinit();
return 0;
#include "driver_sgp30_advance.h"
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 != 0)
{
return 1;
}
...
res = sgp30_advance_get_serial_id((uint16_t *)id);
if (res != 0)
{
(void)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 != 0)
{
(void)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 != 0)
{
(void)sgp30_advance_deinit();
return 1;
}
...
res = sgp30_advance_set_absolute_humidity(25.6, 30.2f);
if (res != 0)
{
(void)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 != 0)
{
(void)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);
...
}
...
(void)sgp30_advance_deinit();
return 0;
在線文檔: https://www.libdriver.com/docs/sgp30/index.html。
離線文檔: /doc/html/index.html。
請參攷CONTRIBUTING.md。
版權 (c) 2015 - 現在 LibDriver 版權所有
MIT 許可證(MIT)
特此免費授予任何獲得本軟件副本和相關文檔文件(下稱“軟件”)的人不受限制地處置該軟件的權利,包括不受限制地使用、複製、修改、合併、發布、分發、轉授許可和/或出售該軟件副本,以及再授權被配發了本軟件的人如上的權利,須在下列條件下:
上述版權聲明和本許可聲明應包含在該軟件的所有副本或實質成分中。
本軟件是“如此”提供的,沒有任何形式的明示或暗示的保證,包括但不限於對適銷性、特定用途的適用性和不侵權的保證。在任何情況下,作者或版權持有人都不對任何索賠、損害或其他責任負責,無論這些追責來自合同、侵權或其它行為中,還是產生於、源於或有關於本軟件以及本軟件的使用或其它處置。