{"id":21853552,"url":"https://github.com/lupin3000/micropython-i2c-rotaryencoder","last_synced_at":"2026-04-16T04:03:04.544Z","repository":{"id":225302642,"uuid":"765285908","full_name":"Lupin3000/MicroPython-I2C-RotaryEncoder","owner":"Lupin3000","description":"MicroPython I2C library and example for Gravity: 360 Degree Rotary Encoder Module","archived":false,"fork":false,"pushed_at":"2024-03-14T12:54:34.000Z","size":72,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-13T20:11:55.004Z","etag":null,"topics":["dfrobot","encoder","esp32","gravity","i2c","micropython"],"latest_commit_sha":null,"homepage":"https://softwaretester.info","language":"Python","has_issues":false,"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/Lupin3000.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-02-29T16:22:29.000Z","updated_at":"2025-04-01T09:23:28.000Z","dependencies_parsed_at":"2024-03-01T10:28:39.929Z","dependency_job_id":"1c91d1ba-c154-491b-b075-6ff559dbd3c0","html_url":"https://github.com/Lupin3000/MicroPython-I2C-RotaryEncoder","commit_stats":null,"previous_names":["lupin3000/micropython-i2c-rotaryencoder"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Lupin3000/MicroPython-I2C-RotaryEncoder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lupin3000%2FMicroPython-I2C-RotaryEncoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lupin3000%2FMicroPython-I2C-RotaryEncoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lupin3000%2FMicroPython-I2C-RotaryEncoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lupin3000%2FMicroPython-I2C-RotaryEncoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lupin3000","download_url":"https://codeload.github.com/Lupin3000/MicroPython-I2C-RotaryEncoder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lupin3000%2FMicroPython-I2C-RotaryEncoder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31870516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["dfrobot","encoder","esp32","gravity","i2c","micropython"],"created_at":"2024-11-28T01:25:40.922Z","updated_at":"2026-04-16T04:03:04.490Z","avatar_url":"https://github.com/Lupin3000.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MicroPython I2C library and example for Gravity: 360 Degree Rotary Encoder Module\n\nThis repository contains the MicroPython I2C library for the Gravity: 360 Degree Rotary Encoder Module from DFRobot, as well as a very simple example of how to use it. The original repository from DFRobot is located [here](https://github.com/DFRobot/DFRobot_VisualRotaryEncoder) (_for Arduino and Raspberry Pi_).\n\n## Why this repository?\n\nThe original version of DFRobot uses Python serial (_UART_) and Python SMBus (_I2C_), which are not compatible with MicroPython. Also, I was not so happy with the Python code style/quality. That's why I created this version.\n\n## Prerequisite\n\n- [Gravity: 360 Degree Rotary Encoder Module](https://www.dfrobot.com/product-2575.html?tracking=Mszf2HlGMStAAKkFfhNgg3QhFFchlilhR47u9vXX9o9Ko6giJYRJQdmwZjbDIvMV)\n- ESP32 (_MicroPython compatible device_)\n- MicroPython firmware installed (_min. 1.20.0.*_)\n- USB cable (_for connection between ESP32 and sensor_)\n- latest [VCP](https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers?tab=downloads) driver installed\n\n![RotaryEncoder.jpg](img/RotaryEncoder.jpg)\n\n## Installation\n\nClone this repository to your local computer.\n\n```shell\n# clone repository\n$ git clone https://github.com/Lupin3000/Micropython-I2C-RotaryEncoder.git\n\n# change into local repository folder\n$ cd Micropython-I2C-RotaryEncoder/\n```\n\nYou can optionally install other helpful Python packages.\n\n- esptool (_to flash the MicroPython firmware to the ESP32_)\n- rshell (_to establish a serial connection between the local computer and the ESP32 and to transfer data_)\n- micropython-esp32-stubs (_to facilitate local development, for example: code completion_)\n\n```shell\n# install python packages (optional)\n$ pip install -r requirements.txt\n```\n\nConnect the sensor to the ESP32. Make sure that you have set the communication mode on the sensor to I2C and use the correct connections (_ESP GPIO's/Sensor interface_)! Only then connect the ESP32 to your local computer via USB.\n\n\u003e In the example `main.py`, the GPIOs pins 21 (_SDA_) and 22 (_SCL_) are used. However, you can adapt these to your needs at any time.\n\nThen start the serial connection and load the example and the library onto the ESP32 device.\n\n```shell\n# start rshell connection\n$ rshell -p /dev/cu.usbserial-0001\n\n# upload files and folder\n/YOUR/LOCAL/PATH\u003e cp main.py /pyboard/\n/YOUR/LOCAL/PATH\u003e cp -r lib/ /pyboard/\n```\n\n\u003e The example device/path `/dev/cu.usbserial-0001` could be different for you! Please adapt before your execute the commands!\n\n## Usage\n\n```shell\n# start the Python REPL\n/YOUR/LOCAL/PATH\u003e repl\n```\n\nNow press the keys `CTRL` + `d` on your local device, to trigger the soft-reset of the ESP32. If there are no errors, you should see the GNSS values in the terminal after a very short time.\n\n```python\nEntering REPL. Use Control-X to exit.\n\u003e\nMicroPython v1.20.0 on 2023-04-26; ESP32 module with ESP32\nType \"help()\" for more information.\n\u003e\u003e\u003e \n\u003e\u003e\u003e \nMPY: soft reboot\n```\n\nWhen you turn the knob, the output looks similar to this example:\n\n```python\nMPY: soft reboot\nPID: 502, VID: 13123, Version: 256, I2C: 84\nEncoder current gain coefficient: 51\nEncoder value: 344\nEncoder value: 344\nEncoder value: 344\nEncoder value: 344\nEncoder value: 344\nEncoder value: 344\nEncoder value: 38\nEncoder value: 612\n```\n\nAdditional information:\n\n- [DFRobot: Product Wiki](https://wiki.dfrobot.com/SKU_SEN0502_Rotary_Encoder_Module_I2C)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flupin3000%2Fmicropython-i2c-rotaryencoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flupin3000%2Fmicropython-i2c-rotaryencoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flupin3000%2Fmicropython-i2c-rotaryencoder/lists"}