{"id":15163093,"url":"https://github.com/mauriciobarroso/sgia","last_synced_at":"2026-01-21T00:34:38.950Z","repository":{"id":213040044,"uuid":"732769655","full_name":"mauriciobarroso/sgia","owner":"mauriciobarroso","description":"ESP-IDF component for Sensirion Gas Index Algorithm","archived":false,"fork":false,"pushed_at":"2024-05-04T02:45:12.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T13:41:47.701Z","etag":null,"topics":["air-quality","esp-idf","esp32","esp32c2","esp32c3","esp32c6","esp32h2","esp32s2","esp32s3","gas-index","i2c","nox","sensirion","sgp41","sht4x","voc"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mauriciobarroso.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":"2023-12-17T19:11:08.000Z","updated_at":"2024-05-04T02:45:15.000Z","dependencies_parsed_at":"2024-05-04T03:28:48.660Z","dependency_job_id":null,"html_url":"https://github.com/mauriciobarroso/sgia","commit_stats":null,"previous_names":["mauriciobarroso/gia"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mauriciobarroso/sgia","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauriciobarroso%2Fsgia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauriciobarroso%2Fsgia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauriciobarroso%2Fsgia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauriciobarroso%2Fsgia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mauriciobarroso","download_url":"https://codeload.github.com/mauriciobarroso/sgia/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauriciobarroso%2Fsgia/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28619817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T23:49:58.628Z","status":"ssl_error","status_checked_at":"2026-01-20T23:47:29.996Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["air-quality","esp-idf","esp32","esp32c2","esp32c3","esp32c6","esp32h2","esp32s2","esp32s3","gas-index","i2c","nox","sensirion","sgp41","sht4x","voc"],"created_at":"2024-09-27T02:03:58.574Z","updated_at":"2026-01-21T00:34:38.924Z","avatar_url":"https://github.com/mauriciobarroso.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ESP-IDF SGIA (Sensirion Gas Index Algorithm) Component\nESP-IDF component for Sensirion Gas Index Algorithm based on [Sensirion Gas Index Algorithm](https://github.com/Sensirion/gas-index-algorithm)\n\n## Dependencies\nThis component only works with [ESP-IDF v5.2](https://github.com/espressif/esp-idf/tree/release/v5.2) or higher.\n\nThe gas index algorithm depends on the values obtained from the SGP41 and SHT4x sensors. The ESP-IDF components of these sensors are available at the following links:\n\n- [SGP41 ESP-IDF component](https://github.com/mauriciobarroso/sgp41)\n- [SHT4x ESP-IDF component](https://github.com/mauriciobarroso/sht4x)\n\n## How to use\n1. Include the I2C driver and component headers\n```c\n#include \"driver/i2c_master.h\"\n#include \"sgia.h\"\n```\n2. Declare a handle of I2C bus and an instance of SGIA\n```c\ni2c_master_bus_handle_t i2c_bus_handle; \nsgia_t button1;\n```\n\n3. Define a RTOS task to run SGIA process\n```c\nvoid sgia_process_task(void *arg) {\n    int32_t voc_index, nox_index;\n    float temp, hum;\n    \n    for (;;) {\n        /* Run SGIA process */\n        ESP_ERROR_CHECK(sgia_run(\u0026sgia));\n\n        /* Get and print VOC and NOx indices */\n        sgia_get_index_voc_and_nox(\u0026sgia, \u0026voc_index, \u0026nox_index);\n        printf(\"VOC index: %ld\\tNOx index: %ld\\r\\n\", sgia.voc_index, sgia.nox_index);\n\n        /* Get and print temperature and humidity values */\n        sgia_get_temp_and_hum(\u0026sgia, \u0026temp, \u0026hum);\n        printf(\"Temperature: %f\\tHumidity: %f\\r\\n\\n\", sgia.temp, sgia.hum);\n    \n        vTaskDelay(pdMS_TO_TICKS(1000));\n    }\n}\n```\n\n4. Configure and create a new I2C bus\n```c\n/* Configure and create a new I2C bus */\ni2c_master_bus_config_t i2c_bus_config = {\n    .clk_source = I2C_CLK_SRC_DEFAULT,\n    .i2c_port = I2C_NUM_0,\n    .scl_io_num = GPIO_NUM_48,\n    .sda_io_num = GPIO_NUM_47,\n    .glitch_ignore_cnt = 7\n};\n\nESP_ERROR_CHECK(i2c_new_master_bus(\u0026i2c_bus_config, \u0026i2c_bus_handle));\n```\n\n5. Initialize SGIA instance\n```c\n/* Initialize SGIA instance */\nsgia_init(\u0026sgia, i2c_bus_handle);\n```\n\n6. Create the RTOS task defined in 3\n```c\nxTaskCreate(\n    sgia_process_task, /* Task code */\n    \"BSEC Task\", /* Task name */\n    configMINIMAL_STACK_SIZE * 4, /* Task stack depth */\n    NULL, /* Task parameter */\n    tskIDLE_PRIORITY + 2, /* Task priority */\n    NULL); /* Task handle */\n```\n\n## License\nMIT License\n\nCopyright (c) 2023 Mauricio Barroso Benavides\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauriciobarroso%2Fsgia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmauriciobarroso%2Fsgia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauriciobarroso%2Fsgia/lists"}