{"id":13802572,"url":"https://github.com/2black0/micropython-sht11","last_synced_at":"2025-05-13T13:32:22.316Z","repository":{"id":136785108,"uuid":"275306046","full_name":"2black0/micropython-sht11","owner":"2black0","description":"sht11 module for micropython","archived":false,"fork":false,"pushed_at":"2020-06-27T05:46:18.000Z","size":8,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-22T13:30:46.466Z","etag":null,"topics":["micropython","sensor","sht11","sht1x"],"latest_commit_sha":null,"homepage":"","language":"Python","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/2black0.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":"2020-06-27T05:26:42.000Z","updated_at":"2021-12-14T01:09:57.000Z","dependencies_parsed_at":"2024-01-07T21:53:45.646Z","dependency_job_id":"b1a73e76-d15e-4a1c-a898-ef92d0377e88","html_url":"https://github.com/2black0/micropython-sht11","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2black0%2Fmicropython-sht11","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2black0%2Fmicropython-sht11/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2black0%2Fmicropython-sht11/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2black0%2Fmicropython-sht11/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2black0","download_url":"https://codeload.github.com/2black0/micropython-sht11/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225229873,"owners_count":17441336,"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":["micropython","sensor","sht11","sht1x"],"created_at":"2024-08-04T00:01:47.695Z","updated_at":"2025-05-13T13:32:22.305Z","avatar_url":"https://github.com/2black0.png","language":"Python","readme":"# 🌱 MicroPython SHT11 Temperature \u0026 Humidity Sensor\n\nThis project demonstrates how to interface the **SHT11 sensor** with a **MicroPython-compatible ESP32 board (e.g., Lolin32 Lite)** to measure **temperature** and **relative humidity**. It uses **bit-banged communication** and is written fully in MicroPython.\n\n---\n\n## 📁 Project Structure\n\n```\nMicroPython-SHT11\n├── LICENSE                    # License file (e.g., MIT)\n├── README.md                  # This documentation\n└── project/\n    ├── main.py                # Main script to read and display sensor values\n    └── sht11.py               # SHT11 driver implementation in MicroPython\n```\n\n---\n\n## 📦 Requirements\n\n* ⚙️ **MicroPython board**: Tested on Lolin32 Lite (ESP32)\n* 🌡️ **Sensor**: Sensirion SHT11 (Digital Temp \u0026 RH sensor)\n* 🧠 **Firmware**: MicroPython 1.20 or later\n* 🧰 **Development tools**:\n\n  * [Thonny IDE](https://thonny.org/) or [mpremote](https://docs.micropython.org/en/latest/reference/mpremote.html)\n  * USB to Serial connection\n\n---\n\n## 🔌 Wiring\n\n| SHT11 Pin | Description  | ESP32 Pin (Example) |\n| --------- | ------------ | ------------------- |\n| 1 (SCK)   | Clock        | GPIO 26             |\n| 2 (DATA)  | Data         | GPIO 33             |\n| 3 (GND)   | Ground       | GND                 |\n| 4 (VCC)   | Power (3.3V) | 3.3V                |\n\n\u003e ⚠️ Note: Do **not** power SHT11 with 5V — it's a 3.3V device.\n\n---\n\n## 🧪 Example Usage\n\nIn the `main.py`:\n\n```python\n# example code to read SHT11 using MicroPython\n# author : Ardy Seto P\n# email  : 2black0@gmail.com\n# board  : Lolin32 Lite (ESP32)\n\nfrom sht11 import SHT11\n\n# Define SCK and DATA GPIO pins\nsht = SHT11(sck=26, data=33)\n\n# Read temperature and humidity\ntempOut = sht.temperature()\nhumOut = sht.humidity()\n\n# Display results\nprint('Temperature: ', tempOut, '*C')\nprint('Humidity: ', humOut, '%')\n```\n\n---\n\n## 🔧 Features of the `SHT11` Driver\n\n* 📡 Pure MicroPython bit-banged protocol (no I2C)\n* 📊 Reads:\n\n  * Temperature (°C)\n  * Relative Humidity (%RH)\n* ✅ Includes:\n\n  * CRC check\n  * Command protocol implementation\n  * Adjustable temperature compensation for RH\n\n### Key Methods\n\n```python\nSHT11(sck, data)         # Initialize driver with SCK and DATA pins\n.temperature()           # Return temperature in °C\n.humidity(temp=25)       # Return relative humidity (%), with temp compensation\n.read_register()         # Read status register (raw access)\n```\n\n---\n\n## ⚙️ Advanced Notes\n\n* This driver replicates the SHT11 protocol using direct GPIO pin manipulation.\n* Built-in CRC-8 validation helps detect communication errors.\n* The `.humidity()` method includes temperature compensation if called with custom temperature values.\n\n---\n\n## 💡 Troubleshooting\n\n* ❌ **CRC or ACK errors**: Make sure your wires are short and well-connected. SHT11 is sensitive to interference.\n* 🔁 **Slow reads?** SHT11 has \\~200–300 ms measurement latency; this is normal.\n* 📉 **Values look wrong?** Double-check power source and resistor pull-up configuration (if needed).\n\n---\n\n## 📜 License\n\nThis project is open-source under the [MIT License](LICENSE).\n\n---\n\n## 👤 Author\n\n**Ardy Seto Priambodo**\n✉️ [2black0@gmail.com](mailto:2black0@gmail.com)","funding_links":[],"categories":["Libraries"],"sub_categories":["Sensors"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2black0%2Fmicropython-sht11","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2black0%2Fmicropython-sht11","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2black0%2Fmicropython-sht11/lists"}