Skip to main content

CC BY-NC-SA 4.0

Pixoo

A library to easily communicate with the Divoom Pixoo 64 (and hopefully soon more screens that support Wi-Fi)

An non-trivial example, with re-connecting and API-calls can be found in examples/power-usage. In this example I read the current kWh from my P1-meter and display the current power usage of my house in a neat little graph.

Simulator buffer simulator

Tested on a Pixoo 64, with Python 3.15 on MacOS Golden Gate.

The all new ✨Frame animations✨

The FrameAnimatedImage class makes it easy to play a horizontal spritesheet on the display. Give it the sheet, the size of one frame, and your Pixoo instance; it calculates the frame count and lets you draw and advance frames in your own loop:

import time

from pixoo import Pixoo, FrameAnimatedImage

pixoo = Pixoo()
background = pixoo.load_image('examples/frame-animation/assets/background.png')
clanker = FrameAnimatedImage(
    pixoo,
    'examples/frame-animation/assets/clanker-success_15x1.png',
    10,
    15,
)

while True:
    pixoo.draw_image(background)
    clanker.draw_current_frame((27, 20))
    clanker.move_to_next_frame()
    pixoo.push()
    time.sleep(1 / 3)  # 3 fps

See examples/frame-animation for the complete example.

FrameAnimatedImage demo

In testing, 3–4 fps seems viable over 5 GHz Wi-Fi. Higher frame rates depend on the display, network conditions, and how much data is sent per frame.

The REST-interface

It's pretty much fully functional now. You can find the example in examples/pixoorest on how to start a script that runs the REST server. Most of the methods available in the Pixoo library are supported- except currently for loading a local image (for obvious reasons).

Basically, anywhere in the code you can start a (blocking!) server thread by making a PixooREST object as such:

PixooREST()

Look into the PixooConfiguration and RESTConfiguration objects if you want to do some customizing. This will be documented more later on.

These are the currently supported REST calls, and can be made with both POST and GET calls. A more REST-like interface is coming, but I wanted to make the interface as easily accessible as possible for now.

Pixoo equivalent URL and variables
clear /clear/<int:r>/<int:g>/<int:b>
draw_character /drawcharacter/<string:character>/<int:x>/<int:y>/<int:r>/<int:g>/<int:b>
draw_filled_rectangle /drawfilledrectangle/<int:top_left_x>/<int:top_left_y>/<int:bottom_right_x>/<int:bottom_right_y>/<int:r>/<int:g>/<int:b>
draw_line /drawline/<int:start_x>/<int:start_y>/<int:stop_x>/<int:stop_y>/<int:r>/<int:g>/<int:b>
draw_pixel_at_index /drawpixel/<int:index>/<int:r>/<int:g>/<int:b>
draw_pixel_at_location /drawpixel/<int:x>/<int:y>/<int:r>/<int:g>/<int:b>
draw_text_at_location /drawtext/<string:text>/<int:x>/<int:y>/<int:r>/<int:g>/<int:b>
device_configuration /deviceconfigurations
device_time /devicetime
fill /fill/<int:r>/<int:g>/<int:b>
play_local_gif /playlocalgif/<path:file_path>
play_local_gif_directory /playlocalgifdirectory/<path:path>
play_gif_file_url /playnetgif/<path:gif_file_url>
push /push
reboot /reboot
send_text_at_location_rgb /sendtext/<string:text>/<int:x>/<int:y>/<int:r>/<int:g>/<int:b>/<int:identifier>/<int:font>/<int:width>/<int:movement_speed>/<int:direction>
set_brightness /setbrightness/<int:brightness>
set_channel /setchannel/<int:channel>
set_clock /setclock/<int:clock_id>
set_face /setface/<int:face_id>
set_high_light_mode /sethighlight/<int:on>
set_mirror_mode /setmirror/<int:on>
set_noise_status /setnoise/<int:on>
set_score_board /setscoreboard/<int:blue_score>/<int:red_score>
set_screen /setscreen/<int:on>
set_visualizer /setvisualizer/<int:equalizer_position>
set_white_balance_rgb /setwhitebalance/<int:white_balance_r>/<int:white_balance_g>/<int:white_balance_b>
sound_buzzer /soundbuzzer/<int:active_cycle_time>/<int:inactive_cycle_time>/<int:total_time>

The Simulator

.. Simulator might be a bit of a big word, but if you want to test your own drawing stuff, I've included a simple "simulator" that can render the buffer to a GUI so it's easier to debug without having to connect to the device.

It's in a very early stage, but it supports all methods that start with draw_ and can be "pushed" to the GUI, just the way you'd use it normally.

NOTE: When enabling and using the simulator, the actual connection to the device will be completely ignored. So don't expect to see anything on your device when simulating.

The simulator can be activated as such:

pixoo = Pixoo('192.168.1.137', simulated=True, simulation_config=SimulatorConfiguration(4))

The SimulatorConfiguration currently only takes one argument, which is the scale to display the images at. Should be 1 or a multiple of 2 if you want nice looking results. It seems like 4 and 8 are working great, in my experience. With scale set to 4 it'll look like this on MacOS:

Simulator buffer simulator

Installation

You can install the library as a package via pip:

pip install pixoo

The REST server needs Flask, which is an optional extra:

pip install "pixoo[rest]"

Alternatively, install the package as a developer from a cloned folder:

python -m pip install -e ".[dev,rest]"

On some newer versions of MacOS, if you want to use the simulator you might have to manually install the tkinter library. I use brew:

brew install python-tk

Getting started

Create an interface with your device as such (of course use your own local IP-address):

pixoo = Pixoo('192.168.1.137')

For now, the easiest way to learn how to use this library is to check the examples.py, and the example directory for a neat project. I'll be adding examples to this page over time as well, once the project matures a bit more.

NOTE: Be sure to call push() after performing all your draw actions, to push the internal buffer to the screen. * Try to not call this method more than once per second if you don't want the device to stop responding!*

Usage

Stability increase

Use the refresh_connection_automatically boolean variable in the constructor of Pixoo to force a reset of the internal counter on the device. This should make the application much more stable at the expensive of a slight delay in updating every 32 frames. I haven't tested it myself just yet, but theoretically this would solve the "After updating the screen +/- 300 times the display stops responding" bug.

Special thanks

PICO-8's fantastic low-res font

Special thanks goes to the fantastic PICO-8 and its creator. I've written a small script to convert the font to simple pixel matrixes, which are used as "glyphs" within the draw_text methods.

Supported characters so far are:

0123456789
abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
!'()+,-<=>?[]^_:;./{|}~$@%

Known bugs

Simulator shows black screen on Macbook with M-processors

Run the following commands (not tested personally, but based on this Stack Overflow thread)

brew uninstall tcl-tk uninstall
pyenv uninstall 3.15 # Replace this with the global Python version you have installed
brew install tcl-tk
pyenv install 3.15
pyenv global 3.15

You need to install tk via homebrew before installing Python with pyenv because pyenv will automatically try to use whatever tk package it can find when it installs Python.

This will also work if you are using pyenv to upgrade from one version of Python to another.

Previous buffer/image is still partially visible

Unfortunately, the Divoom Pixoo 64 doesn't seem quite ready for prime time- yet. There are some known buffer issues that can cause issues, basically meaning that parts of the previous image are still displayed even though a newer image has been pushed to the display. I'm sure this will be fixed in the future though, the dev team seems to be working hard!

After updating the screen +/- 300 times the display stops responding

This seems to be an internal bug with the current firmware. I'll update the code once a better way to push a buffer to the screen becomes available.

TextScrollDirection.RIGHT seems to invert the string

.. and some other issues. Seems like for now, text can only really be scrolling left with most fonts. This will likely (hopefully?) be fixed by the dev team in the future.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

CC BY-NC-SA 4.0

Metadata

Release files for pixoo 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pixoo 0.10.0
File Size Uploaded Provenance Actions
pixoo-0.10.0.tar.gz 33.0 kB Without provenance Details for pixoo-0.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pixoo 0.10.0
File Interpreter ABI Platform Actions
pixoo-0.10.0-py3-none-any.whl Python 3 none any Details for pixoo-0.10.0-py3-none-any.whl

Total release size: 59.4 kB

Release files / pixoo-0.10.0.tar.gz

Download URL pixoo-0.10.0.tar.gz
Size 33.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7de1471dc35a8bda4d1d0b40e87cdb9d21866e62bcfafb20d1b329680ad97901
BLAKE2b-256 checksum
How to use checksums
5d822a4db24275157731533709aafa28332601a94b5d673c286a1c7345dc5928
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / pixoo-0.10.0-py3-none-any.whl

Download URL pixoo-0.10.0-py3-none-any.whl
Size 26.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac473d452eef07c24706f9c17fc359104887d8ce30b453bd9e01d2527498284b
BLAKE2b-256 checksum
How to use checksums
1972185f8c431f7e9d38621e5eec6df071f74f6b2239bda82f46f33051c9f52b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for pixoo 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page