Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Google 'Protocol Buffers' in Arduino

Is it possible to make Google Protocol Buffers work in Arduino?

I have been trying for about a week and can't make it work, and I would like to know if it's even possible.

like image 521
Manuel Araoz Avatar asked Jun 13 '12 04:06

Manuel Araoz


People also ask

What are Google protocol buffers used for?

Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler.

Should I use Protobuf or JSON?

Protobuf supports more data types than JSON. JSON is limited to certain python objects, and it cannot serialize every python object. Protobuf supports a wider range of data types when compared to JSON. For example, enumerations and methods are supported by Protobuf and not supported by JSON.

Is Protobuf like JSON?

Protocol buffers provide a language-neutral, platform-neutral, extensible mechanism for serializing structured data in a forward-compatible and backward-compatible way. It's like JSON, except it's smaller and faster, and it generates native language bindings.


2 Answers

This should fit on an Arduino: https://github.com/nanopb/nanopb

like image 148
jpa Avatar answered Oct 03 '22 00:10

jpa


I've managed, after several attempts, to compile google protocol buffers for Arduino (using lite runtime), and still, the resulting code size was way over the 32k limit. So, for now, GPB isn't a viable option for Arduino projects. (maybe on Arduino Mega?)

I suggest you look at MQTT for a suitable replacement (I'll do that).

like image 45
Manuel Araoz Avatar answered Oct 02 '22 23:10

Manuel Araoz