{
    "ok": true,
    "data": {
        "title": "S-0005",
        "rev_id": 11897,
        "updated_at": "2022-01-14T10:07:24+00:00",
        "chunk_count": 24,
        "chunks": [
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "",
                "chunk_index": 0,
                "content": "# S-0005",
                "char_count": 8,
                "token_estimate": 2
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "0.96 Inch OLED Module",
                "chunk_index": 1,
                "content": "<figure>\n<img src=\"Da1.jpg\" title=\"Da1.jpg\" width=\"300\" alt=\"Da1.jpg\" \/>\n<figcaption aria-hidden=\"true\">Da1.jpg<\/figcaption>\n<\/figure>",
                "char_count": 134,
                "token_estimate": 34
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "Description",
                "chunk_index": 2,
                "content": "0.96 Inch OLED Module is a mini display screen with 128X64 resoluction and SSD1306 chipset.\nStandard IIC communication interface pinout compatible with most MCU development board such as arduino, Raspberry Pi,C51 series etc.\nThe Python library to use SSD1306-based 128x64 or 128x32 pixel OLED displays with a Raspberry Pi or Beaglebone Black too.",
                "char_count": 346,
                "token_estimate": 87
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "Features",
                "chunk_index": 3,
                "content": "-   Easy to setup\n-   Super Low Power Consumption\n-   Power Input: 3.3V\n-   Good compatibility: Raspberry Pi 4B\/3B+\/3B\/2B\/Zero, Beagle Bone Black and so on.\n-   Support IIC communication Protocol\n-   Super Mini size\n-   Color: White\n-   Resolution: 128x64 pixels",
                "char_count": 262,
                "token_estimate": 66
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "Specifications > Display Specifications",
                "chunk_index": 4,
                "content": "-   Display Mode: Passive Matrix\n-   Display Color: Monochrome (White)\n-   Drive Duty: 1\/64 Duty",
                "char_count": 96,
                "token_estimate": 24
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "Specifications > Mechanical Specifications",
                "chunk_index": 5,
                "content": "-   Outline Drawing: According to the annexed outline drawing\n-   Number of Pixels: 128 × 64\n-   Panel Size: 24.74 × 16.9 × 1.42 (mm)\n-   Active Area: 21.74 × 10.86 (mm)\n-   Pixel Pitch: 0.17 × 0.17 (mm)\n-   Pixel Size: 0.15 × 0.15 (mm)\n-   Weight: TBD",
                "char_count": 252,
                "token_estimate": 63
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "Specifications > Maximum Ratings",
                "chunk_index": 6,
                "content": "<img src=\"96oled08.jpg\" title=\"96oled08.jpg\" width=\"500\" alt=\"96oled08.jpg\" \/>",
                "char_count": 78,
                "token_estimate": 20
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "Gallery",
                "chunk_index": 7,
                "content": "|                                                                 |                                                                 |                                                                 |\n|-----------------------------------------------------------------|-----------------------------------------------------------------|-----------------------------------------------------------------|\n| <figure>\n <img src=\"Da5.jpg\" title=\"Da5.jpg\" width=\"320\" alt=\"Da5.jpg\" \/>\n <figcaption aria-hidden=\"true\">Da5.jpg<\/figcaption>\n <\/figure>                                                        | <figure>\n                                                                   <img src=\"Da1.jpg\" title=\"Da1.jpg\" width=\"320\" alt=\"Da1.jpg\" \/>\n                                                                   <figcaption aria-hidden=\"true\">Da1.jpg<\/figcaption>\n                                                                   <\/figure>                                                        | <figure>\n                                                                                                                                     <img src=\"Da4.jpg\" title=\"Da4.jpg\" width=\"320\" alt=\"Da4.jpg\" \/>",
                "char_count": 1195,
                "token_estimate": 299
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "Gallery",
                "chunk_index": 8,
                "content": "<figcaption aria-hidden=\"true\">Da4.jpg<\/figcaption>\n                                                                                                                                     <\/figure>                                                        |",
                "char_count": 251,
                "token_estimate": 63
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "Gallery",
                "chunk_index": 9,
                "content": "|                                                                                   |                                                                                   |                                                                                   |\n|-----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|\n| <figure>\n <img src=\"Oled96Da6.jpg\" title=\"Oled96Da6.jpg\" width=\"320\" alt=\"Oled96Da6.jpg\" \/>\n <figcaption aria-hidden=\"true\">Oled96Da6.jpg<\/figcaption>\n <\/figure>                                                                          | <figure>\n                                                                                     <img src=\"Oled96Da7.jpg\" title=\"Oled96Da7.jpg\" width=\"320\" alt=\"Oled96Da7.jpg\" \/>\n                                                                                     <figcaption aria-hidden=\"true\">Oled96Da7.jpg<\/figcaption>",
                "char_count": 1065,
                "token_estimate": 267
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "Gallery",
                "chunk_index": 10,
                "content": "<\/figure>                                                                          | <figure>\n                                                                                                                                                                         <img src=\"Oled96Da8.jpg\" title=\"Oled96Da8.jpg\" width=\"320\" alt=\"Oled96Da8.jpg\" \/>\n                                                                                                                                                                         <figcaption aria-hidden=\"true\">Oled96Da8.jpg<\/figcaption>\n                                                                                                                                                                         <\/figure>                                                                          |",
                "char_count": 825,
                "token_estimate": 207
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "Gallery",
                "chunk_index": 11,
                "content": "|                                                                                   |                                                                                      |                                                                                      |\n|-----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|\n| <figure>\n <img src=\"Oled96Da9.jpg\" title=\"Oled96Da9.jpg\" width=\"320\" alt=\"Oled96Da9.jpg\" \/>\n <figcaption aria-hidden=\"true\">Oled96Da9.jpg<\/figcaption>\n <\/figure>                                                                          | <figure>\n                                                                                     <img src=\"Oled96Da10.jpg\" title=\"Oled96Da10.jpg\" width=\"320\" alt=\"Oled96Da10.jpg\" \/>\n                                                                                     <figcaption aria-hidden=\"true\">Oled96Da10.jpg<\/figcaption>",
                "char_count": 1081,
                "token_estimate": 271
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "Gallery",
                "chunk_index": 12,
                "content": "<\/figure>                                                                             | <figure>\n                                                                                                                                                                            <img src=\"Oled96Da11.jpg\" title=\"Oled96Da11.jpg\" width=\"320\" alt=\"Oled96Da11.jpg\" \/>\n                                                                                                                                                                            <figcaption aria-hidden=\"true\">Oled96Da11.jpg<\/figcaption>\n                                                                                                                                                                            <\/figure>                                                                             |",
                "char_count": 844,
                "token_estimate": 211
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "Gallery",
                "chunk_index": 13,
                "content": "|                                                                                      |                                                                                      |\n|--------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|\n| <figure>\n <img src=\"Oled96Da12.jpg\" title=\"Oled96Da12.jpg\" width=\"500\" alt=\"Oled96Da12.jpg\" \/>\n <figcaption aria-hidden=\"true\">Oled96Da12.jpg<\/figcaption>\n <\/figure>                                                                             | <figure>\n                                                                                        <img src=\"Oled96Da13.jpg\" title=\"Oled96Da13.jpg\" width=\"500\" alt=\"Oled96Da13.jpg\" \/>\n                                                                                        <figcaption aria-hidden=\"true\">Oled96Da13.jpg<\/figcaption>\n                                                                                        <\/figure>                                                                             |",
                "char_count": 1102,
                "token_estimate": 276
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "Documentations",
                "chunk_index": 14,
                "content": "-   SSD1306 Datasheet:![](SSD1306-Revision_1.0.pdf \"SSD1306-Revision_1.0.pdf\")\n-   Mechanical Drawing:![](0.96inch_Mechanical_Drawing.pdf \"0.96inch_Mechanical_Drawing.pdf\")",
                "char_count": 172,
                "token_estimate": 43
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "How to use > For Raspberry Pi 4B",
                "chunk_index": 15,
                "content": "-   Open a terminal and Download demo code from: \\[ <https:\/\/github.com\/rm-hull\/luma.examples> \\]",
                "char_count": 97,
                "token_estimate": 25
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "How to use > Installation instructions",
                "chunk_index": 16,
                "content": "Assuming you are using a Raspberry Pi (running Debian Jessie or newer), follow the instructions to wire up your display, then from a command-line:\n\n    sudo usermod -a -G i2c,spi,gpio pi\n    sudo apt -y install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential\n    sudo apt -y install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev\n\nLog out and in again and clone this repository:\n\n    git clone https:\/\/github.com\/rm-hull\/luma.examples.git\n    cd luma.examples\n\nFinally, install the luma libraries using:\n\n    sudo -H pip3 install -e .\n\nIf you want to gather information from UPS PLUS device, you need to install following two libraries.\n\n    sudo pip3 install pi-ina219\n\n    sudo pip3 install psutil",
                "char_count": 758,
                "token_estimate": 190
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "How to use > Running the examples",
                "chunk_index": 17,
                "content": "After cloning the repository, enter the examples directory and try running one of the following examples listed below. For example:\n\npython3 examples\/3d_box.py\n\n<img src=\"96oledscreen4.jpg\" title=\"96oledscreen4.jpg\" width=\"500\" alt=\"96oledscreen4.jpg\" \/> <img src=\"Oled96example.jpg\" title=\"Oled96example.jpg\" width=\"500\" alt=\"Oled96example.jpg\" \/>\n\\* Other example Demo:\n\npython3 animated_gif.py\n\n<img src=\"Oled96exex.jpg\" title=\"Oled96exex.jpg\" width=\"500\" alt=\"Oled96exex.jpg\" \/>\n\\* Demo code for mini Mini Tower Kit.\n\n#!\/usr\/bin\/env python\n    # -*- coding: utf-8 -*-\n\n# Copyright (c) 2014-2020 Richard Hull and contributors\n\n# See LICENSE.rst for details.\n\n# PYTHON_ARGCOMPLETE_OK\n\n\"\"\"\n    Display basic system information.\n\nNeeds psutil (+ dependencies) installed::\n\n$ sudo apt-get install python3-dev\n      $ sudo -H pip3 install psutil\n      $ sudo pip3 install pyina219\n      $ sudo pip3 install psutil\n    \"\"\"\n\nimport os\n    import sys\n    import time\n    from pathlib import Path\n    from datetime import datetime\n    import smbus2\n    from ina219 import INA219, DeviceRangeError\n\nif os.name != 'posix':\n        sys.exit('{} platform not supported'.format(os.name))",
                "char_count": 1176,
                "token_estimate": 294
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "How to use > Running the examples",
                "chunk_index": 18,
                "content": "from demo_opts import get_device\n    from luma.core.render import canvas\n    from PIL import ImageFont\n\ntry:\n        import psutil\n    except ImportError:\n        print(\"The psutil library was not found. Run 'sudo -H pip install psutil' to install it.\")\n        sys.exit()\n\nDEVICE_BUS = 1\n    DEVICE_ADDR = 0x17\n    PROTECT_VOLT = 3700\n    SAMPLE_TIME = 2\n\nina_supply = INA219(0.00725, address=0x40)\n    ina_supply.configure()\n    supply_voltage = ina_supply.voltage()\n    supply_current = ina_supply.current()\n    supply_power = ina_supply.power()\n\nina_batt = INA219(0.005, address=0x45)\n    ina_batt.configure()\n    batt_voltage = ina_batt.voltage()\n    batt_current = ina_batt.current()\n    batt_power = ina_batt.power()\n\nbus = smbus2.SMBus(DEVICE_BUS)\n\n# TODO: custom font bitmaps for up\/down arrows\n\n# TODO: Load histogram",
                "char_count": 827,
                "token_estimate": 207
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "How to use > Running the examples",
                "chunk_index": 19,
                "content": "def bytes2human(n):\n        \"\"\"\n        >>> bytes2human(10000)\n        '9K'\n        >>> bytes2human(100001221)\n        '95M'\n        \"\"\"\n        symbols = ('K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')\n        prefix = {}\n        for i, s in enumerate(symbols):\n            prefix[s] = 1 << (i + 1) * 10\n        for s in reversed(symbols):\n            if n >= prefix[s]:\n                value = int(float(n) \/ prefix[s])\n                return '%s%s' % (value, s)\n        return \"%sB\" % n\n\ndef cpu_usage():\n        # load average, uptime\n\nuptime = datetime.now() - datetime.fromtimestamp(psutil.boot_time())\n        av1, av2, av3 = os.getloadavg()\n        return \"Ld:%.1f %.1f %.1f Up: %s\" \\\n            % (av1, av2, av3, str(uptime).split('.')[0])\n\ndef mem_usage():\n        usage = psutil.virtual_memory()\n        return \"Mem: %s %.0f%%\" \\\n            % (bytes2human(usage.used), 100 - usage.percent)\n\ndef disk_usage(dir):\n        usage = psutil.disk_usage(dir)\n        return \"SD:  %s %.0f%%\" \\\n            % (bytes2human(usage.used), usage.percent)",
                "char_count": 1045,
                "token_estimate": 262
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "How to use > Running the examples",
                "chunk_index": 20,
                "content": "def network(iface):\n        stat = psutil.net_io_counters(pernic=True)[iface]\n        return \"%s: Tx%s, Rx%s\" % \\\n               (iface, bytes2human(stat.bytes_sent), bytes2human(stat.bytes_recv))\n\ndef stats(device):\n        # use custom font\n\nfont_path = str(Path().resolve().parent.joinpath('fonts', 'C&C Red Alert [INET].ttf'))\n        font2 = ImageFont.truetype(font_path, 12)\n\nwith canvas(device) as draw:\n            draw.text((0, 0), cpu_usage(), font=font2, fill=\"white\")\n            if device.height >= 32:\n                draw.text((0, 14), mem_usage(), font=font2, fill=\"white\")\n\nif device.height >= 64:\n                draw.text((0, 26), disk_usage('\/'), font=font2, fill=\"white\")\n                try:\n                    draw.text((0, 38), network('wlan0'), font=font2, fill=\"white\")\n                except KeyError:\n                    # no wifi enabled\/available\n\npass\n\ndef chrg_port():\n        aReceivedBuf = []\n        aReceivedBuf.append(0x00)\n        for i in range(1, 255):\n            aReceivedBuf.append(bus.read_byte_data(DEVICE_ADDR, i))",
                "char_count": 1061,
                "token_estimate": 266
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "How to use > Running the examples",
                "chunk_index": 21,
                "content": "if (aReceivedBuf[8] << 8 | aReceivedBuf[7]) > 4000:\n            charge_port = 'Charging via TYPE-C'\n        elif (aReceivedBuf[10] << 8 | aReceivedBuf[9]) > 4000:\n            charge_port = 'Charging via MicroUSB'\n        else:\n            charge_port = 'Not Charging'\n        return \"CP: %s\" % charge_port\n\ndef batt_cur():\n        aReceivedBuf = []\n        aReceivedBuf.append(0x00)\n        for i in range(1, 255):\n            aReceivedBuf.append(bus.read_byte_data(DEVICE_ADDR, i))\n        chrg_rate = ina_batt.current()\n        return \"Bat Current: %.3f mA\" % chrg_rate\n\ndef batt_cap():\n        aReceivedBuf = []\n        aReceivedBuf.append(0x00)\n        for i in range(1, 255):\n            aReceivedBuf.append(bus.read_byte_data(DEVICE_ADDR, i))\n        capacity = (aReceivedBuf[20] << 8 | aReceivedBuf[19])\n        return \"Bat Capacity: %d%%\"% capacity\n\ndef full_bat():\n        aReceivedBuf = []\n        aReceivedBuf.append(0x00)\n        for i in range(1, 255):\n            aReceivedBuf.append(bus.read_byte_data(DEVICE_ADDR, i))\n        full_batt = (aReceivedBuf[14] << 8 | aReceivedBuf[13])\n        return \"Full Bat Voltage: %d mV\" % full_batt\n\ndef ups_status(device):\n        # use custom font",
                "char_count": 1200,
                "token_estimate": 300
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "How to use > Running the examples",
                "chunk_index": 22,
                "content": "font_path = str(Path().resolve().parent.joinpath('fonts', 'C&C Red Alert [INET].ttf'))\n        font2 = ImageFont.truetype(font_path, 12)\n\nwith canvas(device) as draw:\n            draw.text((0, 0), full_bat(), font=font2, fill=\"white\")\n            if device.height >= 32:\n                draw.text((0, 14), batt_cap(), font=font2, fill=\"white\")\n\nif device.height >= 64:\n                draw.text((0, 26), chrg_port(), font=font2, fill=\"white\")\n                try:\n                    draw.text((0, 38), batt_cur(), font=font2, fill=\"white\")\n                except KeyError:\n                    # no wifi enabled\/available\n\npass\n\ndef main():\n        while True:\n            #stats(device)\n            #time.sleep(5)\n            ups_status(device)\n            time.sleep(5)\n\nif  == \"\":\n        try:\n            device = get_device()\n            main()\n        except KeyboardInterrupt:\n            pass",
                "char_count": 900,
                "token_estimate": 225
            },
            {
                "title": "S-0005",
                "rev_id": 11897,
                "heading_path": "KeyWords",
                "chunk_index": 23,
                "content": "-   0.96 inch OLED display, oled screen, oled, Raspberry Pi 4B, 128x64pixels",
                "char_count": 76,
                "token_estimate": 19
            }
        ]
    }
}