{"id":32166452,"url":"https://github.com/elixir-sensors/sgp40","last_synced_at":"2026-02-23T05:01:41.450Z","repository":{"id":57547327,"uuid":"370846911","full_name":"elixir-sensors/sgp40","owner":"elixir-sensors","description":"Use Sensirion SGP40 air quality sensor in Elixir","archived":false,"fork":false,"pushed_at":"2025-03-11T23:16:13.000Z","size":87,"stargazers_count":5,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-14T07:33:38.442Z","etag":null,"topics":["elixir","iaq","nerves-project","sgp","sgp4"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/sgp40","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elixir-sensors.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-05-25T22:52:32.000Z","updated_at":"2025-03-11T23:12:53.000Z","dependencies_parsed_at":"2025-01-13T00:22:32.392Z","dependency_job_id":"ba8c9f37-1197-44cb-8239-be4ed5ba4881","html_url":"https://github.com/elixir-sensors/sgp40","commit_stats":null,"previous_names":["mnishiguchi/sgp40"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/elixir-sensors/sgp40","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-sensors%2Fsgp40","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-sensors%2Fsgp40/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-sensors%2Fsgp40/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-sensors%2Fsgp40/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elixir-sensors","download_url":"https://codeload.github.com/elixir-sensors/sgp40/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-sensors%2Fsgp40/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29738083,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T04:51:08.365Z","status":"ssl_error","status_checked_at":"2026-02-23T04:49:15.865Z","response_time":90,"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":["elixir","iaq","nerves-project","sgp","sgp4"],"created_at":"2025-10-21T15:06:17.214Z","updated_at":"2026-02-23T05:01:41.437Z","avatar_url":"https://github.com/elixir-sensors.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SGP40\n\n[![Hex version](https://img.shields.io/hexpm/v/sgp40.svg \"Hex version\")](https://hex.pm/packages/sgp40)\n[![API docs](https://img.shields.io/hexpm/v/sgp40.svg?label=docs \"API docs\")](https://hexdocs.pm/sgp40)\n[![CI](https://github.com/elixir-sensors/sgp40/actions/workflows/ci.yml/badge.svg)](https://github.com/elixir-sensors/sgp40/actions/workflows/ci.yml)\n[![REUSE status](https://api.reuse.software/badge/github.com/elixir-sensors/sgp40)](https://api.reuse.software/info/github.com/elixir-sensors/sgp40)\n\nUse [Sensirion SGP40](https://www.sensirion.com/en/environmental-sensors/gas-sensors/sgp40/) air quality sensor in Elixir.\n\nThe raw signal from the SGP40 sensor is processed using [Sensirion's software algorithm](https://github.com/Sensirion/embedded-sgp/blob/00768191892b2cc0d839ebf95998fc4a85b660c4/sgp40_voc_index/sensirion_voc_algorithm.h) to give the [VOC Index](https://cdn.sparkfun.com/assets/e/9/3/f/e/GAS_AN_SGP40_VOC_Index_for_Experts_D1.pdf) that represents an air quality value on a scale from 0 to 500 where a lower value represents cleaner air.\n\n## Usage\n\n```elixir\niex\u003e {:ok, sgp} = SGP40.start_link(bus_name: \"i2c-1\")\n{:ok, #PID\u003c0.1407.0\u003e}\n\niex\u003e SGP40.measure(sgp)\n{:ok, %SGP40.Measurement{voc_index: 123, timestamp_ms: 885906}}\n```\n\nFor better accuracy, you can provide the SGP40 sensor with relative ambient humidity and ambient temperature from an external humidity sensor periodically.\n\n```elixir\niex\u003e SGP40.update_rht(sgp, humidity_rh, temperature_c)\n:ok\n```\n\nDepending on your hardware configuration, you may need to modify the call to\n`SGP40.start_link/1`. See `t:SGP40.options/0` for parameters.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-sensors%2Fsgp40","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felixir-sensors%2Fsgp40","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-sensors%2Fsgp40/lists"}