nanopb logo

nanopb

Free

Nanopb is a plain-C implementation of Google's Protocol Buffers data format. It is targeted at 32 bit microcontrollers, but is also fit for other embedded systems with tight (2-10 kB ROM, <1 kB RAM) memory constraints.

FreeFree tier
Type
Open Source

About nanopb

Nanopb is a plain-C implementation of Google's Protocol Buffers data format, specifically designed for 32-bit microcontrollers and other embedded systems with tight memory constraints (approximately 10 kB ROM and 1 kB RAM). It provides a lightweight, efficient way to serialize and deserialize structured data in resource-limited environments. The library is distributed under the zlib license and has been used in products such as Android phones, iPhones, TomTom Sports devices, Cisco TelePresence Server, and Garmin GPS watches. Development is hosted on GitHub, with support available via the issue tracker and a Google Groups discussion forum. Commercial support is offered by devEmbedded.

Key Features

Plain-C implementation of Google's Protocol Buffers
Optimized for 32-bit microcontrollers and embedded systems
Very small memory footprint (approx. 10 kB ROM, 1 kB RAM)
Open source under permissive zlib license
Compatible with standard Protocol Buffers encoding
Includes code generator (nanopb compiler) for C source and headers
Actively maintained on GitHub with issue tracker and community forum

Pros & Cons

Pros
  • Extremely low memory and ROM requirements suitable for microcontrollers
  • Written in plain C, easy to integrate into embedded C projects
  • Widely adopted in commercial products, demonstrating reliability
  • Permissive zlib license allows use in proprietary projects
  • Active community and commercial support available
Cons
  • Limited to features supported by the lightweight implementation; may not cover all Protocol Buffers features
  • Primarily targets 32-bit microcontrollers; less optimized for very small 8-bit or 16-bit MCUs
  • Documentation is minimal and geared towards experienced embedded developers
  • No built-in RPC support unlike gRPC

Best For

Embedded firmware communication in IoT devicesData serialization for sensor networks and telemetryInter-device communication in consumer electronics (e.g., GPS watches, sports devices)Network protocols in resource-constrained systems (e.g., Cisco TelePresence)Mobile device internal communication (Android, iPhone)

FAQ

What is nanopb?
Nanopb is a plain-C implementation of Google's Protocol Buffers, designed for embedded systems with tight memory constraints, especially 32-bit microcontrollers.
How do I get started with nanopb?
You can download the latest stable release from the website or clone the GitHub repository: git clone https://github.com/nanopb/nanopb.git. Documentation including an introduction and simple encoding/decoding examples is available on the site.
What license does nanopb use?
Nanopb is distributed under the zlib license, which allows free use, modification, and redistribution for any purpose, including commercial applications.
Is commercial support available?
Yes, commercial support is available from devEmbedded.
What devices or products use nanopb?
Nanopb is used in Android phones, iPhones, TomTom Sports devices, Cisco TelePresence Server, and Garmin GPS watches, among others.