Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Zenoh-Pico: Lightweight. Fast. Connected.

Zenoh-Pico: Lightweight. Fast. Connected.

This deck will provide a deep dive into Zenoh-Pico, the ultra-lightweight implementation of Zenoh tailored for microcontrollers and resource-constrained environments. In this session, we’ll explore the architecture of Zenoh-Pico, highlight its latest features, and show how to configure it for different hardware targets. Whether you're building an embedded application or working on edge robotics, this webinar is your gateway to mastering Zenoh-Pico.

Avatar for Angelo Corsaro

Angelo Corsaro

May 09, 2025
Tweet

Video

More Decks by Angelo Corsaro

Other Decks in Technology

Transcript

  1. Resource Constrained, What? Limited CPU power and memory Low power

    availability Network bandwidth limitations Real-time constraints
  2. Memory E ffi ciency Lack of memory and space Memory

    takes up a lot of silicon area Low power consumption Tasks are very speci fi c and limited
  3. Computing E ffi ciency Avoiding expensive operations Using lightweight data

    serialization formats Leveraging hardware acceleration Optimizing interrupt handling
  4. Energy E ffi ciency Duty cycling and sleep modes Reducing

    CPU load Optimizing network communication Energy-e ff i cient protocols
  5. Communication E ffi ciency E ff i cient data encoding

    Reducing unnecessary transmissions Handling packet loss gracefully Asynchronous communication strategies
  6. Key Principles for E ffi cient Software Minimalism: Keep the

    code simple and lightweight Modularity: Design for reusability and scalability E ffi ciency: Optimize performance and resource usage Reliability: Ensure robustness under constraints
  7. Summary & Takeaways • Understanding constraints is key to designing

    e ff i cient systems • Optimize memory, CPU, and power usage • Handle network limitations smartly
  8. Dragons teach us that if we want to climb high

    we have to do it against the wind. Pub/Sub/Query protocol that Uni fi es data in motion, data at rest and computations from embedded microcontrollers up the data centre Provides location-transparent abstractions for high performance pub/sub and distributed queries across heterogeneous systems Built-in support for zero-copy and shared memory
  9. Zenoh Implementations ZettaScale leads two implementations of the Zenoh protocol

    Zenoh written in Rust and Zenoh Pico written in C and targeting micro- controllers When using C/C++ APIs, applications can target either of these versions — it is a compile-time decision C C CPP Zenoh Pico Zenoh Rust C CPP Python Kotlin Java JS Rust …
  10. Supported OS OS Linux, MacOS, Windows, Android, iOS, QNX Embedded

    Targets Arduino, ESP32, mbed, Zephyr, FreeRTOS, … Automotive Targets AUTOSAR Classic (microSAR)
  11. Protocol Stack Zenoh was designed to be able to run

    on Data Link or higher in the networking stack Supports network technologies from transport layer down-to the data link. Currently runs on, TCP/IP, UDP/IP, QUIC, Serial, Bluetooth, OpenThreadX, Unix Sockets, Shared Memory The protocol available on embedded and extremely constrained devices and networks — 5 bytes minimal overhead Data Link Network Transport Physical
  12. Zenoh’s Primitives Zenoh is built upon two primitives operating on

    named data: pub/sub and query/reply Named data is represented by as (key, value) tuple, e.g., (bot-1/sensor/speed, 25) These two orthogonal primitives allow Zenoh to e ffi ciently deal with distributed computations, data/event dissemination and storage
  13. Any Topology Peer-to-peer Clique and mesh topologies Client Client Mesh

    Peer Peer Peer Peer Peer Clique Peer Peer Peer Peer Client
  14. Any Topology Peer-to-peer Clique and mesh topologies Brokered Routed Client

    Client Brokered Clients communicate through a router or a peer Mesh Peer Peer Peer Peer Peer Router Client Client Client Client Router Router Client Clique Peer Peer Peer Peer Client
  15. Router Router Any Topology Peer-to-peer Clique and mesh topologies Brokered

    Routed Router Router Router Client Client Routed Routers forward data to and from peers and clients Brokered Clients communicate through a router or a peer Mesh Peer Peer Peer Peer Peer Router Client Client Client Client Router Router Client Clique Peer Peer Peer Peer Client
  16. Router Router Zenoh-Pico Topology Peer-to-peer Clique and mesh topologies Brokered

    Routed Router Router Router Client Client Brokered Clients communicate through a router or a peer Mesh Peer Peer Peer Peer Peer Router Client Client Client Client Router Router Client Clique Peer Peer Peer Peer Client
  17. Peer-to-Peer Unicast Allows unicast connection between nodes without needing a

    router and improving latency. Allows reliable links between peers when using tcp. 1 to many setup example: Peer Peer Peer Peer Listen on 192.168.1.10:7447 Peer Peer Peer Peer Listen on 192.168.1.10:7447 Listen on 192.168.1.11:7447 Listen on 192.168.1.12:7447 Many to many setup example:
  18. Peer-to-peer Unicast Current Limitations: • TCP only, supported on Zephyr,

    FreeRTOS, ESPIDF, Linux, MacOS, Windows. • Clients can’t connect to peer listener for now • Key expression are not declared for now • Write fi lters are not working for now • Blog post detailing more incoming
  19. Zenoh Runtime Storage Plugins Protocol Plugins MAIN MEMORY FILE SYSTEM

    Runtime Plugins Zenoh Flow RocksDB Plug-In Architecture
  20. Why Zenoh-Pico? Embedded systems are key in many application domains,

    such as Robotics, Automotive, Internet of Things, and Smart Cities Run across constrained and low-power networks, such as LowPAN, LoRa, Bluetooth, and Serial Growing number of initiatives and adoption of Rust into embedded, but not yet there
  21. Key highlights Small footprint Zenoh implementation optimised for embedded systems

    and microcontrollers Natively implemented in C (~80% of embedded development) Easily ported to many other platforms, frameworks and communication stacks MISRA-C compliant Platforms Frameworks Communication
  22. 30 Same User API but tailored Share the Zenoh-C User

    API Tailored regarding: - Zenoh related con fi gurations - task management
  23. Zenoh-Pico Memory Types Concepts Zenoh-Pico have ownership models inspired by

    memory management principles in modern languages like Rust: • Owned Types: z_owned_xxx_t owns resources like memory and must be dropped when no longer needed. • Loaned Types: z_loaned_xxx_t temporarily passes ownership but does not require dropping. • Moved Types: z_moved_xxx_t transfers ownership. • View Types: z_view_xxx_t: Reference external data without owning it. These types are not destroyed (no need to call z_drop) and are valid only as long as the referenced data is valid.
  24. Owned Types Types pre fi xed with z_owned_xxx_t “own” external

    resources (e.g., memory, fi le descriptors). These types must be destroyed at the end of their lifecycle using the z_xxx_drop function or the z_drop macro z_owned_string_t s; z_string_copy_from_str(&s, "Hello, world!"); //... z_drop(z_move(s));
  25. Loaned Types To temporarily pass an owned object, it can

    be loaned using z_xxx_loan functions, which return a pointer to the corresponding z_loaned_xxx_t. For readability, the generic macro z_loan is also available. Functions accepting a loaned object can either read (const z_loaned_xxx_t*) or read and modify (z_loaned_xxx_t*) the object. In both cases, ownership remains with the caller. z_owned_string_t s, s1; z_string_copy_from_str(&s, "Hello, world!"); // notice that the prototype of z_string_clone is // void z_string_clone(z_owned_string_t* dst, const z_loaned_string_t* src); // I.e. the only way to pass the source string is by loaning it z_string_clone(&s1, z_loan(s)); //... z_drop(z_move(s)); z_drop(z_move(s1));
  26. Moved Types When a function accepts a z_moved_xxx_t* parameter, it

    takes ownership of the passed object. To pass the object, use the z_xxx_move function or the z_move macro. Once the object is moved, the caller should no longer use it. While calling z_drop is safe, it’s not required. Note that z_drop itself takes ownership, so z_move is also needed in this case. z_owned_config_t cfg; z_config_default(&cfg); z_owned_session_t session; // session takes ownership of the config if (z_open(&session, z_move(cfg)) == Z_OK) { //... z_drop(z_move(session)); } // z_drop(z_move(cfg)); ← this is safe but useless
  27. View Types z_view_xxx_t types are reference types that point to

    external data. These values do not need to be dropped and remain valid only as long as the data they reference is valid. A key feature is that z_view_xxx_t types are loaned as z_loaned_xxx_t, just like their owned counterparts, allowing consistent use of both owned and view types. z_owned_string_t owned; z_string_copy_from_str(&owned, "Hello, world!"); z_view_string_t view; z_view_string_from_str(&view, "Hello, another world!"); z_owned_string_t dst; z_string_clone(&dst, z_loan(owned)); z_drop(z_move(dst)); z_string_clone(&dst, z_loan(view)); z_drop(z_move(dst)); z_drop(z_move(owned));
  28. Con fi gurations Con fi gurations are handled in a

    di ff erent way Compile time con fi guration - Enable / Disable features Run time con fi gurations - Same as Zenoh-C Zenoh-Pico Zenoh-C
  29. Task Management Support for both multi-thread and single-thread Direct control

    over read and lease tasks Users spawn/destroy tasks threads Users explicit trigger single execution of read and lease tasks Multi-Thread Single-Thread
  30. Batching Zenoh-Pico can batch messages to: ‣ Improve Throughput ‣

    Reduce Network Overheard ‣ Reduce CPU utilisation put(“foo”, ) Network put(“bar”, ) put(“baz”,)
  31. Zenoh and Zenoh-Pico are the same? TL;DR: Yes! Zenoh-Pico is

    an alternative implementation of the Zenoh • API portability (minimal tweaks) • Same wire protocol (aka interoperable with Zenoh) • Same set of functionalities (but lightweight) • C99 and MISRA-C compliant • Unlike Zenoh, Zenoh-Pico can’t work in router mode
  32. Raw Ethernet Support for Zenoh-Pico • Lower Overhead: sends messages

    directly in Ethernet frames, avoiding extra protocol layers. • TSN Compatibility: improves real-time communication with precise timing control. • Optimized Scheduling: fi ne-tune network parameters for better system-wide performance.
  33. Concluding Remarks Zenoh-Pico is the Zenoh Protocol implementation for embedded

    targets It supports the full set of Zenoh primitives, as well as peer-to-peer and brokered communication It is lightweight and performant!