Question

I'm currently working on a project where I want to control a microprocessor (Arduino) from a web page.

The microprocessor will not be connected physically to the computer.

  • What is the best protocol for communication? (My current choice is TCP).
  • What is the best way to serialize the objects to be sent? (My current choice is JSON).

The server side is written in NodeJs.

Since I'm new to this kind of development I would very much appreciate any input on the topic!

Was it helpful?

Solution

Without details about which arduino you plan on using and what shields you might employ to achieve the interface it is hard to make a definite statement.

I would argue that with the proper shield to provide the ethernet interface TCP would be an acceptable choice.

I am inclined to say you are going to be hard pressed to build a JSON interpreter that fits into the memory foot print of an Arudino. Most of these devices have 32K of program memory, and 1 or 2K of data memory. For embedded devices like this a concise binary protocol on the wire is far more common and easier to fit into the device's limitations.

OTHER TIPS

There is a library called aJson which allows you to do JSON parsing in Arduino. I have used that library to parse response from a YQL call all inside the 32K program memory of Arduino :)

I would suggest using Ethernet or Wifi shield for Arduino to make it connect to internet and then you can use the Ethernet library of Arduino to make HTTP calls. The response format could be in JSON.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top