7 releases

0.3.2 Nov 15, 2023
0.3.1 Nov 14, 2023
0.2.1 May 2, 2023
0.1.1 May 1, 2023

#277 in Multimedia

Download history 4/week @ 2023-08-13 8/week @ 2023-08-27 9/week @ 2023-09-03 3/week @ 2023-09-10 1/week @ 2023-09-17 2/week @ 2023-09-24 2/week @ 2023-10-01 1/week @ 2023-10-15 4/week @ 2023-10-29 91/week @ 2023-11-12 11/week @ 2023-11-19 28/week @ 2023-11-26

130 downloads per month

MIT license

883 lines

Distributed Display Protocol (DDP) in Rust

This package allows you to write pixel data to a LED strip over Distributed Display Protocol (DDP) by 3waylabs.

You can use this to stream pixel data to WLED or any other DDP capable reciever.


use anyhow::Result;
use ddp_connection::connection;
use ddp_connection::protocol;

fn main() -> Result<()> {

    let mut conn = connection::DDPConnection::try_new
            "", // The IP address of the device followed by :4048
            protocol::PixelConfig::default(), // Default is RGB, 8 bits ber channel
                .unwrap() // can be any unused port on, but protocol recommends 4048

    // loop sets some colors for the first 6 pixels to see if it works
    for i in 0u8..100u8{
        let high = 10u8.overflowing_mul(i).0;

        // loop through some colors

        let temp: usize = conn.write(&vec![
            high/*red value*/, 0/*green value*/, 0/*blue value*/,
            high/*red value*/, 0/*green value*/, 0/*blue value*/,
            0/*red value*/, high/*green value*/, 0/*blue value*/,
            0/*red value*/, high/*green value*/, 0/*blue value*/,
            0/*red value*/, 0/*green value*/, high/*blue value*/,
            0/*red value*/, 0/*green value*/, high/*blue value*/

        // this crate is non blocking, so with out the sleep, it will send them all instantly

        println!("sent {temp} packets");


or try it by running cargo run --example dev


I wish I could tell you. I've gone back and forth on these bespoke LED protocols and DDP seems like the most "sane" one although the "specification" leaves some to be desired. TPM2.net was another possible protocol which i started to implement but stopped after I realized how bad it is. Artnet and E1.31 is great but then you have framerate problem (approx 40-44 FPS) to maintain backwards compatbility with DMX.

DDP sits in the middle here as "sane" but not perfect, hence why I implemented it for whatever it is I'm doing. It doesn't mandate a framerate, it's spec agnostic to if you send it over UDP or TCP (although I suspect most vendors only accept UDP) and it's open ended in that it relies on JSON for messaging. On top of that the author shoved so much data into the 10 byte header it's almost impressive. Only drawback is that clients needs to implement JSON parsing if they want to be smart but that's tablestakes at this point for anything connected.

For any future "i'm going to invent my own LED protocol" people out there, take note from the people in broadcast video instead of your jank ham radio serial protocol. I like the "freeform pixel struture" but there would probably be value to a more structured "session" where you standardize on how to communicate pixel size etc.

Is it trash?

yes. but it works for WLED, and thats all I can test or care about.


m8 just open a PR with some gucchimucchi code and I'll review it.




~57K SLoC