# Design and Performance of a XBee 900 MHz Acquisition System Aimed at Industrial Applications
## 3 Design of a Wireless Monitoring System
### Logical TDMA Protocol over XBee
However, it requires programming at a deeper level so that programs access the information of the frames. Basically, the API operation mode defines four blocks: (1) start delimiter, 0x/E; (2) length of the frame, 2 bytes; (3) API-specific structure, which is the core of the designed protocol and contains several bytes according to the functionality of the protocol, 14 bytes in Figure 2 (from byte 4 to byte 17); and (4) checksum, which is used for error control purpose, 1 byte. Designed frames are serialized to the XBee modules, which are responsible for the transmission. Figure 2: Chronogram for simple sampling distributed monitoring operation. Processing of the nodes and exchanged messages. The functionality of the protocol is implemented by means of four different types of frames. Figure 3 shows a _broadcast measurement command_ frame sent from the Coordinator Node to the Smart Measuring Nodes, as shown in Figure 2. This frame is used by the Coordinator Node to request the XBee module to broadcast a measuring order to all remote nodes. When the Smart Measuring Nodes are in measuring operation, this order triggers the process of reading the sensors and sending the values to the Coordinator Node. The whole frame accounts for 18 bytes, but the length of the frame field only considers the size of the API-specific structure. For this reason, it shows a length of 0x000E bytes (14 bytes). Next, the most relevant fields are described. The 0x00000 FF value is used as the broadcast destination address (64 bits) in XBee. The broadcast measurement order is identified at the DataValue1 and DataValue2 fields with 0x00 and 0x00 values, respectively. Every frame carries the Number of Sequence which is used at the Smart Measuring Nodes to identify whether any frame was lost. In addition, every frame carries the checksum to detect transmission errors. Sometimes, it may be necessary to send a frame to a specific Smart Measuring Node. This just requires setting the specific destination address of one XBee module (e.g., 0x0013A200 41 AF5A69). Thus, the same frame can be used for Unicast measurement command operations, just by changing the destination address. Figure 4 shows the structure of the frame sent from one Smart Measuring Node to the Coordinator Node. It represents an example of frame issued by a node with identifier 0x03 for delivering back to the Coordinator Node the acquired values. This frame is created by the device microcontroller and serialized for transmission to the attached XBee module. Most relevant fields include the destination address of the XBee module attached to the Coordinator Node (e.g., 0x0013A20041 AF5 ADC); the identifier of the Smart Measuring Node (Nodel), 0x03; the number of values sent; in Figure 4, four sensors were connected to the board, 0x04; the actual value sent for all four sensors, 0x07 FF; the sequence number, 0x01 and finally the checksum for error detection. This frame allows for a maximum number of 255 nodes. Since two bytes are used for transmitting the values read from the sensors, a resolution of up to 16 bits is allowed, which should be enough for most industrial systems. The size of the frame may change depending on the number of values carried in the frame. This number depends on the configuration of the system. In addition, the format of the frames allows for different configurations. This permits sending values read simultaneously from different sensors at the board, the so-called simple sampling or sending values read from the sensors at different time instants, the so-called multiple sampling. The parameters that describe this behavior are determined at the configuration stage. Configuration frames are issued at the configuration stage, at start-up time. In this stage, the Coordinator Node sends the configuration to every Smart Measuring Node accordingly. Once Smart Measuring Nodes are configured, they enter into the measuring operation stage as configured.