1

I am using XBee Digimesh Modules in API-Mode to send data between different industrial machines allowing them to share data, information and commands.

The API-Mode offers some basic commands, mainly to perform addressing and talk with the XBee Module itself in order to do configuration, etc.

Sending user data is done via a corresponding XBee API-Command which allows to send user-defined data with a maximum payload of 72 Bytes.

Since I want to expand this communication to allow integration of more machines, etc. I am thinking about how to implement a basic communication system that's tailored perfectly to the super small payload of just 72 Bytes.

Coming from the web, I normally would use some sort of JSON here but that would fill up the payload very quickly.

Also it's not possible to send a frame with lot's of information since this also fills up the payload very quickly.

So I came up with a different way of communicating. Instead of transmitting frames packed with information, what about sending some sort of Messages like this:

  • Machine-A Broadcasts: Who's there?
  • Machine-B Answers: It's me I am a xxx-Machine
  • Machine-C Answers: It's me I am a xxx-Machine

Machine-A now evaluates the replies and decides to work with Machine-B (because Machine-C does not match As interface):

  • Machine-A to B: Hello B, Give me some Value, please!
  • Machine-B to A: There you go: 2.349590

This can be extended to different short messages. After each message the sender holds the type of message in a state and the reply will be evaluated in relation to the state / context.

What I was trying to avoid was defining a bit-based protocol (like MIDI) which defines all events as bit based flags. Since we do not now what type of hardware there will be added in the future I want a communication protocol that's very flexible and does not need a coordinator or message broker, etc.

But since this is the first time I am thinking about communication protocols I am curious to know if there might be some existing frameworks that can handle complex communication on a light payload.

Simon Kemper
  • 635
  • 1
  • 7
  • 16

1 Answers1

0

You might want to read through the ZigBee Cluster Library specification with a focus on the general commands. It describes a system of attribute discovery and retrieval. Each attribute has a 16-bit ID and a datatype (integers of various sizes, enumerated types, bitmaps) that determines its size.

It's a protocol designed for the small payloads of an 802.15.4 network, and you could potentially based your protocol off of a subset of it. Other ZigBee specifications are simply a list of defined attributes (and commands) for a given 16-bit cluster ID.

Your master device can go through a discovery process to get a list of attribute IDs, and then send a request to get values for multiple IDs in one shot. The response will be packed tight with a 16-bit ID, 8-bit attribute type and then variable length data. Even if your master device doesn't know what the ID corresponds to, it can pass the data along to other systems (like a web server) that do know.

tomlogic
  • 11,489
  • 3
  • 33
  • 59