{"id":13802581,"url":"https://github.com/schinckel/micropython-sht30","last_synced_at":"2025-05-13T13:32:26.943Z","repository":{"id":57441507,"uuid":"163795849","full_name":"schinckel/micropython-sht30","owner":"schinckel","description":"SHT30 sensor driver in pure python based on I2C bus","archived":false,"fork":true,"pushed_at":"2019-08-01T01:00:22.000Z","size":23,"stargazers_count":3,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-29T07:12:12.607Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"rsc1975/micropython-sht30","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/schinckel.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}},"created_at":"2019-01-02T04:58:03.000Z","updated_at":"2023-10-10T02:31:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/schinckel/micropython-sht30","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schinckel%2Fmicropython-sht30","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schinckel%2Fmicropython-sht30/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schinckel%2Fmicropython-sht30/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schinckel%2Fmicropython-sht30/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schinckel","download_url":"https://codeload.github.com/schinckel/micropython-sht30/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253950249,"owners_count":21989329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-04T00:01:47.862Z","updated_at":"2025-05-13T13:32:26.661Z","avatar_url":"https://github.com/schinckel.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/0_Datasheets/Humidity/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/13_Sample_Codes_Software/Humidity_Sensors/Sensirion_Humidity_Sensors_SHT3x_Sample_Code.zip) 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. If 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 for 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 part 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%2Fschinckel%2Fmicropython-sht30","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschinckel%2Fmicropython-sht30","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschinckel%2Fmicropython-sht30/lists"}