Serial JSON-RPC Server for Arduino

Library code:

This is a simple implementation of JSON-RPC server for Arduino. This library is based on fantastic aJson library for Arduino (source code) and on initial unfinished work by someone from here.

This library is useful for controlling Arduino (Slave) from PC or external System-on-Chip (Master) over serial line. It is a lot easier and less buggy to perform remote procedure calls and handle results instead of implementing proprietary protocol with custom messages.

This library can make life easier when using Udoo which contains CPU running Linux along with Arduino Due connected with Serial bus.


  • Lightweight JSON-RPC version 1.0 (without Ids)
  • Any number of arguments
  • Numerical/String return values
  • Does not block execution
  • The code is heavily based on Macros for automation of of defining remote procedures

Getting Started

  1. Derive JsonRPCServer with your own class,
  2. Use DECLARE_JSON_PROC macro to specify your remote procedure with return value
  3. Use REGISTER_JSON_PROC macro to register previously defined procedure

    (Leave the order of macros as in the above example)
  4. Implement method of predefined procedure:

  5. Create an object from your class passing Serial stream (or any other Arduino Stream) as an argument:

  6. Call begin to with number of implemented remote procedures

  7. Call process() each loop iteration to process Stream buffer, execute procedures and return result:



2 thoughts on “Serial JSON-RPC Server for Arduino

  1. Hey Mier,

    Great work here. I’m assuming you’re working with a UDOO? Using serial tty/devACM0?

    My Arduino picks up tty/devmxc3 which picks up nothing through a serial monitor… Any ideas?


    • If I understand you correct, UDOO is not resetting the device when you connect to it with UART. You need to reset it manually by shortening the appropriate jumper.

Leave a Reply

Your email address will not be published. Required fields are marked *