{"id":18689258,"url":"https://github.com/endail/si7021","last_synced_at":"2026-05-02T01:35:11.895Z","repository":{"id":104384730,"uuid":"405686789","full_name":"endail/SI7021","owner":"endail","description":"Raspberry Pi Si7021 C++ API","archived":false,"fork":false,"pushed_at":"2021-11-01T07:22:15.000Z","size":128,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-18T21:06:02.177Z","etag":null,"topics":["cpp","humidity","lgpio","raspberry-pi","si7021","temperature"],"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/endail.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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-09-12T16:01:48.000Z","updated_at":"2021-11-01T07:22:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"d97918a4-e82a-4aa4-9106-8ebd402d167a","html_url":"https://github.com/endail/SI7021","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/endail/SI7021","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endail%2FSI7021","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endail%2FSI7021/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endail%2FSI7021/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endail%2FSI7021/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/endail","download_url":"https://codeload.github.com/endail/SI7021/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endail%2FSI7021/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32520156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T01:12:54.858Z","status":"ssl_error","status_checked_at":"2026-05-02T01:12:54.261Z","response_time":64,"last_error":"SSL_read: 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":["cpp","humidity","lgpio","raspberry-pi","si7021","temperature"],"created_at":"2024-11-07T10:41:55.119Z","updated_at":"2026-05-02T01:35:11.881Z","avatar_url":"https://github.com/endail.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SI7021\n\n[![Build on Raspberry Pi](https://github.com/endail/SI7021/actions/workflows/buildcheck.yml/badge.svg)](https://github.com/endail/SI7021/actions/workflows/buildcheck.yml) [![cppcheck](https://github.com/endail/SI7021/actions/workflows/cppcheck.yml/badge.svg)](https://github.com/endail/SI7021/actions/workflows/cppcheck.yml)\n\n- Use with Raspberry Pi\n- Requires [lgpio](http://abyz.me.uk/lg/index.html)\n- Code tested inside [virtual Raspberry Pi Zero/3/4 environments](.github/workflows/buildcheck.yml) on GitHub\n\n## Example\n\n```cpp\n#include \"SI7021.h\"\n#include \u003ciostream\u003e\n\nint main() {\n\n    SI7021::SI7021 sensor;\n\n    //connect to and initialise the sensor\n    sensor.connect();\n\n    //obtain new temperature and humidity readings\n    sensor.refresh();\n\n    std::cout \n        \u003c\u003c \"Temperature: \"\n        \u003c\u003c sensor.getTemperature() \u003c\u003c \" C, \"\n        \u003c\u003c \"Humidity: \"\n        \u003c\u003c sensor.getHumidity() \u003c\u003c \" %RH\"\n        \u003c\u003c std::endl;\n\n    //prints eg.\n    //Temperature: 16.0205 C, Humidity: 62.8667 %RH\n\n    return 0;\n\n}\n```\n\n## Documentation\n\n- `SI7021( int dev, int addr )`. Constructor taking `dev` identifying which I2C device to use (default is device 1), and `addr` identifying which `I2C` address to use (default is 0x40).\n\n- `void connect( )`. Setup and connect to the device.\n\n- `void disconnect( )`. Disconnect from the device.\n\n- `void refresh( )`. Get a humidity and temperature sample from the sensor.\n\n- `double getTemperature( )`. Returns the last read temperature in degrees celsius.\n\n- `double getHumidity( )`. Returns the last read relative humidity as a percentage.\n\n- `void reset( )`. Reset the device.\n\n- `void resetSettings( )`. Reset UserRegister1 register (ie. measurement resolution and heater status) and HeaterControlRegister register (ie. heater power).\n\n- `std::uint8_t getMeasurementResolution( )`. Returns the measurement resolution from the device, between 0 and 3.\n\n- `void setMeasurementResolution( std::uint8_t res )`. Sets the measurement resolution, between 0 and 3.\n\n- `VddStatus getVddStatus( )`. Returns `VddStatus::OK` if voltage level is sufficient, otherwise `VddStatus::LOW`.\n\n- `HeaterStatus getHeaterStatus( )`. Returns `HeaterStatus::ENABLED` if the heater is enabled, or `HeaterStatus::DISABLED` if disabled.\n\n- `void setHeaterStatus( HeaterStatus status )`. Enable or disable the heater.\n\n- `std::uint8_t getHeaterPower( )`.  Returns the heater power, between 0 and 15.\n\n- `void setHeaterPower( std::uint8_t power )`. Set the heater power, between 0 and 15.\n\n- `SerialNumber getSerialNumber( )`. Gets the serial number of the device. `SerialNumber` is a typedef for a `std::uint64_t`.\n\n- `DeviceId getDeviceId( )`. Gets the device id.\n\n| identifier               | description        | devIdToString      |\n| ------------------------ | ------------------ | ------------------ |\n| `DeviceId::ENG_SAMPLE_1` | engineering sample | engineering sample |\n| `DeviceId::ENG_SAMPLE_2` | engineering sample | engineering sample |\n| `DeviceId::SI7013`       | SI7013             | Si7013             |\n| `DeviceId::SI7020`       | SI7020             | Si7020             |\n| `DeviceId::SI7021`       | SI7021             | Si7021             |\n| `DeviceId::UNKNOWN`      | unknown device     | unknown            |\n\n- `FirmwareRevision getFirmwareRevision( )`. Gets the device firmware revision.\n\n| identifier                  | description      | fwRevToString |\n| --------------------------- | ---------------- | ------------- |\n| `FirmwareRevision::REV_1_0` | revision 1.0     | 1.0           |\n| `FirmwareRevision::REV_2_0` | revision 2.0     | 2.0           |\n| `FirmwareRevision::UNKNOWN` | unknown firmware | unknown       |\n\n- `const char* const devIdToString( DeviceId id )`. Returns a C string representing the device id.\n\n- `const char* const fwRevToString( FirmwareRevision rev )`. Returns a C string representing the firmware revision.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendail%2Fsi7021","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fendail%2Fsi7021","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendail%2Fsi7021/lists"}