{"id":13613054,"url":"https://github.com/rsc1975/micropython-sht30","last_synced_at":"2026-01-12T11:38:49.763Z","repository":{"id":133182991,"uuid":"77935871","full_name":"rsc1975/micropython-sht30","owner":"rsc1975","description":"SHT30 sensor driver in pure python based on I2C bus","archived":false,"fork":false,"pushed_at":"2019-06-07T19:03:06.000Z","size":22,"stargazers_count":50,"open_issues_count":5,"forks_count":28,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-13T15:41:54.425Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rsc1975.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}},"created_at":"2017-01-03T16:54:24.000Z","updated_at":"2025-03-15T22:03:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"46db3e55-6c56-4e63-a236-d91c85f8b10b","html_url":"https://github.com/rsc1975/micropython-sht30","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/rsc1975/micropython-sht30","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsc1975%2Fmicropython-sht30","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsc1975%2Fmicropython-sht30/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsc1975%2Fmicropython-sht30/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsc1975%2Fmicropython-sht30/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rsc1975","download_url":"https://codeload.github.com/rsc1975/micropython-sht30/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsc1975%2Fmicropython-sht30/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:58:46.209Z","status":"ssl_error","status_checked_at":"2026-01-12T10:58:42.742Z","response_time":98,"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":[],"created_at":"2024-08-01T20:00:38.612Z","updated_at":"2026-01-12T11:38:49.746Z","avatar_url":"https://github.com/rsc1975.png","language":"Python","funding_links":[],"categories":["Libraries","精选驱动库"],"sub_categories":["Sensors","传感器"],"readme":"#SHT30 Sensor driver in micropython\n\nMicropython driver for [SHT30 Shield](https://www.wemos.cc/product/sht30-shield.html) for [Wemos D1 Mini (and PRO)](https://www.wemos.cc/product/d1-mini-pro.html).\n\nThe driver has been tested on Wemos D1 mini PRO, but It should work on whatever other micropython board, if anyone find problems in other boards, please open an issue and We'll see.\n\n##Motivation\nThe SHT30 shield for ESP8266 board Wemos D1 Mini has an Arduino driver but not a micropython one.\n\n##References:\n\n* [Sensor Datasheet](https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/2_Humidity_Sensors/Sensirion_Humidity_Sensors_SHT3x_Datasheet_digital.pdf)\n* [Arduino driver](https://github.com/wemos/WEMOS_SHT3x_Arduino_Library)\n* [SHT30 C Code Examples](https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/11_Sample_Codes_Software/Humidity_Sensors/Sensirion_Humidity_Sensors_SHT3x_Sample_Code_V2.pdf) from sensor manufacturer\n\n##Examples of use:\n\n###How to get the temperature and relative humidity:\n\nThe `measure()` method returns a tuple with the temperature in celsius grades and the relative humidity in percentage. \nIf the measurement cannot be performed then an exception is raised (`SHT30Error`)\n\n```python\nfrom sht30 import SHT30\n\nsensor = SHT30()\n\ntemperature, humidity = sensor.measure()\n\nprint('Temperature:', temperature, 'ºC, RH:', humidity, '%')\n```\n\nThere is another method, `measure_int()`, that returns 4 integer values, **no floating point operation is done**, designed \nfor environments that doesn't support floating point operations, the four values are: \n\nTemperature (integer part), Temperature (decimal part), RH (integer part), RH (decimal part)\n\nFor intance, if the `measure()` method returns `(21.5623, 32.0712)` the `measure_int()` method would return: `(24, 56, 32, 7)` The decimal \npart is limited to 2 decimal digits.\n\n```python\nt_int, t_dec, h_int, h_dec = sensor.measure_int()\n\nprint('Temperature: %i.%02i °C, RH: %i.%02i %%' % (t_int, t_dec, h_int, h_dec))\n```\n\nBoth methods allow a `raw` param that when It's `True` returns the sensor measurement as-is, It's a `bytearray(6)` with the format defined in the sensor datasheet document.\n\n```python\nraw_measure = sensor.measure(raw=True)\n\nprint('Sensor measurement', raw_measure)\n```\n\n###Check if shield is connected\n\n```python\nfrom sht30 import SHT30\n\nsensor = SHT30()\n\nprint('Is connected:', sensor.is_present())\n\n```\n\n###Read sensor status\n\nCheck the [Sensor Datasheet](https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/2_Humidity_Sensors/Sensirion_Humidity_Sensors_SHT3x_Datasheet_digital.pdf) for further info about sensor status register\n```python\nfrom sht30 import SHT30\n\nsensor = SHT30()\n\nprint('Status register:', bin(sensor.status()))\nprint('Single bit check, HEATER_MASK:', bool(sensor.status() \u0026 SHT30.HEATER_MASK))\n\n#The status register can be cleared with\nsensor.clear_status()\n\n```\n\n\n###Reset the sensor\n\nThe driver allows a soft reset of the sensor\n\n```python\nfrom sht30 import SHT30\n\nsensor = SHT30()\nsensor.reset()\n\n```\n\n\n\n###Error management\n\nWhen the driver cannot access to the measurement an exception `SHT30Error` is raised\n\n```python\nfrom sht30 import SHT30\n\nsensor = SHT30()\n\ntry:\n    t, h = sensor.measure()\nexcept SHT30Error as ex:\n    print('Error:', ex)\n\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsc1975%2Fmicropython-sht30","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frsc1975%2Fmicropython-sht30","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsc1975%2Fmicropython-sht30/lists"}