Category: XBEE Radios


The older XBEE modules S2 & S1 are not capable of communicating  with each other. S2 can talk only to S2 , S1 with S1 .You cannot mix the modules.

The new XBEE S2C is capable of communicating with S2 as well as S1 modules.

For S2C to S2C configuration you can check out the previous post Here

XBEE S2C with S2

Place an XBEE S2C module on USB adapter & plug on to USB port of your Laptop.Open the XCTU & search for the radio.Once the radio is detected , select it & load the settings.

Image 2

 

The product family is XB24C  & the Function set is ZIGBEE TH Reg.  (Through Hole Regular).

Image 3

The PANID is set to 1234.

The same PANID to be set for the other Radio also.The Destination LOW address is FFFF which makes the Radio to BROADCAST mode.

AP is TRANPARENT mode which is AT mode

NI is Node Identifier which you can name it as COORDINATOR.

Image 4

 

Image 5

Click on the PENCIL icon on top to WRITE the settings made.

Now plug the S2 module on another USB adapter & plug it to other USB port .

Search for the Radio & select it.

Image 6

Load the settings & click on the UPGRADE FIRMWARE button.

Select the product family as XB24-ZB & the Function set as ZIGBEE ROUTER AT

Image 7

 

Click on FINISH button to complete the upgrade action.

 

Image 8

 

Image 9

 

Set the PANID as 1234 , same as that of COORDINATOR.

JV is ENABLED , so that the radio joins Coordinator on power on.

DL is set to 0 , which is the default address of coordinator.

Image 10

Now the S2 module is configured as Router.

Leave this module on the XCTU & close the Coordinator module.

Start another instance of XCTU window & search for the COM port , select the Coordinator Radio.

Place the XCTU windows side by side.Coordinator to the left & Router to the Right.

Image 11

Click on the Terminal icon on the top & then click the SERIAL connect icon.The open Serial icon now changes to a closed one.Do this on both the windows.

Image 12

Type in some message inside S2C window which will be received by the Router.Both way communication is possible (Full Duplex)

 

Image 13

S2C with S1

Now pull out the S2 module from USB adapter & replace it with S1 module.

S2C is left on the same USB port.

S2C module is to be upgraded Firmware 802.15.4TH .

Click on the Upgrade Firmware icon & select XB24C –> 802.15.4 TH & the latest version.

Click Finish to upgrade.

Image 14

 

The CHANNEL is left to default C.

PAN ID is 1234 , DL is FFFF

MY address is 0

CE is COORDINATOR ENABLE

 

Image15

 

Now start another instance of XCTU & select the COM port where S1 is plugged on.

Select the Radio & load the settings.

S1 belongs to Function set XB24  –>802.15.4

Image16

 

The Channel is set as C

& PAN ID 1234   same as that of Coordinator

DL –> 0  MY address is 1 & CE is set to END DEVICE.c

Image 17

Click on WRITE button to save the changes made.

Place both the XCTU windows side by side.

Click on TERMINAL icon & then SERIAL Lock on both the windows.

Test for communication by typing some message which appears on the other window.

Image 50

Watch this Support Video  :

 

 

 

Advertisements

DIGI International has recently introduced the new ZIGBEE S2C Module .The previous S2 & the traditional S1 both are discontinued.

The new module is powerful with both UART & SPI communication .

Operating frequency band is The industrial, scientific and medical (ISM) radio band
ISM 2.4 – 2.5 GHz

It utilizes Silicon labs EM357 transceiver

The Module is faster and has more RAM & flash memory with much reduced power consumption.

Increases the mesh capabilities & consumes under 1 micro amp sleep current.

Interface options : UART 1 Mb/s maximum (burst)  , SPI 5 Mb/s maximum (burst)

Here is the comparison chart of S1 , S2 & S2C .The Indoor/Outdoor range of S2C has also increased much more as the transmit output power is  double.Also it works on supply voltage from 2.1v to 3.6v DC.

compare

 

Here are the device types of XBEE :

Device types

ZigBee defines three different device types: coordinator, router, and end device.

clip_image001 Coordinator

ZigBee networks always have a single coordinator device. This device Starts the network, selecting the channel and PAN ID.Distributes addresses, allowing routers and end devices to join the network.Buffers wireless data packets for sleeping end device children.

The coordinator manages the other functions that define the network, secure it, and keep it healthy. This device cannot sleep and must be powered on at all times.

clip_image002 Router

A router is a full-featured ZigBee node. This device can join existing networks and send, receive, and route information. Routing involves acting as a messenger for communications between other devices that are too far apart to convey information on their own.

Can buffer wireless data packets for sleeping end device children. Can allow other routers and end devices to join the network.Cannot sleep and must be powered on at all times.May have multiple router devices in a network

clip_image003 End device

An end device is essentially a reduced version of a router. This device can join existing networks and send and receive information, but cannot act as messenger between any other devices.Cannot allow other devices to join the network.

Uses less expensive hardware and can power itself down intermittently, saving energy by temporarily entering a nonresponsive sleep mode.Always needs a router or the coordinator to be its parent device. The parent helps end devices join the network and stores messages for them when they are asleep.

ZigBee networks may have any number of end devices. In fact, a network can be composed of one coordinator, multiple end devices, and zero routers.

Modes of operation
The XBee ZigBee RF Module is in Receive Mode when it is not transmitting data. The device
shifts into the other modes of operation under the following conditions:
— Transmit Mode (Serial data in the serial receive buffer is ready to be packetized)
— Sleep Mode
— Command Mode (Command Mode Sequence is issued, not available when using the SPI port)

Now let us practically see how to configure the Radio S2C. For communication one of the Radios to be configured as COORDINATOR & the other one as Router.

The Product family of S2C is  XB24C  (the previous S2 module belongs to XB24-ZB)

These S2C modules should be able to communicate with older modules, so long as they are all running compatible firmware (i.e. DigiMesh, ZB, etc..)

Following is the pin configuration of S2C.

S2C_PINS

 

To configure the XBEE you need an USB XBEE Adapter which can be easily connected to the USB port of your PC.

USB

 

In case you do not have this USB board , you can use your Arduino board as USB-UART. For this you need to connect RST of Arduino to GND.This bypasses the bootloader of Arduino & the board can be used for Serial communication.Remember to connect Rx to Rx , Tx to Tx (straight & NOT reverse connection) between Arduino & XBEE while configuring.

You can watch this video on how to use Arduino to configure XBEE

https://www.youtube.com/watch?v=wtal7SWZek0

 

Let us start with the configuration.Plug the S2C modules on to the USB adapters & connect to USB ports of your PC.

Open the new XCTU Software .S2C can be configured with this new XCT. The classic old XCtu does not support the S2C module.

Click on the SEARCH icon on top to detect the USB ports.

A list of active USB COM ports will be displayed.

Select the COM ports where you’ve connected the USB adapters.To confirm you can verify your DEVICE MANAGER for the proper COM ports.

In my case one of the USB adapter is allotted COM3 & the other one COM31.

Image 1

Click on NEXT & accept the default PORT PARAMETERS .

96008N1 is the default.  9600 is the BAUD RATE , 8 Data Bits, No Parity & 1 Stop bit.

Image 2

Click on FINISH .

The XCTU scans the USB ports selected & lists the RADIOs found with their unique 64 bit address.

Image 3

Select both the devices & click ADD SELECTED DEVICES.

Now both the Radios appear on the left pane.

Image 4

Let us configure the RADIO at COM3 as COORDINATOR first.

For this click on the COM3 RADIO to load the module settings.

 

Image 5

Once the parameter settings are loaded you can see that the product family is XB24C  (in case of old S2 it is XB24-ZB & of S1 is 802.15.4)

The function set of Firmware is ZIGBEE TH Reg , the Reg stands for Regular & not PRO. TH stands for THROUGH HOLE & not SMD.

Image 6

First thing is to set the PAN ID of the Network. This can be from 0 to FFFF hex.In my case I’m setting it to 1234.The other Radios also to be set in the same PAN ID.

Scroll down further & Enable the CE (Coordinator Enable)

 Image 7

The Destination address DH is left to default 0.

The Destination Address DL is set to hex FFFF which makes the Radio work on BROADCAST mode, so that it can communicate with all Radios in the same PANID.

The Node Identifier can be given any name like “Coordinator”.This naming  is optional.

Image 11_1

Click on the PENCIL icon on top to WRITE the changes made.

Image 8

 

Now let us configure the second Radio as ROUTER.

Click on the second Radio on the left pane to load the settings.

Image 12

The Router setting is quite simple.

Enter the PANID as 1234 , same as that of Coordinator.

Image 13

 

JV CHANNEL VERIFICATION is Enabled

CE Coordinator is DISABLED

Destination Address DL is left to default 0 . (0 is the default address of Coordinator)

rout1

 

rout2

Click on WRITE button to save the changes made.

Image 14

The modules are paired & ready for communication.

Now let us test the communication.On the XCTU window delete the second Radio .Click on the first Radio to load the settings.

Leaving the XCTU window open , start another instance of XCTU &position it to the left of the previous window.

Image 15

Click on the Search button on the new instance of XCTU & select the second Radio .

Image 16

Click on the Radio selected to load the settings.

Image 17

Now the ROUTER Radio is on the left side & the COORDINATOR Radio to the Right.

Image 18

Click the TERMINAL icon on both the windows to enter Terminal mode.

Image 19

Click on the SERIAL CONNECTION icon on both the windows to enter the serial connection mode.

Image 20

You can see the SERIAL Icon in LOCK mode & the AT CONSOLE Status changes to CONNECTED.

Now you can type any message inside console log window & see that received on the other Radio.The transmit message is in BLUE & received message in RED.

Image 21

802_1

Once the Function set is selected , click on FINISH to load the firmware.

802.15.4 firmware is like that of our classic S1 module.But setting is slightly different.

CH channel can be left to default C

PANID to be selected , say 1234 ( the other Radio to be on same ID)

DL address is FFFF

CE coordinator enable for first Radio

802_2

For the second Radio , to be set as END device

CH Channel C

PAN ID 1234 , same as Coordinator

MY address is 1 ( the coordinator MY is 0)

CE is set to END device

802_3

 

Click on WRITE button & test the modules for communication.

In this 802.15.4 Firmware POINT TO POINT communication only is possible & NO MESH Networking.

In a nutshell, the new X2C module is powerful & can work as S2 or the old S1 module.

Watch this support video :

cooltext753793315cooltext753790696

Configuring XBEEs using ARDUINO

 

Generally an USB explorer board is required to configure an XBEE .But the cost of this board is bit high as it has USB to UART IC.

Your ARDUINO board comes in handy & here’s the trick ..

Upload an empty sketch  on to the Arduino

 

void setup()

{

}
void loop()

{

}

Connect Tx to Tx &  Rx to Rx of Arduino & XBEE

Watch this video :

 

                               For a point to point data transmission S1 modules are handy as they are capable of Direct I/O transmission.You can connect a sensor node like a temperature sensor or door switch to an I/O pin of S1 module and program the other module to follow the changes happening to that I/O pin.The changes reflect at the I/O pin of the distant radio.No external Microcontroller is required for a S1 Direct I/O.

            This I/O functionality is not possible with S2 modules.But this can be achieved by reading the API frames transmitted by the sensor node .The XBee Radio at the sensor node should be configured as a ROUTER or END device & the data collecting XBee should be configured with COORDINATOR API Firmware.For parsing the data received & decision making , a Microcontroller is required at the Coordinator end.Arduino is the best choice as it has access to powerful open source libraries.

In this post we shall see how to collect data from a Digital input like a Door switch & how to parse the API frame data received from that sensor node .

Materials required :

 

  1. XBEE S2 type Radio – 2 nos.    2. Door switch – Reed switch type       3.Arduino UNO  

         s2            door_switch            arduino 

 

4.XBEE USB Breakout board for Xbee configuration & to             5.XBEE breakout board to host              connect the Door switch                                                              Coordinator Radio

            XBEE USB BREAKOUT                                       

 

6. Jumper wires, LED, USB cable

 

A Door switch is used as Digital input.The switch has 2 rectangle parts.The one with wires has a Reed switch molded inside. When a  magnet is brought near the reed switch , the normally open switch gets closed.The part without wire has a small piece of magnet inside , which makes the reed switch on.

The Door switch is connected to pin 20 (DIO_0) of distant xbee which is configured with Router AT firmware.

 

Configuration of XBEE Radios.

               One of the Radios to be configured as Router.The Router radio is programmed with AT Firmware & the Destination address  DH, DL is given as the Source address (Serial Number SH,SL) of Coordinator.

The PAN ID & Baud Rate should be same for both the Radios.

Pin 20 – DIO 0 of Router is to be connected to the Door switch.This pin is declared as DIGITAL INPUT.

Plug one radio on to the USB breakout & connect it to PC.Open the new XCTU program & click on the Search icon on the top.The radio is identified & 64 bit Address is displayed along with the Firmware loaded.

xbee_config

 

Click on the      xbee_5   icon & update the Radio firmware as XB24-ZB / ZigBee Router AT.

The Destination address is the Source address of other XBee.Enter the address under DH , DL as shown.

 

xbee_1

 

Scroll down further & under I/O settings change the D0 AD0/DIO0 configuration to  3 which represents Digital Input.

Click on the Write button to record the changes done.

xbee_2

 

Scroll down further to set the IR Sampling Rate.Set this to hex value 1388 which equals 5000 in Decimal.i.e a digital sample is sent every 5000ms or 5 secs.

xbee_6

 

Plug the other Radio on the USB explorer.Click on the update firmware icon & load the

XB24-ZB / ZigBee Coordinator API firmware.

xbee_config2

 

Ensure that the PANID (you can feed your own value ) & Baud Rate are the same for both the Radios.

The Destination address is the Source address of Router as shown below .

 

xbee_3

 

Scroll down further to set the API mode Enable (1).

Click on Write to record the changes.

 

xbee_4

 

Configuration of both Radios is completed now.

Connecting Coordinator Radio to Arduino

 

Remove the Coordinator Radio (you can make an ink mark as C to identify) from the USB board & plug it to the other break out board with LEDs.This has to be connected to Arduino UNO board as per connections shown below :

Pin 1 of breakout board is connected to 5v of Arduino & pin 10 to GND. As the breakout board has built in 3.3v regulator , its safe to provide 5v supply.Pin 2 (TX) of XBee breakout goes to pin 0 (Rx)  of Arduino. Pin3 (RX) of XBee goes to pin 1 (Tx) of Arduino.

XBEE Breakout                 Arduino

PIN 1          ———>  +5V

PIN 10         ———>  GND

PIN 2   (TX)          ———>  PIN 0 (Rx)

PIN 3   (RX)          ———>  PIN 1 (Tx)

The Arduino board is connected to PC using USB cable.

IMG_20140828_081534456

 

The Router Radio is plugged on to the USB breakout. PIN 20 (ADIO 0) is connected to the door switch

 

IMG_20140828_081600221

 

XBEE1_1

 

While connecting the Cordinator radio to Arduino it is advisable to use a Resistor network between Tx of Arduino & Rx of XBEE.This ensures that the voltage level ( which is TTL (5V) at Arduino Tx ) is acceptable around 3.3v at Rx of XBEE.

The Arduino considers 3.3v level from Tx of XBEE as HIGH.So there is no need of Resistors between Tx of Xbee & Rx of Arduino.

xbee2.2

 

Now open the Arduino IDE & select the port where Arduino is connected.Upload the following Sketch .

Remember to disconnect the wires at Rx/Tx pins of Arduino while uploading the Sketch.

 

——————————–

 

void setup()
{
  Serial.begin(9600);
}
void loop()
{
  if (Serial.available()>=21){
    for(int i=0;i<22;i++){
      Serial.print(Serial.read(),HEX);
      Serial.print(",");
         }
         Serial.println();
  }
 
}

————————————–

 

Now power up the Router by connecting the USB cable to the XBee USB breakout.Remember to switch on the Coordinator first & then the Router.

As soon as the Router joins the Coordinator , it starts sending Digital samples collected from pin 20 every 5 secs.

Open the Serial monitor of Arduino to view the API Frames received.

 

s2_xbee1

Let us analyze the API Frame data received from the Router where the Door switch is connected :

 

 7E  0  12  92    0 13 A2 0 40 A9 C5 92     79 9 1 1      0 1    0    0 0  F3

                                 

The API Frame consists of total 22 bytes (counted from 0 to 21) starting with a Delimiter 7E.

The next 2 bytes represent the length of frame starting from Frame type & ending before Checksum.

In our sample here its 0  12   .The second byte 0x12 in HEX is equal to 18 in Decimal.You can see total 18 bytes after this value 0x12 & before the checksum F3.

The next byte 92  is the API Frame type , Hex value 92 represents “ RX I/O Data Received “

The other Frame types are as seen below.

s2_xbee_2

 

s2_xbee_4

Byte no. 4 to 11 represent the 64 bit address from where the data sample is received.

Byte 12 (MSB)  & 13 (LSB)  is the 16 bit address of sender.

Byte 14 represents Receive options. 0x01 is for packet acknowledged & 0x02 means the packet is a Broadcast one.

Byte 15 represents Number of Sample sets included in the payload which is always set to 1.

Bytes 16 & 17 represent the Digital channel mask.Indicates which Digital I/O lines on the remote radio have sampling enabled.In our case we’ve enabled D0 as Digital IN.

  The first byte of channel mask is read as per following table

                    n/a  n/a  n/a  D12  D11  D10  n/a  n/a

n/a  means not available or not defined.

The second byte is read as :

                   D7  D6  D5  D4  D3  D2  D1  D0

In our sample the data reads  0  1  which in binary is  0000 0000 0000 0001

i.e the bit D0 only is enabled.

Byte 18 is the Bit mask field that indicates which analog I/O lines on the remote radio have analog sampling.In our sample it is 0 , i.e No analog samples.

Bytes 19 & 20 deliver the actual Data samples. The data is mapped same as in the Digital channel mask field .    x x x D12 D11 D10 x x    D7 D6 D5 D4 D3 D2 D1 D0

If you receive 0x0 in the first digital sample byte &  0x1 in the second one, that indicates high voltage (level 1) is being received only on pin D0.

The last one is the checksum which is the 8 bit sum of bytes from offset 3 to this byte.

Note that if Analog lines are enabled you receive another single byte before this checksum representing the Analog data.

————————–

You can watch the byte no. 20 which is the last but one in the Frame data.This changes to 1 when the Door switch is closed & changes to 0 when the door switch is open.

Now we shall upload a little modified code on to Arduino.

————————————————

//xbee digital receive

int readValue=0;
void setup()
{
  Serial.begin(9600);
  }

void loop()
{
if (Serial.available() >=21) {

if (Serial.read() == 0x7E){
//skip over the API frame bytes we don’t want
for (int i =0; i<19; i++) {
  byte skip = Serial.read();
}
   readValue = Serial.read();
   Serial.print("Door is   :  ");
    if(readValue == 0 ){
       Serial.println("open");
    }else if (readValue == 1) {
      Serial.println("closed");
    }
}
}
}

————————————

Image 1

 

If you monitor the serial port of Arduino you can get the data whether Door is closed or open

Watch this support video ;

 

XBEE S2 SENDING DIGITAL DATA WITHIN API

 

 

cooltext753793315     cooltext753790696

This tutorial explains how to control an I/O pin of a remote XBEE by sending API frames from a base XBEE.

Materials required :

2 nos XBEE S1 modules

1 USB XBEE Explorer board

1 XBEE breakout board

Jumper wires & LED.

clip_image002

One of the radios works as a Base & the other one as Remote.

The Base Radio is mounted on USB explorer and connected to a PC.This Radio is enabled for API so that frames including AT commands can be transmitted.

The Base XBEE used here  has a 64 bit MAC address of 0013A200 40914B71

The remote XBEE has a MAC address of 0013A200 40A5C495

This is a unique number to every XBEE and is seen printed to the back of the radio.

Also you can see below the address a serial like

XB24-AWI

This represents S1 type of Radios. XB24 – ZB represents S2 type of Radios

clip_image004                   clip_image006

We make use of the new generation XCTU software to configure the Radios.

Download link :

http://ftp1.digi.com/support/utilities/40003026_A.exe

First we shall configure the Remote XBEE . The pin 19 (DIO 1) is enabled low and ensured that the radio is in operating on same Channel,PANID & Baud rate as the Base radio.

We shall use the same USB explorer to configure both the XBEEs.After configuration the remote XBEE is removed and mounted on to the XBEE breakout board & the Base XBEE is used with the USB explorer which is connected to a PC.

Image 1

Plug on the remote XBEE to the USB explorer & fire up the new XCTU software.

On the welcome window click on the second icon to start Searching for the connected XBEEs.

clip_image008

The USB ports are displayed .In our case XBEE is connected to serial port COM128.Select it & click on NEXT.

clip_image010

Port Parameter window opens. Ensure that the selection is Baud Rate – 9600 , Data bits – 8 , Parity – None, Stop bits – 1 & Flow control – None.

Click on Finish.

clip_image012

Now the Device connected to the serial port is detected , which is our Remote XBEE.

Click ADD SELECTED DEVICES

clip_image014

The remote XBEE Radio module appears with MAC address.

clip_image016

Select the Radio  to load the parameters.

Each S1 radio can be assigned a 16bit Source address( MY address) & a 16 bit Destination address (DL).This is user assigned.

Provide a MY address of 0011 for this Remote XBEE. The DL address entered here is 0010 ( which is the MY address of Base radio).

Assign a channel say, C & PAN ID as 3100 .This is also user defined. Ensure that the Base Radio also is configured for the same channel & PANID.

clip_image018

Scroll down the list to select D1 DIO1 configuration.Change it to 4 (LOW).This makes the physical pin 19 LOW initially.

Image 5

Click on the WRITE button to save the changes made.

clip_image022

The configuration for Remote XBEE is done. Close the XCTU.

Remove the XBEE from the USB explorer & plug it to the XBEE breakout board. An LED is connected to pin 20 of this breakout board.The short lead of LED is connected to GND. As we’re using a blue LED (3v ) there is no need of a limiting resistor .

Pin 1 of the breakout board is connected to a +5v supply & pin 10 to GND. As the breakout board has on board 3.3v regulator , we can safely use a 5v supply.

clip_image024

Fig : Remote XBEE plugged on a breakout board .Pin 19 connected to an LED.

Now plug the Base Radio on to the USB explorer & start the XCTU software.

As we did for the previous XBEE ,click the Search icon & then select the Serial port where the USB explorer is connected.On the next screen ensure that the port parameters like Baud rate is same as we selected for the previous XBEE.

Click on Finish & then ADD Selected Devices.

clip_image026

Click on the selected Radio to load the parameters.

The DL Destination Address is set as the MY address of remote radio.The operating channel & PANID should be same as that of remote.

clip_image028

Scroll down further to set the API mode Enable.

clip_image030

Click on the WRITE button to save the changes made.

Now if you switch on the power for the remote XBEE , you can see the ASSOC LED on the breakout board blinking. This indicates that both the Base & Remote XBEEs are paired.

From the XCTU window Switch to Console working mode by clicking on the Terminal icon next to Settings icon.

clip_image032

At the right side corner you can see the “API CONSOLE , Status :Disconnected” message.

clip_image034

To open the serial connection with the radio click on the first icon on the left.

The icon changes from disconnected mode   clip_image036   to connected mode      clip_image038

Now the API CONSOLE Status is Connected.

clip_image040

clip_image042

Click on the green + symbol seen at the bottom to get the Frames Generator window.

clip_image044

clip_image046

Provide a Frame name , say , High & then click on the Generator icon below.

clip_image048

Now the XBEE API FRAME GENERATOR window opens.

clip_image050

Select the protocol as 802.15.4

The Frame type is 0x17 which is REMOTE AT COMMAND REQUEST.

Sending commands over the wireless network to configure a Remote radio can be achieved only in API mode.The AT command can be sent wirelessly to change the state of a Digital output.

After selecting 0x17 as the Frame type , enter the 64 bit Destination address of the Remote Xbee.

For Broadcast mode you can use the address 0x00 00 00 00 00 00 FF FF

Next one is the 16 bit Destination Network address.Set this to 16bit address of Destination device,if known.Set to 0xFFFE if the address is unknown , or if sending a Broadcast.

Next one is Remote command options which is a Bit field to enable various remote command options. 0x02 is to Apply changes on remote.A value of 0x01 disables ACK.

clip_image052

clip_image054

Next is the actual AT command. Click on the ASCII tab and enter D1 ,as we need to toggle the state of DIO 1.

The next one is the Parameter value.If no characters provided here , the state of DIO 1 is queried.

Set this to HEX value 0x05 to send a HIGH value & set to 0x04 to send a LOW value.

Final value is the checksum.

HIGH

LOW

FRAME

Select the HIGH frame & then click on the “Send single frame “ green arrow button.The LED at pin 19 of Remote XBEE glows.

Select the LOW frame we’ve created & click the Send button.The LED at remote end goes Off.

Watch this support video :

 

XBEE DIRECT–ANALOG INPUT/OUTPUT

 

In this post we shall see how to line pass Analog signal between XBEEs.

We make use of S1 series (802.15.4) XBEEs for this demo.Do not try this with S2 series XBEEs ,as S2 do not support I/O line passing.

Configure the S1 modules for point to point communication using XCTU.

The Transmit side XBEE connections are as below :

Image 2

An XBEE adapter is used to plug on XBEE to breadboard.Pin 1 is connected to +ve rail & pin 10 to GND.

A 10k potentiometer is used to vary analog input.The center pin of pot is connected to pin 20 of XBEE which is defined as Analog input (ATD02) .The sampling rate at which data is collected is set to 20 msec (hex value 14 – ATIR14).

One end of pot is connected to +ve rail & other end to GND.

Pin 14 which is the VREF is connected to the +ve rail.This connection is a must which gives XBEE a reference for what voltage an analog sensor is working.

 

At the Receive side an LED is connected to pin 6.

This pin 6 is the PWM 0 of XBEE S1 .PWM acts like Digital to Analog converter to output an analog signal.

Setting is done in XCTU (ATP02) to make PWM0 as PWM output.

The I/O addressing is set to source address of Transmit XBEE. This is set using ATIA10.

 

Image 3

 

XCTU settings for Tx & Rx

 

Image 1

 

Image 2.2

 

Image 3.1

 

Now if you vary the potentiometer at Transmit side , the LED varies intensity at Rx side.

Watch this support video :

 

XBEE DIRECT – ANALOG INPUT/OUTPUT

www.alselectro.com

In this post I shall explain  how to recover a non responsive XBEE modem.

I’ve an USB XBEE adapter on which a S1 PRO modem is plugged on.

When I tried to reconfigure a S1 PRO (802.15.4) Modem , it went unresponsive.Any attempt to write Firmware failed & Recovery process was unsuccessful.

 

Image 10

Before starting the Recovery process I understood that I’ve to Optimize the USB – Serial port settings so that the PC can respond to the XBEE USB adapter. An XBEE USB adapter uses a FTDI chip .By default the FTDI drivers have a latency time of 16msec  & Transmit/Receive size  of 4096 Bytes.

The PC doesn’t get the Bytes fast enough to respond to the Serial device , before it times out.So any attempt to recover or update an XBEE on USB adapter may fail.

To optimize the port settings I opened the Device Manager & Right clicked the USB Serial port where the USB adapter is connected & selected Properties.

 

Image 5

 

Under Port Settings Tab I clicked on Advanced..

Image 6

& Changed the Receive as well as Transmit Bytes to the lowest one 64 from the drop down list.

I Set the Latency Timer to the lowest possible i.e.,  1

 

Image 7

 

Image 8

Clicked  OK & closed the Device Manager.

Now I pulled out the Modem from the USB adapter.

I confirmed that ,under Modem configuration of XCTU , correct type of Modem is selected.Mine is S1 PRO ,so I selected XBP24 & confirmed that firmware is XBEE PRO 802.15.4 . I selected the latest version 10ED.

I check marked ‘Always Update Firmware’ & clicked Show Defaults.

Now I clicked Write button (note that XBEE is not yet plugged on to the USB adapter).

A new INFO window appeared requesting action.

Image 11

At this point I plugged on the S1 module on to the XBEE USB adapter with Reset button kept pressed.Care was taken to confirm that pin 10 goes to GND & pin 1 to supply.

Now I released the Reset button to see the Reprogramming in Action.

The Modem has been successfully recovered & Test/Query operation in XCTU recognizes the Modem.

Watch the recovery procedure in video below :

 

XBEE RECOVERY

 

 

www.alselectro.com

XBEEs can be used without a micro controller thus reducing the cost of the project.In this post we shall see how to configure S1 series XBEEs for Digital In/Out. Two Series 1 XBEE Radios are configured to communicate with each other initially.

XBee radios can be configured for up to 8 digital input pins that can directly control the output pins on a second radio.

Following is the connection detail for the transmit side XBEE.

A push type micro switch is connected to physical pin 20 of XBEE (on the right top of XBEE).This pin is Digital I/O pin 0 & is configured as Digital Input using ATD03 command.

The other side of the switch gets connected to the positive bus.

Add a 10K resistor between the negative power bus and the side of the switch that connects to the XBee. This acts as a pull down resistor, which ensures the input is connected to ground (low) when the switch is not being pushed.

Two AA batteries in a holder supplies 3v DC which is enough to operate an XBEE.

 

Image 7

 

The Transmit side XBEE is configured using XCTU .

The PAN ID is set to 3332 (you can set any value within FFFF ).Please note that the Receiver should be also set for the same ID.

The DL Destination Low address is the source address (MY) of receiver XBEE.

Under I/O settings configure Data I/O pin 0 (DIO0) as hex 3 which makes physical pin 20 as Digital Input.Disable the internal pull up resistors for all pins under PR .

The IR Sample rate is set to hex value  14.This equals 20 msec in decimal.The I/O sample rate sets how frequently to report the current pin state and transmit it to the destination address.

Image 2    Image 3

 

You can enter into command mode by typing three consecutive +++ symbol.

Following is the screen shot of terminal window verifying the settings we made.

Transmit side XBEE settings :

Image 1

 

 

To the Receiver side XBEE , an LED is connected to pin20.

 

 

Image 8

 

The destination address is set to Source (Transmit) address & Data pin 0 (physical pin 20) is set to LOW on start up using command ATD04.

The I/O input address is set to Source address of the transmitter using ATIA command.

As the source address of transmitter is 10 , type in ATIA10.

Do not forget to write the changes using ATWR command.

Receive side XBEE settings :

Image 4

As soon as you exit the command mode you may get stray data at the receiver terminal.This is because the transmitter pin 20 is open or not yet connected to switch.

 

Picture 29

 

Now if you press the switch at transmitter end , High is applied to pin 20 of TX. This condition is transmitted to other end.The RX XBEE pin 20 now goes High , glowing the LED.

 

WATCH THIS SUPPORT VIDEO :

 

XBEE DIRECT–DIGITAL INPUT/OUTPUT

 

 

www.alselectro.com

 

cooltext753793315      cooltext753795865

XBEEs can be used alone , without a microcontroller.This is called XBEE DIRECT.It enables projects that are truly wireless & saves space,power & cost of the project.

Tarang XBEEs have limited I/O pins.By default all I/O pins are DIGITAL OUTPUTs .Some of the pins can be configured as DIGITAL or Analog INPUTs.TARANG modules do not support Analog Output.

Besides transmitting data & changing state of digital pins , no logical decision can be made in XBEE Direct mode.

 

TARANG Module PIN Configuration :

Pin_confign

Clip005

As you can see above in the pin configuration there are 8 DIGITAL I/O pins out of which 6 are multiplexed for Analog Inputs. Two of the pins are multiplexed for serial hardware handshaking signals.

CTS – Clear To Send  pin 12 /DIO7

RTS – Request To Send pin 16/DIO6.

In some cases, simple TX / RX connections are not enough to ensure your data gets delivered intact.In such cases ,Serial flow control can help make sure your data is not lost in transmission.

A transmitter raises its RTS line causing interrupt on Receiver , asking “ can I send Data “.

If Receiver accepts , it will assert its CTS line telling “ yes, you can send Data “.

Handshaking is enabled in Tarang modules using command  ATSHS .By default it is 0 , meaning No Flow Control.Change it to 1 ( ATSHS1) to enable handshaking.Generally handshaking is not needed unless there is another microcontroller in the project.

Note that Signal Strength RSSI debugging light (pin 6) is not yet implemented in Tarang F4.

We shall use 2 Tarang F4  modems to test XBEE Direct functionality.

Following is the set up :

Image6

 

Pin 20 of first modem (Digital I/O 0) is pulled high using a 10k resistor to 3.3v supply & then a switch is connected as shown.

We shall declare this pin 20 as DIGITAL INPUT using command ATID.

Enter command mode by issuing +++.

Enter command  ATID02  ,

AT is the command 

I is I/O control category

D0 is the I/O pin to be configured (note it is D zero & not D letter O)

& finally 2 which represents Digital Input.

 

ATID

Do not forget to give ATGWR command to write changes to modem.

An LED is connected as shown to the second modem’s pin 20 through a 220E resistor  to +3.3v supply.

Now if you press the switch at modem 1 , the condition of pin 20( DIO 0) is transmitted wirelessly to other end.The pin 20 of second modem goes low , lighting the LED.

 

Watch this support video :

 

TARANG XBEE I/O Functions

 

website

saravana

 

Tarang modules are factory configured XBEE  modules ready to use for Point To Point Communication.They operate within ISM 2.4 GHz frequency band & comply with Wireless protocol IEEE 802.15.4 (Series 1 XBEE).

XBEEs can only talk at their configured Baud Rates.Default Baud is  3 , meaning 9600 bits per second Baud.

Changing the Baud rate is bit tricky & we shall see in this post how to achieve it.

I’m using USB Breakout boards to host the Tarang modules.These USB breakouts are made out of

Future Technology Devices International Ltd. IC FT232 to provide USB to UART functionality.They do not need any external power source (USB powered) & handy to use.

One of the Tarang module placed on USB breakout board is connected to an USB port of PC & same way the second one to another port.

 

Clip

 

Now open the TMFT (Tarang Multi Function Tool)  software .It’ll automatically detect the ports to which the modems are connected.

Following is the screen shot of two instances of TMFT software with modems detected.

Image 4

 

Select the first modem port & click on “Query Modem” to confirm Modem presence.Press CTRL+T  to open the Terminal window.

You can enter into Command mode by issuing three consecutive +++ symbols.The modem will confirm with OK . Unlike original XBEEs Tarang will remain in Command mode till it receives ATGEX command.

 

Type in  ATGRD  command to Reset to factory defaults.Do not forget to issue ATGWR  command to write changes on to modem’s memory.

ATSBD is the command to read out modem baud rate. You get a response of 03 indicating the baud rate is 9600.To change this to ,say , 19200 type in ATBD4 .

Now the Baud rate of modem has changed .But if you try to type in ATGWR to confirm , you get error because of baud mismatch between that of Terminal & modem.

Image 1

To accept any new command the Baud rate of terminal should match with that of modem.Click on the down arrow at bottom of Terminal near 9600.From the popping list select the new Baud rate 19200.

 

Image 2

 

Now if you type in ATGWR command , the changes will be recorded on to modem.To verify you can type in ATSBD to see 04 which is the new baud rate 19200.

To exit command mode give ATGEX command .

 

Image 3

In similar manner change the baud rate of the other modem to 19200.

Now the communication is restored between two Tarang modules on new  baud rate.

 

Watch this support video :

How to change the Baud Rate of Tarang XBEE Module

 

website

 

saravana