ZigBee communication protocol
For transmitting data from Fio v3 via Xbee boards, the data should be written on “Serial1” instead of “Serial” as the RX/TX communications are set up separately on “Serial1” for Fio v3. In most common networks used for communications using Xbee boards, either the microcontroller attached to the Xbee is responsible for transmitting the serial data or two independent XBee boards can be configured to function independently without any microcontrollers attached. In the RooBot system, the inputs from the XBee board on the wireless controller, which is not connected to a microcontroller, are transferred to the Xbee attached to the microcontroller. In such a case, an Xbee connected to the wireless controller sends raw data packets to the receiver and the microcontroller receives this data in an API mode packet. These packets are not available to the microcontroller as serial inputs.
Figure 1: API Frame mode data transmission
(Click to view a larger image)
Figure1(a) illustrates an outline of an API (RX packet, 16-bit address) frame. Figure 1(b) is an example of data encoded in an API frame (hexadecimal format). The following is a brief description of the packet data format:
Byte 1: All API frames begin with 7E.
Byte 2-3: The next two bytes notify the length of the packet data (00 12, which is equal to 18 bytes).
Byte 4: The next byte contains the API identifiers. According to Xbee manual, 0x83 identifies the packet as a 16-bit address RX packet containing I/O data.
Byte 5-6: Source address of the packet, which was configured manually for both the Xbee boards.
Byte 7: It notifies the RSSI (signal strength).
Byte 8: It notifies the option used for this packet.
Byte 9: It notifies the number of samples included in this packet.
Byte 10-11: These bytes indicate which channels are active in the sample. The pins are read according to the type of configuration encoded in these bytes which read in binary format by the microcontroller.
Byte 12-13: Contains the digital input data.
Byte 14-(n-1): These bytes contain the ADC reading (in the example 4 channels are active, so next 8 bytes contain ADC readings).
Controller circuit
Figure 2 illustrates the demonstration presented during the progress review 4 in the lab. To simulate the wireless controller, a potentiometer and a push button were connected to provide inputs to the Xbee mounted on the XBee Explorer. The potentiometer is used to set jumping power of the toy and the button is used as the launch button to execute the jump corresponding to the input power. A notification LED (LED1 in figure 31) was installed in the controller circuit to acknowledge the transmission of launch command. Once the launch command was executed from the controller, the servo motor connected to pin 9 of the microcontroller board moved to the angle value input using the potentiometer. Two LEDs, LED2 (red) and LED3 (green) (see figure 1), were installed to notify the user about the state of the jumping system. The green LED indicates that the jumping system is ready to for the next input from the user and the red LED indicates the system is busy executing user command (rotation of servo in this case) and the user should wait till the green LED is ON and then execute the next command.
Figure 2: ZigBee communication demonstration set up
(Click to view a larger image)
The Xbee board on the wireless controller is not connected to any microcontroller. Hence, packets of raw input data are transmitted as a whole instead of the naïve serial packet communication between two ZigBee devices used for communication between two microcontroller boards. The input/output pins (DIO 0-7) of the Xbee used in the wireless controller were configured to ADC input signals to be transmitted to the paired Xbee. The potentiometer and the button were connected to provide input to two of the configured 8 DIO pins.