Open Serial Protocol

From MyRobots wiki
Revision as of 20:01, 2 April 2012 by Carlitos (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Introduction

The MyRobots Connect uses serial communication (UART) to talk with other devices using the same protocol as used by the EasyTransfer Arduino Library. This makes it easy to program Arduino or other microcontrollers to communicate to MyRobots.com through the MyRobots Connect.

Parameters

  Default Baudrate: 9600
  Parity: None
  Start bits: 1
  Stop bits: 1
  Word length: 8

Protocol Steps

 Start Bytes: 0x06 and 0x85
 Size: number of bytes to be sent
 Command: read (0x00) or write (0x01)
 Robot ID: 16-bits Int corresponding to the robot's ID
 Robot Key: 17-bytes null-terminated robot key ASCII string
 Feeds: 16 bits describing if the data sent is relevant or not (see feeds table below)
 Data: one 16-bits Int for each of the 8 data feeds
 Coordinates: 16 bits Int for latitude, longitude and elevation
 Status: 70 bytes null-terminated ASCII string. The string is padded with nulls should it be sorter than 69 chars.
 Check Sum: 1-byte XOR between all the bytes transmitted except the start bytes.
   
Field Name Start Bytes Length Command Robot ID Key Feeds Data (Fields 1 to 8) Coordinates (Lat, Long, Elevation) Status Check Sum
Size (Bytes) 1 x2 1 1 2 17 2 2 x8 1 x3 70 1
Sample Value 0x06, 0x85 0x71 0x01 462 DADA64AFB283413F\x0 0b 0000 1000 1111 1111 65, 42, 36 ... 4532, 5426, 50 Chillin'\x0\x0... 0x67

Feeds

When writing data to the server, it is possible that only some fields should be updated and other left untouched. However, since the messages sent are of fixed length, data will be sent for all fields. The Feeds byte represents the feeds that should be sent to the MyRobots server as described in the table below

Fields bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Correspondence N/A N/A N/A N/A Status Elevation Longitude Latitude F8 F7 F6 F5 F4 F3 F2 Field 1

Arduino

This communication can be simply done in Arduino by using the EasyTransfer library and the following data structure.

  struct ROBOT_DATA_STRUCTURE
  {
    char command;
    int robotID;
    char key[17];
    char feeds;
    int data[max_feeds];
    int coordinates[3];
    char status_str[70];
  };
Personal tools
Namespaces
Variants
Actions