16

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Manuel Araoz
  • 15,962
  • 24
  • 71
  • 95

4 Answers4

22

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

fredrik
  • 6,483
  • 3
  • 35
  • 45
jpa
  • 10,351
  • 1
  • 28
  • 45
4

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).

Manuel Araoz
  • 15,962
  • 24
  • 71
  • 95
1

Looking at the link provided it says it has bindings for C++. This is essentially what the arduino is programed in. I see no reason why it wouldn't work. If you were to post some details (the data object your trying to process and the C++ code the system generated) we might be able to help. What exactly isn't working?

cstrutton
  • 5,667
  • 3
  • 25
  • 32
  • 1
    Yes, that's what I thought, but I'm having troubles making the generated code compile. (It uses C++ standard library, not fully present in Arduino environment). I'm manually adding the libraries it needs though, but couldn't make it work yet :( – Manuel Araoz Jun 15 '12 at 13:54
0

If you are looking for a tutorial on using Protobuf on Arduino, you can check out my article: A simple Arduino IoT example with Protobuf. The code is available on Github.

The tutorial uses my library Embedded Proto. You have to copy the Embedded Proto to the Arduino library folder, and it will build. Full details in the tutorial.

If you have any questions, let me know.

Bart
  • 1,405
  • 6
  • 32