{"id":13897195,"url":"https://github.com/depklyon/raspberrypi-tm1637","last_synced_at":"2025-07-17T14:30:36.004Z","repository":{"id":43173411,"uuid":"98477049","full_name":"depklyon/raspberrypi-tm1637","owner":"depklyon","description":"A fork of Micropython ported to Python 3 library for quad 7-segment LED display modules based on TM1637 LED driver","archived":false,"fork":true,"pushed_at":"2022-12-02T02:48:51.000Z","size":11026,"stargazers_count":51,"open_issues_count":0,"forks_count":21,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-24T00:40:04.297Z","etag":null,"topics":["led-controller","led-display","python3","raspberrypi","tm1637"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mcauser/micropython-tm1637","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/depklyon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-27T00:35:10.000Z","updated_at":"2024-03-11T18:30:02.000Z","dependencies_parsed_at":"2023-01-23T06:00:34.931Z","dependency_job_id":null,"html_url":"https://github.com/depklyon/raspberrypi-tm1637","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depklyon%2Fraspberrypi-tm1637","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depklyon%2Fraspberrypi-tm1637/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depklyon%2Fraspberrypi-tm1637/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depklyon%2Fraspberrypi-tm1637/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/depklyon","download_url":"https://codeload.github.com/depklyon/raspberrypi-tm1637/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226270396,"owners_count":17598075,"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":["led-controller","led-display","python3","raspberrypi","tm1637"],"created_at":"2024-08-06T18:03:24.870Z","updated_at":"2024-11-25T03:30:42.898Z","avatar_url":"https://github.com/depklyon.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# TM1637\n# Raspberry Pi Python 3 TM1637\n\nA Python 3 port from MicroPython library for the quad 7-segment LED display modules based on the TM1637 LED driver, implemented on Raspberry Pi.\n\nFor example, the [Grove - 4 Digit Display module](http://wiki.seeed.cc/Grove-4-Digit_Display/)\n\n![demo](https://github.com/depklyon/raspberrypi-tm1637/raw/master/docs/raspberry_tm1637.gif)\n\n## Installation\n\nThis project is available through [pip](https://www.w3schools.com/python/python_pip.asp). Make sure that you are using Python 3.\n\n```\n$ pip3 install raspberrypi-tm1637\n```\n\n## Examples\n\n**Basic usage**\n\n```python\nimport tm1637\ntm = tm1637.TM1637(clk=5, dio=4)\n\n# all LEDS on \"88:88\"\ntm.write([127, 255, 127, 127])\n\n# all LEDS off\ntm.write([0, 0, 0, 0])\n\n# show \"0123\"\ntm.write([63, 6, 91, 79])\n\n# show \"COOL\"\ntm.write([0b00111001, 0b00111111, 0b00111111, 0b00111000])\n\n# show \"HELP\"\ntm.show('help')\n\n# display \"dEAd\", \"bEEF\"\ntm.hex(0xdead)\ntm.hex(0xbeef)\n\n# show \"12:59\"\ntm.numbers(12, 59)\n\n# show \"-123\"\ntm.number(-123)\n\n# show temperature '24*C'\ntm.temperature(24)\n```\n\nFor more detailed examples, see [demo.py](https://github.com/depklyon/raspberrypi-tm1637/blob/master/demo.py)\n\n# Seven Segment Font\n\nThey are called 7-segment displays as there are 7 LEDs for each digit (segment).\nOne byte (7 lower bits) for each segment. The 8th bit (MSB) is for the colon and only on the 2nd segment.\n\n```\n      A\n     ---\n  F |   | B   *\n     -G-      H (on 2nd segment)\n  E |   | C   *\n     ---\n      D\n\n  HGFEDCBA\n0b01101101 = 0x6D = 109 = show \"5\"\n```\n\nDisplay | Bin        | Hex  | Dec\n------- | ---------- | ---- | ---\n0       | 0b00111111 | 0x3F | 63\n1       | 0b00000110 | 0x06 | 6\n2       | 0b01011011 | 0x5B | 91\n3       | 0b01001111 | 0x4F | 79\n4       | 0b01100110 | 0x66 | 102\n5       | 0b01101101 | 0x6D | 109\n6       | 0b01111101 | 0x7D | 125\n7       | 0b00000111 | 0x07 | 7\n8       | 0b01111111 | 0x7F | 127\n9       | 0b01101111 | 0x6F | 111\nA       | 0b01110111 | 0x77 | 119\nb       | 0b01111100 | 0x7C | 124\nC       | 0b00111001 | 0x39 | 57\nd       | 0b01011110 | 0x5E | 94\nE       | 0b01111001 | 0x79 | 121\nF       | 0b01110001 | 0x71 | 113\nG       | 0b00111101 | 0x3D | 61\nH       | 0b01110110 | 0x76 | 118\nI       | 0b00000110 | 0x06 | 6\nJ       | 0b00011110 | 0x1E | 30\nK       | 0b01110110 | 0x76 | 118\nL       | 0b00111000 | 0x38 | 56\nM       | 0b01010101 | 0x55 | 85\nn       | 0b01010100 | 0x54 | 84\nO       | 0b00111111 | 0x3F | 63\nP       | 0b01110011 | 0x73 | 115\nq       | 0b01100111 | 0x67 | 103\nr       | 0b01010000 | 0x50 | 80\nS       | 0b01101101 | 0x6D | 109\nt       | 0b01111000 | 0x78 | 120\nU       | 0b00111110 | 0x3E | 62\nv       | 0b00011100 | 0x1C | 28\nW       | 0b00101010 | 0x2A | 42\nX       | 0b01110110 | 0x76 | 118\ny       | 0b01101110 | 0x6E | 110\nZ       | 0b01011011 | 0x5B | 91\nblank   | 0b00000000 | 0x00 | 0\n\\-      | 0b01000000 | 0x40 | 64\n\\*      | 0b01100011 | 0x63 | 99\n\n# Methods\n\nGet or set brightness.\n```python\nbrightness(val=None)\n```\n\nWrite one or more segments at a given offset.\n```python\nwrite(segments, pos=0)\n```\n\nConvert a single hex digit (0x00-0x0f) to a segment.\n```python\nencode_digit(digit)\n```\n\nConvert a string to a list of segments.\n```python\nencode_string(string)\n```\n\nConvert a single character to a segment.\n```python\nencode_char(char)\n```\n\nDisplay a number in hexadecimal format 0000 through FFFF.\n```python\nhex(val)\n```\n\nDisplay a number -999 through 9999, right aligned.\n```python\nnumber(num)\n```\n\nDisplay 2 independent numbers on either side of the (optional) colon, with leading zeros.\n```python\nnumbers(num1, num2, colon=True)\n```\n\nDisplay a temperature -9 through 99 followed by degrees C.\n```python\ntemperature(num)\n```\n\nShow a string on the display.\nShorthand for `write(encode_string())`.\nLimited to first 4 characters.\n```python\nshow(string, colon=False)\n```\n\nDisplay a string on the display, scrolling from the right to left, speed adjustable.\nString starts off-screen and scrolls until off-screen at 4 FPS by default.\n```python\nscroll(string, delay=250)\n```\n\n## Parts\n\n* [Grove 4 Digit Display](https://www.seeedstudio.com/grove-4digital-display-p-1198.html) $5.90 USD\n* [Grove Male Jumper Cable](https://www.seeedstudio.com/Grove-4-pin-Male-Jumper-to-Grove-4-pin-Conversion-Cable-%285-PCs-per-Pack%29-p-1565.html) $2.90 USD\n\n## Connections\n\nRaspberry Pi  | 4 Digit Display\n------------- | ---------------\nGPIO5         | CLK\nGPIO4         | DIO\n3V3 (or 5V)   | VCC\nGND           | GND\n\n## Links\n\n* [TM1637 datasheet](http://www.titanmec.com/index.php/en/project/download/id/302.html)\n* [Nokia 5110 version](https://github.com/mcauser/MicroPython-ESP8266-Nokia-5110-Quad-7-segment)\n* [BBC micro:bit version](https://github.com/mcauser/microbit-tm1637)\n\n## License\n\nLicensed under the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepklyon%2Fraspberrypi-tm1637","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdepklyon%2Fraspberrypi-tm1637","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepklyon%2Fraspberrypi-tm1637/lists"}