Skip to main content

Modular interface for controlling the Merkury Innovations LED Matrix Display via BLE.

Project description

Merkury Innovations Multicolor Matrix LED Display Interfacing Library


Whew, what a mouthful, huh? MILI for short, provides automatic, high-level interfacing with the Merkury Innovation's Multicolor Matrix LED Display.

Why?

I went to Walmart one day, and picked up this LED panel. Naturally, it had an app, and every API developer's worst nightmare is other people's apps to control their technology. So, I started looking into alternatives.

I had come across this reverse-engineering of the model, specifically how it interfaces over BLE. Out of curiosity, I decided to start tinkering with it too.

While the reverse-engineering was perfect, and the protocol worked as expected, what didn't work as expected was trying to interface it like a library... because it wasn't a library. It's a toolkit. So, I decided to use the effort that was already there, and develop a library that plays nicer with developers who want to get things done their way, with their product.

Because of the nature of libraries, I felt it was best to provide an open-source, pip install ready iteration, versus the toolkit of scripts that was provided by the initial developer, offe. Without them, this project would not be possible. Thank you.

Download

You can install it from PyPi, using pip:

pip install mi-led-interface

...or download it, and built it yourself.

git clone https://github.com/the-sluggiest-cat/mi-led-interface.git
cd mi-led-interface
python3 -m venv venv
python3 -m pip install bleak
python3 -m pip install pil

Examples:

from mili.client import PanelClient
from mili.pixels import PixelGrid

# Until the script is stopped, if you have a model of the Matrix LED display close by,
# it will display a 16x16 rendition of "silly_picture.png" in the directory with the running script.
client = PanelClient()
pixel_grid = PixelGrid.from_image("silly_picture.png")
client.show_image(pixel_grid)
from mili.client import PanelClient
from mili.pixels import PixelGrid

# This works with animated images, too!
client = PanelClient()
pixel_grid = PixelGrid.from_image("silly_animation.gif")
client.show_image(pixel_grid)
from mili.client import PanelClient
from mili.pixels import PixelGrid
from PIL import Image

# You can also use PILlow's images...
client = PanelClient()
image = Image.open("a_pillow.png")
pixel_grid = PixelGrid.from_image(image)
client.show_image(pixel_grid)
from mili.client import PanelClient
from mili.pixels import PixelGrid, Pixel
from asyncio import run

# ...or go a little deeper, and represent individual bits and bytes!
def binary_representation(number: int):
    if isinstance(number, int) is False: return "0"*256
    string = bin(number).split("0b")[-1]
    if len(string) >= 256: return "0"*256
    iterations = 256 - len(string)
    returned_string = ""
    for _ in range(iterations):
        returned_string += "0"
    returned_string += string
    return returned_string

async def __main():
    panel_client = PanelClient()

    while True:
        pixel_grid = PixelGrid()
        b_r = binary_representation(floor(time()))
        for index, i in enumerate(b_r):
            pixel_grid.set_pixel(index%16, index//16, Pixel.from_bool(int(i)))
        await panel_client.draw_to_panel(pixel_grid)

run(__main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mi_led_interface-1.0.6.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mi_led_interface-1.0.6-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file mi_led_interface-1.0.6.tar.gz.

File metadata

  • Download URL: mi_led_interface-1.0.6.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.0 Windows/11

File hashes

Hashes for mi_led_interface-1.0.6.tar.gz
Algorithm Hash digest
SHA256 508d6842b19e9a28642cf3961bb35b544e472cfb240fc28bae7e354501474436
MD5 65a63f3e92e5fa9fcd2fbb4120c09d4c
BLAKE2b-256 dcf7b3b9d670508822049264f922a801effd07852d3e93f2e33f3b23381e95c0

See more details on using hashes here.

File details

Details for the file mi_led_interface-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: mi_led_interface-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.0 Windows/11

File hashes

Hashes for mi_led_interface-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 85eff946520e4211a27ac9f6dd943236ecc020b3824a277b97fe998a33cced13
MD5 d8862ef6c890fc57f4239aec7e6f2b3a
BLAKE2b-256 f3dea3c26204cd1f072d6d206773c53d30846c6f47d48a50a3467910b7d09dd4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page