{"id":187472,"date":"2026-03-12T14:28:33","date_gmt":"2026-03-12T14:28:33","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=187472"},"modified":"2026-03-12T14:58:05","modified_gmt":"2026-03-12T14:58:05","slug":"micropython-esp32-esp8266-tm1637-display","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/micropython-esp32-esp8266-tm1637-display\/","title":{"rendered":"MicroPython: ESP32\/ESP8266 with TM1637 4-Digit LED 7-Segment Display"},"content":{"rendered":"\n<p>Learn how to interface TM1637 4-Digit LED 7-Segment Display with the ESP32 and ESP8266 boards programmed with MicroPython. Learn how to wire the display to the boards and how to program them to display text, numbers, and custom characters. As an example, we&#8217;ll build a weather forecaster display.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-ESP8266-TM1637-MicroPython.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"MicroPython: ESP32\/ESP8266 with TM1637 4-Digit LED 7-Segment Display\" class=\"wp-image-187674\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-ESP8266-TM1637-MicroPython.jpg?w=1920&amp;quality=100&amp;strip=all&amp;ssl=1 1920w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-ESP8266-TM1637-MicroPython.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-ESP8266-TM1637-MicroPython.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-ESP8266-TM1637-MicroPython.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-ESP8266-TM1637-MicroPython.jpg?resize=1536%2C864&amp;quality=100&amp;strip=all&amp;ssl=1 1536w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n<p><strong>Table of Contents<\/strong><\/p>\n\n\n\n<p>In this tutorial, we&#8217;ll cover the following topics:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#intro-TM1637\" title=\"\">Introducing the TM1637 4-Digit LED 7-Segment Display<\/a><\/li>\n\n\n\n<li><a href=\"#TM1637-wiring\" title=\"\">Wiring the TM1637 4-Digit 7-Segment Display to the ESP32 or ESP8266<\/a><\/li>\n\n\n\n<li><a href=\"#tm1637-micropython-library\" title=\"\">TM1637 MicroPython Library<\/a><\/li>\n\n\n\n<li><a href=\"#basic-functions\" title=\"\">Testing the TM1637 Display (Basic Functions)<\/a><\/li>\n\n\n\n<li><a href=\"#weather-forecaster\" title=\"\">TM1637 Display &#8211; Temperature and Weather Forecaster<\/a><\/li>\n<\/ul>\n\n\n\n<p class=\"rntbox rntclblue\"><strong>New to MicroPython?<\/strong> Check out our eBook: <a href=\"https:\/\/randomnerdtutorials.com\/micropython-programming-with-esp32-and-esp8266\/\" title=\"\">MicroPython Programming with ESP32 and ESP8266 eBook (2nd Edition)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>To follow this tutorial, you need MicroPython firmware installed in your ESP32 or ESP8266 boards. You also need an IDE to write and upload the code to your board. We suggest using Thonny IDE or uPyCraft IDE:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Thonny IDE:\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-thonny-micropython-python-ide-esp32-esp8266\/\">Installing and getting started with Thonny IDE<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/flashing-micropython-firmware-esptool-py-esp32-esp8266\/\">Flashing MicroPython Firmware with esptool.py<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>uPyCraft IDE:\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-micropython-esp32-esp8266\/\">Getting Started with uPyCraft IDE<\/a><\/li>\n\n\n\n<li>Install uPyCraft IDE (<a href=\"https:\/\/randomnerdtutorials.com\/install-upycraft-ide-windows-pc-instructions\/\">Windows<\/a>,&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/install-upycraft-ide-mac-os-x-instructions\/\">Mac OS X<\/a>,&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/install-upycraft-ide-linux-ubuntu-instructions\/\">Linux<\/a>)<\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/flash-upload-micropython-firmware-esp32-esp8266\/\">Flash\/Upload MicroPython Firmware to ESP32 and ESP8266<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"intro-TM1637\">Introducing the TM1637 4-Digit LED 7-Segment Display<\/h2>\n\n\n\n<p>The <a href=\"https:\/\/makeradvisor.com\/tools\/tm1637-4-digit-7-segment-display\/\" target=\"_blank\" rel=\"noopener\" title=\"\">TM1637 4-Digit LED 7-Segment display<\/a> is a display module that combines four 7-segment digits on a single display that can be controlled via the TM1637 driver. The particular module we&#8217;re using here has four digits separated by a colon between the second and third digits.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/TM1637-Display.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"TM1637 4-Digit 7-Segment Display\" class=\"wp-image-187306\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/TM1637-Display.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/TM1637-Display.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>There are similar modules with dots between the digits.<\/p>\n\n\n\n<p>There are also similar modules with six 7-segment digits. These require a different library from the one we&#8217;ll use in this tutorial.<\/p>\n\n\n\n<p><strong>Note:<\/strong> I tried to use my six 7-segment display module, but it seems that there are many of those displays that come faulty by default. I couldn&#8217;t make mine work. So, this tutorial will be <em><span style=\"text-decoration: underline;\">only<\/span><\/em> about the one with four digits with a colon in the middle.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Where to Buy?<\/h3>\n\n\n\n<p>You can check our Maker Advisor Tools page to compare the TM1637 4-Digit 7-Segment Display module price in different stores:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/tm1637-4-digit-7-segment-display\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>TM1637 4-Digit 7-Segment Display<\/strong><\/a><\/li>\n<\/ul>\n\n\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"TM1637-wiring\">Wiring the TM1637 4-Digit 7-Segment Display to the ESP32 or ESP8266<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/TM1637-Display-pins.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"TM1637 Display Module Pins\" class=\"wp-image-187430\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/TM1637-Display-pins.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/TM1637-Display-pins.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>Wiring the display to the ESP32 and ESP8266 is quite simple, as it only requires two digital pins: <strong>CLK <\/strong>and <strong>DI\/O<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>TM1637 Display<\/strong><\/td><td><strong>ESP32<\/strong><\/td><td><strong>ESP8266<\/strong><\/td><\/tr><tr><td>CLK<\/td><td>Any digital pin (for example: <span class=\"rnthl rntclblue\">GPIO 19<\/span>)*<\/td><td>Any digital pin (for example: <span class=\"rnthl rntclblue\">GPIO 14<\/span> (D5))*<\/td><\/tr><tr><td>DIO<\/td><td>Any digital pin (for example: <span class=\"rnthl rntclgreen\">GPIO 18<\/span>)*<\/td><td>Any digital pin (for example: <span class=\"rnthl rntclgreen\">GPIO 12<\/span> (D6))*<\/td><\/tr><tr><td>VCC<\/td><td><span class=\"rnthl rntcred\">VIN<\/span><\/td><td><span class=\"rnthl rntcred\">VIN<\/span><\/td><\/tr><tr><td>GND<\/td><td><span class=\"rnthl rntcblack\">GND<\/span><\/td><td><span class=\"rnthl rntcblack\">GND<\/span><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>* you can use any other suitable GPIOs. Check the ESP32 and ESP8266 Pinout Guides:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-pinout-reference-gpios\/\"><strong>ESP32<\/strong> Pinout Reference: Which GPIO pins should you use?<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-s3-devkitc-pinout-guide\/\"><strong>ESP32-S3<\/strong> DevKitC Pinout Reference Guide: GPIOs Explained<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-pinout-reference-gpios\/\"><strong>ESP8266<\/strong> Pinout Reference: Which GPIO pins should you use?<\/a><\/li>\n<\/ul>\n\n\n\n<p><strong>ESP32<\/strong><\/p>\n\n\n\n<p>We&#8217;ll connect the CLK pin to <span class=\"rnthl rntclblue\">GPIO 19<\/span>, and the DIO pin to <span class=\"rnthl rntclgreen\">GPIO 18<\/span>, but you can use another combination of pins.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"713\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-TM1637_wiring.png?resize=900%2C713&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"TM1637 Display - Wiring to the ESP32\" class=\"wp-image-187083\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-TM1637_wiring.png?w=900&amp;quality=100&amp;strip=all&amp;ssl=1 900w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-TM1637_wiring.png?resize=300%2C238&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-TM1637_wiring.png?resize=768%2C608&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/figure><\/div>\n\n\n<p><strong>ESP8266<\/strong><\/p>\n\n\n\n<p>We&#8217;ll connect the CLK pin to <span class=\"rnthl rntclblue\">GPIO 14<\/span> (D5), and the DIO pin to <span class=\"rnthl rntclgreen\">GPIO 12<\/span> (D6), but you can use a different combination of pins.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"927\" height=\"599\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP8266-TM1637.png?resize=927%2C599&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"TM1637 Display - Wiring to the ESP8266\" class=\"wp-image-187675\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP8266-TM1637.png?w=927&amp;quality=100&amp;strip=all&amp;ssl=1 927w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP8266-TM1637.png?resize=300%2C194&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP8266-TM1637.png?resize=768%2C496&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 927px) 100vw, 927px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"tm1637-micropython-library\">TM1637 MicroPython Library<\/h2>\n\n\n\n<p>To make it easy to interface with the TM1637 Display, we&#8217;ll use a forked version of this <a href=\"https:\/\/github.com\/mcauser\/micropython-tm1637\" target=\"_blank\" rel=\"noopener\" title=\"\">TM1637 MicroPython module<\/a>.<\/p>\n\n\n\n<p>Follow the next steps to install it.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/raw.githubusercontent.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/refs\/heads\/master\/Projects\/ESP-MicroPython\/tm1637\/tm1637.py\" target=\"_blank\" rel=\"noopener\" title=\"\">Click here to download our forked version of the <em>tm1637.py<\/em> file<\/a>.<\/li>\n\n\n\n<li>Copy the code to a file on Thonny IDE;<\/li>\n\n\n\n<li>Go to&nbsp;<strong>File<\/strong>&nbsp;&gt;&nbsp;<strong>Save as\u2026<\/strong>&nbsp;and select MicroPython Device;<\/li>\n\n\n\n<li>Save the file with the name&nbsp;<strong><em>tm1637.py<\/em><\/strong> (don\u2019t change the name).<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"545\" height=\"327\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/tm1637-py-upload-file-thonny-ide-micropython.jpg?resize=545%2C327&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Upload TM1637.py file to Micropython device - Thonny IDE\" class=\"wp-image-187580\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/tm1637-py-upload-file-thonny-ide-micropython.jpg?w=545&amp;quality=100&amp;strip=all&amp;ssl=1 545w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/tm1637-py-upload-file-thonny-ide-micropython.jpg?resize=300%2C180&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 545px) 100vw, 545px\" \/><\/figure><\/div>\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-python\">&quot;&quot;&quot;\nMicroPython TM1637 quad 7-segment LED display driver\nhttps:\/\/github.com\/mcauser\/micropython-tm1637\n\nMIT License\nCopyright (c) 2016-2023 Mike Causer\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the &quot;Software&quot;), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and\/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n&quot;&quot;&quot;\n\n__version__ = '1.3.0'\n\nfrom micropython import const\nfrom machine import Pin\nfrom time import sleep_us, sleep_ms\n\nTM1637_CMD1 = const(64)  # 0x40 data command\nTM1637_CMD2 = const(192) # 0xC0 address command\nTM1637_CMD3 = const(128) # 0x80 display control command\nTM1637_DSP_ON = const(8) # 0x08 display on\nTM1637_DELAY = const(10) # 10us delay between clk\/dio pulses\nTM1637_MSB = const(128)  # msb is the decimal point or the colon depending on your display\n\n# 0-9, a-z, blank, dash, star\n_SEGMENTS = bytearray(b'\\x3F\\x06\\x5B\\x4F\\x66\\x6D\\x7D\\x07\\x7F\\x6F\\x77\\x7C\\x39\\x5E\\x79\\x71\\x3D\\x76\\x06\\x1E\\x76\\x38\\x55\\x54\\x3F\\x73\\x67\\x50\\x6D\\x78\\x3E\\x1C\\x2A\\x76\\x6E\\x5B\\x00\\x40\\x63')\n\nclass TM1637(object):\n    &quot;&quot;&quot;Library for quad 7-segment LED modules based on the TM1637 LED driver.&quot;&quot;&quot;\n    def __init__(self, clk, dio, brightness=7):\n        self.clk = clk\n        self.dio = dio\n\n        if not 0 &lt;= brightness &lt;= 7:\n            raise ValueError(&quot;Brightness out of range&quot;)\n        self._brightness = brightness\n\n        self.clk.init(Pin.OUT, value=0)\n        self.dio.init(Pin.OUT, value=0)\n        sleep_us(TM1637_DELAY)\n\n        self._write_data_cmd()\n        self._write_dsp_ctrl()\n\n    def _start(self):\n        self.dio(0)\n        sleep_us(TM1637_DELAY)\n        self.clk(0)\n        sleep_us(TM1637_DELAY)\n\n    def _stop(self):\n        self.dio(0)\n        sleep_us(TM1637_DELAY)\n        self.clk(1)\n        sleep_us(TM1637_DELAY)\n        self.dio(1)\n\n    def _write_data_cmd(self):\n        # automatic address increment, normal mode\n        self._start()\n        self._write_byte(TM1637_CMD1)\n        self._stop()\n\n    def _write_dsp_ctrl(self):\n        # display on, set brightness\n        self._start()\n        self._write_byte(TM1637_CMD3 | TM1637_DSP_ON | self._brightness)\n        self._stop()\n\n    def _write_byte(self, b):\n        for i in range(8):\n            self.dio((b &gt;&gt; i) &amp; 1)\n            sleep_us(TM1637_DELAY)\n            self.clk(1)\n            sleep_us(TM1637_DELAY)\n            self.clk(0)\n            sleep_us(TM1637_DELAY)\n        self.clk(0)\n        sleep_us(TM1637_DELAY)\n        self.clk(1)\n        sleep_us(TM1637_DELAY)\n        self.clk(0)\n        sleep_us(TM1637_DELAY)\n\n    def brightness(self, val=None):\n        &quot;&quot;&quot;Set the display brightness 0-7.&quot;&quot;&quot;\n        # brightness 0 = 1\/16th pulse width\n        # brightness 7 = 14\/16th pulse width\n        if val is None:\n            return self._brightness\n        if not 0 &lt;= val &lt;= 7:\n            raise ValueError(&quot;Brightness out of range&quot;)\n\n        self._brightness = val\n        self._write_data_cmd()\n        self._write_dsp_ctrl()\n\n    def write(self, segments, pos=0):\n        &quot;&quot;&quot;Display up to 6 segments moving right from a given position.\n        The MSB in the 2nd segment controls the colon between the 2nd\n        and 3rd segments.&quot;&quot;&quot;\n        if not 0 &lt;= pos &lt;= 5:\n            raise ValueError(&quot;Position out of range&quot;)\n        self._write_data_cmd()\n        self._start()\n\n        self._write_byte(TM1637_CMD2 | pos)\n        for seg in segments:\n            self._write_byte(seg)\n        self._stop()\n        self._write_dsp_ctrl()\n\n    def encode_digit(self, digit):\n        &quot;&quot;&quot;Convert a character 0-9, a-f to a segment.&quot;&quot;&quot;\n        return _SEGMENTS[digit &amp; 0x0f]\n\n    def encode_string(self, string):\n        &quot;&quot;&quot;Convert an up to 4 character length string containing 0-9, a-z,\n        space, dash, star to an array of segments, matching the length of the\n        source string.&quot;&quot;&quot;\n        segments = bytearray(len(string))\n        for i in range(len(string)):\n            segments[i] = self.encode_char(string[i])\n        return segments\n\n    def encode_char(self, char):\n        &quot;&quot;&quot;Convert a character 0-9, a-z, space, dash or star to a segment.&quot;&quot;&quot;\n        o = ord(char)\n        if o == 32:\n            return _SEGMENTS[36] # space\n        if o == 42:\n            return _SEGMENTS[38] # star\/degrees\n        if o == 45:\n            return _SEGMENTS[37] # dash\n        if o &gt;= 65 and o &lt;= 90:\n            return _SEGMENTS[o-55] # uppercase A-Z\n        if o &gt;= 97 and o &lt;= 122:\n            return _SEGMENTS[o-87] # lowercase a-z\n        if o &gt;= 48 and o &lt;= 57:\n            return _SEGMENTS[o-48] # 0-9\n        raise ValueError(&quot;Character out of range: {:d} '{:s}'&quot;.format(o, chr(o)))\n\n    def hex(self, val):\n        &quot;&quot;&quot;Display a hex value 0x0000 through 0xffff, right aligned.&quot;&quot;&quot;\n        string = '{:04x}'.format(val &amp; 0xffff)\n        self.write(self.encode_string(string))\n\n    def number(self, num):\n        &quot;&quot;&quot;Display a numeric value -999 through 9999, right aligned.&quot;&quot;&quot;\n        # limit to range -999 to 9999\n        num = max(-999, min(num, 9999))\n        string = '{0: &gt;4d}'.format(num)\n        self.write(self.encode_string(string))\n\n    def numbers(self, num1, num2, colon=True):\n        &quot;&quot;&quot;Display two numeric values -9 through 99, with leading zeros\n        and separated by a colon.&quot;&quot;&quot;\n        num1 = max(-9, min(num1, 99))\n        num2 = max(-9, min(num2, 99))\n        segments = self.encode_string('{0:0&gt;2d}{1:0&gt;2d}'.format(num1, num2))\n        if colon:\n            segments[1] |= 0x80 # colon on\n        self.write(segments)\n\n    def temperature(self, num):\n        if num &lt; -9:\n            self.show('lo') # low\n        elif num &gt; 99:\n            self.show('hi') # high\n        else:\n            string = '{0: &gt;2d}'.format(num)\n            self.write(self.encode_string(string))\n        self.write([_SEGMENTS[38], _SEGMENTS[12]], 2) # degrees C\n        \n    def temperature_f(self, num):\n        if num &lt; -9:\n            self.show('lo') # low\n        elif num &gt; 99:\n            self.show('hi') # high\n        else:\n            string = '{0: &gt;2d}'.format(num)\n            self.write(self.encode_string(string))\n        self.write([_SEGMENTS[38], _SEGMENTS[15]], 2) # degrees F\n\n    def show(self, string, colon=False):\n        segments = self.encode_string(string)\n        if len(segments) &gt; 1 and colon:\n            segments[1] |= 128\n        self.write(segments[:4])\n\n    def scroll(self, string, delay=250):\n        segments = string if isinstance(string, list) else self.encode_string(string)\n        data = [0] * 8\n        data[4:0] = list(segments)\n        for i in range(len(segments) + 5):\n            self.write(data[0+i:4+i])\n            sleep_ms(delay)\n\n\nclass TM1637Decimal(TM1637):\n    &quot;&quot;&quot;Library for quad 7-segment LED modules based on the TM1637 LED driver.\n\n    This class is meant to be used with decimal display modules (modules\n    that have a decimal point after each 7-segment LED).\n    &quot;&quot;&quot;\n\n    def encode_string(self, string):\n        &quot;&quot;&quot;Convert a string to LED segments.\n\n        Convert an up to 4 character length string containing 0-9, a-z,\n        space, dash, star and '.' to an array of segments, matching the length of\n        the source string.&quot;&quot;&quot;\n        segments = bytearray(len(string.replace('.','')))\n        j = 0\n        for i in range(len(string)):\n            if string[i] == '.' and j &gt; 0:\n                segments[j-1] |= TM1637_MSB\n                continue\n            segments[j] = self.encode_char(string[i])\n            j += 1\n        return segments\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP-MicroPython\/tm1637\/tm1637.py\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>With the module loaded to the board, you can now use the library functionalities in your code to interface with the TM1637 display.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"basic-functions\">Testing the TM1637 Display (Basic Functions)<\/h2>\n\n\n\n<p>The following example shows most of the functions supported by the library. This is a modified and simplified version of the example provided by the library.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-python\"># Rui Santos &amp; Sara Santos - Random Nerd Tutorials\n# Complete project details at https:\/\/RandomNerdTutorials.com\/micropython-esp32-esp8266-tm1637-display\/\nimport tm1637\nfrom machine import Pin\nfrom time import sleep\n\n# Initialize display (adjust pins if needed)\ndisplay = tm1637.TM1637(clk=Pin(19), dio=Pin(18))\n# Example for ESP8266 boards:\n#display = tm1637.TM1637(clk=Pin(14), dio=Pin(12))\n\n# Set display brightness\ndisplay.brightness(7)\n\nwhile True:\n        \n    # all LEDS on &quot;88:88&quot;\n    display.write([127, 255, 127, 127])\n    sleep(1)\n\n    # all LEDS off\n    display.write([0, 0, 0, 0])\n    sleep(1)\n\n    # show &quot;0123&quot;\n    display.write([63, 6, 91, 79])\n    sleep(1)\n\n    # show &quot;COOL&quot;\n    display.write([0b00111001, 0b00111111, 0b00111111, 0b00111000])\n    sleep(1)\n\n    # show &quot;HELP&quot;\n    display.show('help')\n    sleep(1)\n\n    # display &quot;dEAd&quot;, &quot;bEEF&quot;\n    display.hex(0xdead)\n    sleep(1)\n    display.hex(0xbeef)\n    sleep(1)\n\n    # show &quot;12:59&quot;\n    display.numbers(12, 59)\n    sleep(1)\n\n    # show &quot;-123&quot;\n    display.number(-123)\n    sleep(1)\n\n    # show temperature '24*C'\n    display.temperature(24)\n    sleep(1)\n    \n    # show temperature '75*F'\n    display.temperature_f(75)\n    sleep(1)\n\n    # display scrolling text\n    display.scroll('Random Nerd Tutorials', delay=500)\n    sleep(1)\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP-MicroPython\/tm1637\/tm1637_basic_functions.py\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>Now, let&#8217;s take a quick look at how the code works to understand how to use the library functions to control the display.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Initialize the Display<\/h3>\n\n\n\n<p>The following line initializes the display. You can modify it to use different pins.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>display = tm1637.TM1637(clk=Pin(19), dio=Pin(18))<\/code><\/pre>\n\n\n\n<p>If you&#8217;re using an ESP8266 board, you can use the following combination of pins:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>display = tm1637.TM1637(clk=Pin(14), dio=Pin(12))<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Set the Brightness<\/h3>\n\n\n\n<p>To set the display brightness, you just need to use the <span class=\"rnthl rntliteral\">brightness()<\/span> method on the <span class=\"rnthl rntliteral\">display<\/span> object. Pass a number between 0 (minimum brightness) and 7 (maximum brightness).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>display.brightness(7)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Writing Segments<\/h3>\n\n\n\n<p>You can use the <span class=\"rnthl rntliteral\">write()<\/span> method on the <span class=\"rnthl rntliteral\">display<\/span> object to control individual segments of each character.<\/p>\n\n\n\n<p>The TM1637 display comes with four 7-segment display digits. You can manually control individual segments of each digit with the <span class=\"rnthl rntliteral\">write()<\/span> method on the <span class=\"rnthl rntliteral\">display<\/span> object.<\/p>\n\n\n\n<p>One byte (7 lower bits) for each segment. The 8th bit (MSB) is for the colon and only on the 2nd segment.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"144\" height=\"259\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/7-segment-display-labeled.png?resize=144%2C259&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"7-segment display\" class=\"wp-image-187096\"\/><\/figure><\/div>\n\n\n<p>For example:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>segment<\/strong><\/td><td><strong>bit<\/strong><\/td><\/tr><tr><td>A<\/td><td>0<\/td><\/tr><tr><td>B<\/td><td>1<\/td><\/tr><tr><td>C<\/td><td>2<\/td><\/tr><tr><td>D<\/td><td>3<\/td><\/tr><tr><td>E<\/td><td>4<\/td><\/tr><tr><td>F<\/td><td>5<\/td><\/tr><tr><td>G<\/td><td>6<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Bit 1 turns a segment ON, and bit 0 turns a segment off.<\/p>\n\n\n\n<p>For example, to turn on segments A, B, and C, you&#8217;d have a byte like <span class=\"rnthl rntliteral\">0b0000111<\/span>.<\/p>\n\n\n\n<p>The byte starts with the G and ends with the A. For example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span class=\"rnthl rntliteral\">0b0000110<\/span> turns segments <strong>C<\/strong> and <strong>B<\/strong> on.<\/li>\n<\/ul>\n\n\n\n<p>You can use <span class=\"rnthl rntliteral\">0b0000110<\/span> or the corresponding hex or decimal number. <a href=\"https:\/\/github.com\/mcauser\/micropython-tm1637?tab=readme-ov-file#seven-segment-font\" target=\"_blank\" rel=\"noopener\" title=\"\">See the table provided by the library documentation<\/a>.<\/p>\n\n\n\n<p>The demo shows different examples:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># all LEDS on \"88:88\"\ndisplay.write(&#091;127, 255, 127, 127])\nsleep(1)\n\n# all LEDS off\ndisplay.write(&#091;0, 0, 0, 0])\nsleep(1)\n\n# show \"0123\"\ndisplay.write(&#091;63, 6, 91, 79])\nsleep(1)\n\n# show \"COOL\"\ndisplay.write(&#091;0b00111001, 0b00111111, 0b00111111, 0b00111000])\nsleep(1)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Display Strings<\/h3>\n\n\n\n<p>To display strings, use the <span class=\"rnthl rntliteral\">show()<\/span> method and pass as an argument the string you want to display.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># show \"HELP\"\ndisplay.show('help')<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Display a Number<\/h3>\n\n\n\n<p>Use the <span class=\"rnthl rntliteral\">numbers()<\/span> method if you want to display two numbers (with two digits) on each side of the colon. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># show \"12:59\"\ndisplay.numbers(12, 59)<\/code><\/pre>\n\n\n\n<p>To display a number, use the <span class=\"rnthl rntliteral\">number()<\/span> method. It accepts negative numbers. The number shouldn&#8217;t have more than four digits.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># show \"-123\"\ndisplay.number(-123)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Display Temperature Values<\/h3>\n\n\n\n<p>If you want to display temperature values (with two digits) with the \u00baC and \u00baF symbols, you can use the <span class=\"rnthl rntliteral\">temperature()<\/span> and <span class=\"rnthl rntliteral\">temperature_f()<\/span> functions on the <span class=\"rnthl rntliteral\">display<\/span> object. For example, in the code:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># show temperature '24*C'\ndisplay.temperature(24)\nsleep(1)\n    \n# show temperature '75*F'\ndisplay.temperature_f(75)\nsleep(1)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Display Scrolling Text<\/h3>\n\n\n\n<p>There is a very useful function if you want to display text with more than four characters. The <span class=\"rnthl rntliteral\">scroll()<\/span> function allows you to scroll a String on the display from right to left with adjustable speed.<\/p>\n\n\n\n<p>The first argument is the string you want to display, and the second argument is the offset in milliseconds. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># display scrolling text\ndisplay.scroll('Random Nerd Tutorials', delay=500)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Demonstration<\/h3>\n\n\n\n<p>Run or upload (<strong>File <\/strong>&gt; <strong>Save as<\/strong> &gt; <strong>Micropython device<\/strong> &gt; save the file with the name <em>main.py<\/em>) the code to your board using Thonny IDE.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"470\" height=\"114\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/10\/image.png?resize=470%2C114&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Thonny IDE Run Code\" class=\"wp-image-163213\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/10\/image.png?w=470&amp;quality=100&amp;strip=all&amp;ssl=1 470w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/10\/image.png?resize=300%2C73&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 470px) 100vw, 470px\" \/><\/figure><\/div>\n\n\n<p>Don&#8217;t forget that you must have uploaded the <em>tm1637.py<\/em> library previously.<\/p>\n\n\n\n<p>The display will be running the demo code, showing the different use cases.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-Micropython-TM1637-Display-Temperature.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 with TM1637 Display Temperature\" class=\"wp-image-187584\" style=\"width:746px;height:auto\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-Micropython-TM1637-Display-Temperature.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-Micropython-TM1637-Display-Temperature.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<div class=\"wp-block-jetpack-tiled-gallery aligncenter is-style-rectangular\"><div class=\"\"><div class=\"tiled-gallery__gallery\"><div class=\"tiled-gallery__row\"><div class=\"tiled-gallery__col\" style=\"flex-basis:50.00000%\"><figure class=\"tiled-gallery__item\"><img decoding=\"async\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/MicroPython-TM1637-Display-Time.jpg?strip=info&#038;w=600&#038;ssl=1 600w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/MicroPython-TM1637-Display-Time.jpg?strip=info&#038;w=750&#038;ssl=1 750w\" alt=\"TM1637 MicroPython display time\" data-height=\"422\" data-id=\"187586\" data-link=\"https:\/\/randomnerdtutorials.com\/?attachment_id=187586#main\" data-url=\"https:\/\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/MicroPython-TM1637-Display-Time.jpg\" data-width=\"750\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/MicroPython-TM1637-Display-Time.jpg?ssl=1\" data-amp-layout=\"responsive\"\/><\/figure><\/div><div class=\"tiled-gallery__col\" style=\"flex-basis:50.00000%\"><figure class=\"tiled-gallery__item\"><img decoding=\"async\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/Micropython-TM1637-Display-Numbers.jpg?strip=info&#038;w=600&#038;ssl=1 600w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/Micropython-TM1637-Display-Numbers.jpg?strip=info&#038;w=750&#038;ssl=1 750w\" alt=\"TM1637 MicroPython display numbers\" data-height=\"422\" data-id=\"187587\" data-link=\"https:\/\/randomnerdtutorials.com\/?attachment_id=187587#main\" data-url=\"https:\/\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/Micropython-TM1637-Display-Numbers.jpg\" data-width=\"750\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/Micropython-TM1637-Display-Numbers.jpg?ssl=1\" data-amp-layout=\"responsive\"\/><\/figure><\/div><\/div><\/div><\/div><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"weather-forecaster\">TM1637 Display &#8211; Temperature and Weather Forecaster<\/h2>\n\n\n\n<p>In this section, we&#8217;ll use the TM1637 Display in a practical application. We&#8217;ll display the current temperature, both in degrees Celsius and Fahrenheit, and the current weather condition.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">WeatherAPI<\/h3>\n\n\n\n<p>We&#8217;ll get that data from the <a href=\"https:\/\/www.weatherapi.com\/\" target=\"_blank\" rel=\"noopener\" title=\"\">WeatherAPI<\/a> by making an HTTP request to the proper URL. To learn more about HTPP requests with Micropython, check this tutorial: <a href=\"https:\/\/randomnerdtutorials.com\/micropython-http-get-requests-esp32-esp8266\/\">MicroPython: HTTP GET Requests with ESP32\/ESP8266<\/a>.<\/p>\n\n\n\n<p>This API is free and provides useful information about the weather in almost any location in the world.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"350\" height=\"108\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/weather-forecaster.jpg?resize=350%2C108&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Weather forecaster example\" class=\"wp-image-159901\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/weather-forecaster.jpg?w=350&amp;quality=100&amp;strip=all&amp;ssl=1 350w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/weather-forecaster.jpg?resize=300%2C93&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 350px) 100vw, 350px\" \/><\/figure><\/div>\n\n\n<p>We\u2019ll get data about the temperature and weather conditions and display them on the TM1637 display. You can easily adjust the code to display more information.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Getting Your API Key<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to the Weather API website: <a href=\"https:\/\/www.weatherapi.com\/\" target=\"_blank\" rel=\"noopener\" title=\"\">weatherapi.com<\/a><\/li>\n\n\n\n<li>Signup to create an account or login if you already have one.<\/li>\n\n\n\n<li>After verifying your account, login into your account.<\/li>\n\n\n\n<li>On your dashboard at <a href=\"https:\/\/www.weatherapi.com\/my\/\" target=\"_blank\" rel=\"noopener\" title=\"\">weatherapi.com\/my\/<\/a> , you\u2019ll find your API key.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"242\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/11\/Weather-API-Key.png?resize=750%2C242&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Weather APi Key\" class=\"wp-image-182455\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/11\/Weather-API-Key.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/11\/Weather-API-Key.png?resize=300%2C97&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>Copy the API key to a safe place because you\u2019ll need it later.<\/p>\n\n\n\n<p>To pull information on the weather in your chosen location, enter the following URL in your web browser, but insert your location and API key in the right places:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">https:\/\/api.weatherapi.com\/v1\/current.json?q=<strong>YOUR_LOCATION<\/strong>+&amp;key=<strong>YOUR_API_KEY<\/strong><\/pre>\n\n\n\n<p>For example, in my case:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;api.weatherapi.com\/v1\/current.json?q=Oporto+&amp;key=d1578a064b07xxxc917164350240106<\/code><\/pre>\n\n\n\n<p>Copy your URL and paste it into your browser, and the API will return information corresponding to your local weather. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>{\n  \"location\": {\n    \"name\": \"Oporto\",\n    \"region\": \"Porto\",\n    \"country\": \"Portugal\",\n    \"lat\": 41.15,\n    \"lon\": -8.6167,\n    \"tz_id\": \"Europe\/Lisbon\",\n    \"localtime_epoch\": 1762168698,\n    \"localtime\": \"2025-11-03 11:18\"\n  },\n  \"current\": {\n    \"last_updated_epoch\": 1762168500,\n    \"last_updated\": \"2025-11-03 11:15\",\n    \"temp_c\": 16.1,\n    \"temp_f\": 61,\n    \"is_day\": 1,\n    \"condition\": {\n      \"text\": \"Partly Cloudy\",\n      \"icon\": \"\/\/cdn.weatherapi.com\/weather\/64x64\/day\/116.png\",\n      \"code\": 1003\n    },\n    \"wind_mph\": 4,\n    \"wind_kph\": 6.5,\n    \"wind_degree\": 142,\n    \"wind_dir\": \"SE\",\n    \"pressure_mb\": 1023,\n    \"pressure_in\": 30.21,\n    \"precip_mm\": 0,\n    \"precip_in\": 0,\n    \"humidity\": 68,\n    \"cloud\": 0,\n    \"feelslike_c\": 16.1,\n    \"feelslike_f\": 61,\n    \"windchill_c\": 14.8,\n    \"windchill_f\": 58.6,\n    \"heatindex_c\": 14.7,\n    \"heatindex_f\": 58.4,\n    \"dewpoint_c\": 7.5,\n    \"dewpoint_f\": 45.5,\n    \"vis_km\": 10,\n    \"vis_miles\": 6,\n    \"uv\": 2.3,\n    \"gust_mph\": 5.1,\n    \"gust_kph\": 8.2\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"rntbox rntclgray\">For more information about the API, check the docs: <a href=\"https:\/\/www.weatherapi.com\/docs\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Weather API Documentation<\/a>.<\/p>\n\n\n\n<p>We&#8217;ll only get the information under <span class=\"rnthl rntliteral\">temp_c<\/span>, <span class=\"rnthl rntliteral\">temp_f<\/span>, and <span class=\"rnthl rntliteral\">text<\/span>(weather description) under the <span class=\"rnthl rntliteral\">current<\/span> node.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Code<\/h3>\n\n\n\n<p>The following code gets the data from the API and displays the current temperature and weather description on the display.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-python\"># Rui Santos &amp; Sara Santos - Random Nerd Tutorials\n# Complete project details at https:\/\/RandomNerdTutorials.com\/micropython-esp32-esp8266-tm1637-display\/\nimport network\nimport time\nimport requests\nimport tm1637\nfrom machine import Pin, Timer\n\n# Initialize display (adjust pins if needed)\ndisplay = tm1637.TM1637(clk=Pin(21), dio=Pin(20))\n\n# Wi-Fi credentials\nssid = 'REPLACE_WITH_YOUR_SSID'\npassword = 'REPLACE_WITH_YOUR_PASSWORD'\n\napi_key = 'REPLACE_WITH_YOUR_weatherapi'\nlocation ='Oporto'   # Documentation https:\/\/www.weatherapi.com\/docs\/\n\n# Request URL\nurl = f'https:\/\/api.weatherapi.com\/v1\/current.json?q={location}+&amp;key={api_key}'\n\n# Connect to network\ndef connect_wifi(ssid, password):\n    # Connect to your network\n    station = network.WLAN(network.STA_IF)\n    station.active(True)\n    station.connect(ssid, password)\n    \n    # Wait for connection\n    timeout = 10\n    while not station.isconnected() and timeout &gt; 0:\n        time.sleep(1)\n        timeout -= 1\n    \n    if station.isconnected():\n        print('Connection successful')\n        print(station.ifconfig())\n        return True\n    else:\n        print('Connection failed - timeout reached')\n        return False\n    \ndef getWeather(timer):\n    if connect_wifi(ssid, password):\n        try:\n            # Make the request\n            response = requests.get(url)\n            #Print the response code\n            print('Response code: ', response.status_code)\n            \n            # Get response content\n            weather = response.json()\n            # Close the request\n            response.close()\n            \n            # Print bulk weather data\n            print('Weather JSON: ', weather)\n            \n            # Declare these variables as globals\n            global weather_description, temperature_c, temperature_f\n\n            # Get specific weather data\n            weather_description = weather['current']['condition']['text']\n            print('Current weather: ', weather_description)\n            \n            # Temperature and humidity\n            temperature_c = weather['current']['temp_c']\n            temperature_f = weather['current']['temp_f']\n            print(f'Temperature in Celsius: {temperature_c:.2f}')\n            print(f'Temperature in Fahrenheit: {temperature_f:.2f}')            \n\n        except Exception as e:\n            # Handle any exceptions during the request\n            print('Error during request:', e)\n            display.show('erro')\n            \n# Get Weather for the first time\ngetWeather(0)\n\n# Create a periodic timer that gets new data from the API\napi_timer = Timer()\napi_timer.init(mode=Timer.PERIODIC, period=3600000, callback=getWeather)\n\nwhile True:\n    display.scroll(weather_description)\n    time.sleep(1)\n    display.temperature(round(temperature_c))\n    time.sleep(5)\n    display.temperature_f(round(temperature_f))\n    time.sleep(5)\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP-MicroPython\/tm1637\/tm1637_display_weather.py\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How Does the Code Work?<\/h3>\n\n\n\n<p>Import the required modules, including the <span class=\"rnthl rntliteral\">requests<\/span> library to make HTTP requests to get the weather data.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>import network\nimport time\nimport requests\nimport tm1637\nfrom machine import Pin, Timer  <\/code><\/pre>\n\n\n\n<p>Initialize the display on the proper GPIOs.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># Initialize display (adjust pins if needed)\ndisplay = tm1637.TM1637(clk=Pin(19), dio=Pin(18))<\/code><\/pre>\n\n\n\n<p>Insert your network credentials on the following lines so that the ESP can connect to your network to get weather data.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># Wi-Fi credentials\nssid = 'REPLACE_WITH_YOUR_SSID'\npassword = 'REPLACE_WITH_YOUR_PASSWORD'<\/code><\/pre>\n\n\n\n<p>Insert your WeatherAPI API key and the location for which you want to retrieve the data.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>api_key = 'REPLACE_WITH_YOUR_API_KEY'\nlocation ='REPLACE_WITH_YOUR_LOCATION'<\/code><\/pre>\n\n\n\n<p>We save the request URL in the <span class=\"rnthl rntliteral\">url<\/span> variable. This is an <span class=\"rnthl rntliteral\">f<\/span> string with placeholders so that the URL is updated with your details at run time.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># Request URL\nurl = f'https:\/\/api.weatherapi.com\/v1\/current.json?q={location}+&amp;key={api_key}'<\/code><\/pre>\n\n\n\n<p>The <span class=\"rnthl rntliteral\">connect_wifi()<\/span> function connects your board to your network. It returns <span class=\"rnthl rntliteral\">true<\/span> if successful, or <span class=\"rnthl rntliteral\">false<\/span> otherwise.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># Connect to network\ndef connect_wifi(ssid, password):\n    # Connect to your network\n    station = network.WLAN(network.STA_IF)\n    station.active(True)\n    station.connect(ssid, password)\n    \n    # Wait for connection\n    timeout = 10\n    while not station.isconnected() and timeout &gt; 0:\n        time.sleep(1)\n        timeout -= 1\n    \n    if station.isconnected():\n        print('Connection successful')\n        print(station.ifconfig())\n        return True\n    else:\n        print('Connection failed - timeout reached')\n        return False<\/code><\/pre>\n\n\n\n<p>Then, we create a function called <span class=\"rnthl rntliteral\">getWeather()<\/span> that will be called periodically by a timer (hence, we need to have an argument of type <span class=\"rnthl rntliteral\">timer<\/span>). <a href=\"https:\/\/randomnerdtutorials.com\/micropython-timer-interrupts-ep32-esp8266\/\" title=\"\">Learn more about MicroPython timers here<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>def getWeather(timer):\n    if connect_wifi(ssid, password):\n        try:\n            # Make the request\n            response = requests.get(url)\n            #Print the response code\n            print('Response code: ', response.status_code)\n            \n            # Get response content\n            weather = response.json()\n            # Close the request\n            response.close()\n            \n            # Print bulk weather data\n            print('Weather JSON: ', weather)\n            \n            # Declare these variables as globals\n            global weather_description, temperature_c, temperature_f\n\n            # Get specific weather data\n            weather_description = weather&#091;'current']&#091;'condition']&#091;'text']\n            print('Current weather: ', weather_description)\n            \n            # Temperature and humidity\n            temperature_c = weather&#091;'current']&#091;'temp_c']\n            temperature_f = weather&#091;'current']&#091;'temp_f']\n            print(f'Temperature in Celsius: {temperature_c:.2f}')\n            print(f'Temperature in Fahrenheit: {temperature_f:.2f}')            \n\n        except Exception as e:\n            # Handle any exceptions during the request\n            print('Error during request:', e)\n            display.show('erro')<\/code><\/pre>\n\n\n\n<p>We first check if we are successfully connected to the internet.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>if connect_wifi(ssid, password):<\/code><\/pre>\n\n\n\n<p>Then, we make the request and read the JSON response.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>try:\n    # Make the request\n    response = requests.get(url)\n    #Print the response code\n    print('Response code: ', response.status_code)\n            \n    # Get response content\n    weather = response.json()\n    # Close the request\n    response.close()<\/code><\/pre>\n\n\n\n<p>After that, we create global variables <span class=\"rnthl rntliteral\">weather_description<\/span>, <span class=\"rnthl rntliteral\">temperature_c<\/span> and <span class=\"rnthl rntliteral\">temperature_f<\/span> to save the data we&#8217;re looking for.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># Declare these variables as globals\nglobal weather_description, temperature_c, temperature_f<\/code><\/pre>\n\n\n\n<p>We get the weather data we want and save them on the corresponding variables.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># Get specific weather data\nweather_description = weather&#091;'current']&#091;'condition']&#091;'text']\nprint('Current weather: ', weather_description)\n            \n# Temperature and humidity\ntemperature_c = weather&#091;'current']&#091;'temp_c']\ntemperature_f = weather&#091;'current']&#091;'temp_f']\nprint(f'Temperature in Celsius: {temperature_c:.2f}')\nprint(f'Temperature in Fahrenheit: {temperature_f:.2f}') <\/code><\/pre>\n\n\n\n<p>After that, we call the <span class=\"rnthl rntliteral\">getWeather()<\/span> function for the first time when the code first turns.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># Get Weather for the first time\ngetWeather(0)<\/code><\/pre>\n\n\n\n<p>Then, we create a timer that will call the <span class=\"rnthl rntliteral\">getWeather()<\/span> function every 3600000 milliseconds (one hour) to get the latest weather data from the API.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># Create a periodic timer that gets new data from the API\napi_timer = Timer (1)\napi_timer.init(mode=Timer.PERIODIC, period=3600000, callback=getWeather)<\/code><\/pre>\n\n\n\n<p class=\"rntbox rntclgreen\">Learn more about creating timers: <a href=\"https:\/\/randomnerdtutorials.com\/micropython-timer-interrupts-ep32-esp8266\/\">MicroPython: Timer Interrupts with the ESP32\/ESP8266<\/a>.<\/p>\n\n\n\n<p>Finally, we create a <span class=\"rnthl rntliteral\">while True<\/span> loop to continuously display wheather data. We display the weather description, the temperature in Celsius, and the temperature in Fahrenheit.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>while True:<\/code><\/pre>\n\n\n\n<p>Notice that for the weather description, we use the <span class=\"rnthl rntliteral\">scroll()<\/span> function.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>display.scroll(weather_description)\ntime.sleep(1)<\/code><\/pre>\n\n\n\n<p>To display the temperature in Celsius, we call the <span class=\"rnthl rntliteral\">temperature()<\/span> function. We need to round the temperature because the function only accepts numbers with two digits.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>display.temperature(round(temperature_c))\ntime.sleep(5)<\/code><\/pre>\n\n\n\n<p>Finally, we call the <span class=\"rnthl rntliteral\">temperature_f()<\/span> function to display the temperature in Fahrenheit.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>display.temperature_f(round(temperature_f))\ntime.sleep(5)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Demonstration<\/h2>\n\n\n\n<p>Make sure you&#8217;ve inserted your network credentials, your API key and location on the code.<\/p>\n\n\n\n<p>Run or upload (<strong>File <\/strong>&gt; <strong>Save as<\/strong> &gt; <strong>Micropython device<\/strong> &gt; save the file with the name <em>main.py<\/em>) the code to your board using Thonny IDE.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"470\" height=\"114\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/10\/image.png?resize=470%2C114&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Thonny IDE Run Code\" class=\"wp-image-163213\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/10\/image.png?w=470&amp;quality=100&amp;strip=all&amp;ssl=1 470w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/10\/image.png?resize=300%2C73&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 470px) 100vw, 470px\" \/><\/figure><\/div>\n\n\n<p>Don&#8217;t forget that you must have uploaded the <em>tm1637.py<\/em> library previously.<\/p>\n\n\n\n<p>You&#8217;ll get the current temperature for your location in Celsius and Fahrenheit, and the current weather.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-Micropython-TM1637-Display-Weather.JPG.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 with TM1637 - display weather\" class=\"wp-image-187681\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-Micropython-TM1637-Display-Weather.JPG.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-Micropython-TM1637-Display-Weather.JPG.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<div class=\"wp-block-jetpack-tiled-gallery aligncenter is-style-rectangular\"><div class=\"\"><div class=\"tiled-gallery__gallery\"><div class=\"tiled-gallery__row\"><div class=\"tiled-gallery__col\" style=\"flex-basis:50.00000%\"><figure class=\"tiled-gallery__item\"><img decoding=\"async\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-ESP8266-TM1637-Display-Temperature-Celsius.jpg?strip=info&#038;w=600&#038;ssl=1 600w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-ESP8266-TM1637-Display-Temperature-Celsius.jpg?strip=info&#038;w=750&#038;ssl=1 750w\" alt=\"ESP32 with TM1637 - display temperature in Celsius\" data-height=\"422\" data-id=\"187682\" data-link=\"https:\/\/randomnerdtutorials.com\/?attachment_id=187682#main\" data-url=\"https:\/\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-ESP8266-TM1637-Display-Temperature-Celsius.jpg\" data-width=\"750\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-ESP8266-TM1637-Display-Temperature-Celsius.jpg?ssl=1\" data-amp-layout=\"responsive\"\/><\/figure><\/div><div class=\"tiled-gallery__col\" style=\"flex-basis:50.00000%\"><figure class=\"tiled-gallery__item\"><img decoding=\"async\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-ESP8266-TM1637-Display-Temperature-Fahrenheit.jpg?strip=info&#038;w=600&#038;ssl=1 600w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-ESP8266-TM1637-Display-Temperature-Fahrenheit.jpg?strip=info&#038;w=750&#038;ssl=1 750w\" alt=\"ESP32 with TM1637 - display temperature in Fahrenheit\" data-height=\"422\" data-id=\"187683\" data-link=\"https:\/\/randomnerdtutorials.com\/?attachment_id=187683#main\" data-url=\"https:\/\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-ESP8266-TM1637-Display-Temperature-Fahrenheit.jpg\" data-width=\"750\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-ESP8266-TM1637-Display-Temperature-Fahrenheit.jpg?ssl=1\" data-amp-layout=\"responsive\"\/><\/figure><\/div><\/div><\/div><\/div><\/div>\n\n\n\n<p>In the MicroPython Shell, it will display the complete JSON response, the current weather, and the temperature.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"853\" height=\"491\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-Get-Weather-data-from-API-MicroPython-Thonny-IDE.png?resize=853%2C491&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 Get Weather Data - MicroPython\" class=\"wp-image-187622\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-Get-Weather-data-from-API-MicroPython-Thonny-IDE.png?w=853&amp;quality=100&amp;strip=all&amp;ssl=1 853w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-Get-Weather-data-from-API-MicroPython-Thonny-IDE.png?resize=300%2C173&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-Get-Weather-data-from-API-MicroPython-Thonny-IDE.png?resize=768%2C442&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 853px) 100vw, 853px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>In this tutorial, you learned how to interface the TM1637 4-digit 7-segment display with the ESP32 and ESP8266 programmed with MicroPython. As you&#8217;ve seen, it is straightforward to display data on the screen thanks to the <em>tm1637.py<\/em> module.<\/p>\n\n\n\n<p>You can display a wide variety of data on the display, but the most common uses are to display temperature and to create a digital clock or a countdown timer.<\/p>\n\n\n\n<p>We hope you&#8217;ve found this guide useful. We have MicroPython guides for other displays that you may be interested in:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/micropython-oled-display-esp32-esp8266\/\">MicroPython: <strong>OLED Display<\/strong> with ESP32 and ESP8266<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/micropython-i2c-lcd-esp32-esp8266\/\">MicroPython:<strong> I2C LCD Display<\/strong> with ESP32\/ESP8266<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/micropython-cheap-yellow-display-board-cyd-esp32-2432s028r\/\">MicroPython: ESP32 <strong>Cheap Yellow Display<\/strong> Board \u2013 CYD (ESP32-2432S028R)<\/a><\/li>\n<\/ul>\n\n\n\n<p>If you want to learn more about programming the ESP32 and ESP8266 boards using MicroPython, check out our resources:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/micropython-programming-with-esp32-and-esp8266\/\">MicroPython Programming with ESP32 and ESP8266 (<em>eBook<\/em>)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32-esp8266-micropython\/\">All our MicroPython Projects and Tutorials<\/a><\/li>\n<\/ul>\n\n\n\n<p>Thanks for reading.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to interface TM1637 4-Digit LED 7-Segment Display with the ESP32 and ESP8266 boards programmed with MicroPython. Learn how to wire the display to the boards and how to &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"MicroPython: ESP32\/ESP8266 with TM1637 4-Digit LED 7-Segment Display\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/micropython-esp32-esp8266-tm1637-display\/#more-187472\" aria-label=\"Read more about MicroPython: ESP32\/ESP8266 with TM1637 4-Digit LED 7-Segment Display\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":187674,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[310,309,264],"tags":[],"class_list":["post-187472","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-micropython","category-0-esp32-micropython","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2026\/01\/ESP32-ESP8266-TM1637-MicroPython.jpg?fit=1920%2C1080&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/187472","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=187472"}],"version-history":[{"count":14,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/187472\/revisions"}],"predecessor-version":[{"id":190768,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/187472\/revisions\/190768"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/187674"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=187472"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=187472"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=187472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}