Skip to content
Jupiter documentation
Menu

Frame protocol

The TCP and UDP formats that mode 3 accepts, with header layouts, pixel formats and limits.

Mode 3 listens on one port number (default 5050) for both TCP and UDP. Set the port with MONO_PORT in idf.py menuconfig, under the Monochrome menu. All multi-byte numbers are little endian.

Pixel formats#

Rows are packed with no padding: 720 bytes, 90 bytes or 180 bytes per row, top row first.

TCP#

The device accepts one client at a time. The client sends frames back to back. Each frame is a header followed by the payload.

When bit 0 of the flags is set, a 4-byte compressed length follows the header, then that many bytes of zlib data. The data must inflate to exactly the number of bytes in the format table. The compressed length is at most 65,536 bytes. Send larger frames uncompressed.

The device shows each frame when it has fully arrived. It closes the connection after a bad header, an unknown format, a bad length or data that does not inflate to the right size.

UDP#

Each datagram carries some rows of a frame. No connection is needed, and a sender can update only some rows.

The rows follow the 10-byte header. For a compressed packet the rows are the zlib data, which must inflate to exactly the row count times the row size. A packet carries at most 63,000 bytes of inflated rows. tools/send.py keeps each datagram under 1,400 bytes of rows so that it fits in one Wi-Fi packet.

The device ends a frame and shows it when one of these happens:

  • a packet with the last-packet flag arrives
  • a packet with a different sequence number arrives
  • no packet arrives for 50 ms

Rows that a frame does not contain, or that were lost, keep the pixels of the frame that was on screen. A packet with a bad size or an unknown format is dropped.

One sender at a time#

A TCP client and a UDP sender share the frame buffers. While a TCP client is in the middle of a frame, the device drops UDP packets that arrive more than 5 ms later.

Measured speeds#

The device showed these rates on one 2.4 GHz network at a signal strength of -55 dBm, with the demo pattern from tools/send.py. The demo is a repeating pattern, so it compresses far better than a photo.

Random noise does not compress. The sender then sends raw rows, and the device reached about 26 frames per second over TCP and 30 over UDP for 1-bit and 2-bit noise.

Source: belikh/monochrome HEAD