Category: XBEE Radios


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

  In this workshop we shall see how to communicate between  two Arduinos Wirelessly using XBEE Radios.

Hardware to keep in handy are :

2 x  Arduino UNO board

2 x  Series 1 XBEE Radio

2 x  Breakout Board  for XBEE

& Connecting Wires ,USB A-B cable,LED , Mini Buzzer.

   

Picture 1

To start with we’ve to configure the Series 1 XBEE Radios.For this we shall make use one of the Arduino boards.The USB –UART portion of the Arduino is used for this purpose.But the Arduino Boot Loader residing under the AtMega328 chip of Arduino will take over command as soon as you power the board.To Bypass the Boot loader there are two methods.

1. You can carefully Remove the AtMega328 controller IC from the Arduino UNO.

removechip2

2. If you are not comfortable removing the chip,there is an easier Hack.

  Just Load an empty Sketch on to the Arduino UNO.

 

empty_sketch

     

Upload this Empty Sketch on to the Arduino UNO board.Now the Boot loader is bypassed & only the USB-UART portion of Arduino is used.

Now you need to wire only 4 connections between Arduino & XBEE.

ARD_XBEE_CONFIG

 

Plug in the first XBEE on to the Breakout Board.

GND of Arduino is connected to pin 10  (GND) of XBEE.

5V of Arduino is connected to pin 1 of XBEE EXPLORER BOARD.

As XBEEs operate on 3.3V you should be extremely careful to ensure that  the power to pin 1 of XBEE is always 3.3V.If you are using a breakout board,you can use 5V ,as the Breakout board has an inbuilt 3.3v regulator.

Note that if you use 3.3v of Arduino to Explorer board of XBEE the code may not be executed.This is because the Explorer has inbuilt 3.3v regulator & if you feed 3.3v as input, the supply to XBEE may slightly drop down to 3v.This may cause malfunction.

If you are using Explorer board for XBEE, always connect  5v Arduino to power up the XBEE EXPLORER.

RX (0)  of Arduino is connected to PIN 3 (DIN) of XBEE.

TX (1)  of Arduino is connected to PIN 2 (DOUT) of XBEE.

Please note This connection is only for Configuration Mode.While on working mode you’ve to interchange RX,TX connections.

We shall make use of a simple Terminal Software  COOLTERM .You can download it here.

Note down the COM port allotted to the Arduino board under Device Manager of your PC

comport

 

Now open the Terminal software COOLTERM.

Click on OPTIONS & under Serial Port make sure that the port allotted (COM5 in our case) is entered &  Baud Rate setting  : 9600  ,Data Bits : 8, Parity : None ,Stop Bits : 1  (9600 8N1).

Under Terminal  option check mark “Local Echo “.This will enable you to see what you type under Terminal window.

 

coolterm1    coolterm2

Click CONNECT  to connect with the COM port where Arduino is connected.

Now at the Left hand side bottom you can see the confirmation that the Terminal is communicating with COM 5 with settings 9600 8 N 1.

Type 3 consecutive +++  symbols.Do not hit Enter key.

Just type & wait to enter the COMMAND MODE.

Once you enter the command mode you’ve to feed the AT commands within 10 seconds.Otherwise it will enter the Transmit mode.Again you’ve to type +++ & wait.

 

 coolterm5

For two XBEES to communicate , both should have same PANID.

This is achieved by typing ATID followed by a 16 bit address,which is entered in HEX  as 4 bytes.Valid range is 0000 to FFFF.

You can enter any 4 digit number between this Range.The other XBEE should also work under the same PANID.

DH is destination High byte address,which we shall leave to default value 0.

DL is Destination Low byte.Set this to  10 .

MY is the short 16bit address used to identify your XBEEs.Valid range is 00 to FF.Set this to 11.

BD is to set the baud rate.Set it as ATBD3 , which represents 9600.

Finally don’t forget to give the WRITE command  ATWR.

Now the configuration of first XBEE is over.

Pull out the XBEE gently from the breakout board after disconnecting USB cable from Arduino.

Place the second XBEE on the Breakout board & connect the USB cable to Arduino.

 

Second XBEE Configuration

Configure the settings as below :

ATID1001    –  PAN ID same as that of first XBEE.

ATDL11       — Destination address Low is 11 which is the MY address of first XBEE.

ATMY10      — Source address .Set this as 10.

ATBD3        — Set Baud Rate as 3 (9600)

ATWR     — Write command to register the changes made.

 

second_xbee   first_config

Now your XBEEs are configured & ready to use.

If you had pulled out the IC from Arduino,replace it carefully so that the notch on IC matches that of the IC base on board.

Connecting XBEEs to Arduino for Wireless Communication

We shall test the setup for two way communication.

We are going to connect a Buzzer  to the 2nd Arduino (we will call it as  B ).The first Arduino (we will call it as A)  will send a character “ K” & it is transmitted through the first XBEE connected to Arduino A.

The Arduino B will look for a capital “K” & switches ON the buzzer for 5 seconds.After that it sends back a character “O” .Arduino A will wait for this character & on receiving ,it lights up an LED for 5 secs.

Both the Transmit & Receive parts of both XBEEs & Arduinos are tested successfully by this setup.

ARD_XBEE_COM

 

 

TRANSMIT Side Code  ARDUINO “A”

———————-

/*This program initializes Serial port & sends a character capital “K” & then waits for a

     character   ‘O’ to switch ON  an LED at pin 13 for a short time */

char readChar;
void setup()
{
pinMode(13,OUTPUT);
Serial.begin(9600);
delay(500);
Serial.print(‘K’);
delay(500);

}

void loop()
{
  if (Serial.available() >0){
   
    readChar=Serial.read();
    if(readChar==’O’){
       digitalWrite(13,HIGH);
    delay(5000);
    digitalWrite(13,LOW);
   
              }
       }
}

———————–

 

RECEIVER side Code  Arduino ‘B’

——————

/* This code waits  for a character capital ‘K’ over Serial port & switches ON a buzzer

     connected to pin 11 for 1.5 secs..Then it sends a character capital ‘O’ over Serial

      to light up an LED at the Sender side Arduino A.  */

int Buzzer=11;
void setup()
{
  pinMode(Buzzer,OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  if(Serial.available()>0){
       if(Serial.read() == ‘K’){
      digitalWrite(Buzzer,HIGH);
      delay(3000);
      digitalWrite(Buzzer,LOW);

     delay(1000);

     Serial.print(‘O"’);
       }
    }
}

—————————

 

CODES

 

Watch this Video on How to configure XBEEs using Arduino Board & setup Wireless Communication :

 

 

Configure XBEEs using Arduino & test for Wireless Communication

 

 

 

 

 

    cooltext753793315       cooltext753790696

   XBEE Radios are available in wide varieties ,SERIES 1 (802.15.4 protocol), SERIES 2 (Zigbee protocol –40 mtr Range) & PRO.

In this post we shall see how to configure a pair of Series 2 XBEEs & make them communicate with each  other. When you buy a pair of XBEE s  & try to use  in your project,it is not going to work.

The XBEEs should  be configured to make them communicate.SERIES 2 configuration is different from that of SERIES 1. One of the S2 Modem is to be configured as COORDINATOR & the other one as ROUTER.

Please note that you cannot combine S2 with a S1 modem.Communication is not possible if you try to mix S1 with S2.

Always use same type of modems for your projects,But you can mix S2 with S2 PRO.PRO is   with more Power  output & does not require Line Of Sight,but very expensive.

 

                    SERIES2

 

We make use of XCTU software from DIGI to configure  XBEE Radios.

Download_XCTU & install it.

We shall use an USB type of XBEE Explorer ,which requires no external power supply & has a built in 3.3v regulator.USB A-B type of cable is used to connect this Explorer board to your PC.

Plug in the S2 XBEE module on to the explorer board in correct direction.The pin 10 of XBEE is GND & it should match the ground pin of explorer board.If you turn to the back of explorer board you can see  a broad green patch which is Ground connection & it is connected to pin 10.

usb_xbee1      XBEE

Connect this board to one of the USB ports of your PC using the A-B cable.Same way , make use of another explorer board with second  XBEE & connect it to another USB port of PC.

Open up the Device Manager & confirm that your boards are recognized and allotted ports.

device

 

If the USB explorer boards are not recognized by Windows,you’ve to install the FTDI  drivers.Download drivers Here.

Now fire up the first instance of XCTU. You can see XCTU has recognized the COM ports to which modems are connected.

CONNECT1

Select the first port COM13 & confirm that the baud rate entry is 9600 ,Flow control – None ,Data Bits – 8, Parity – None & Stop Bits – 1.

Also ensure that “Enable API “ is NOT checked. Press the Test/Query button.

Now the XCTU confirms the presence of first modem.

Keep aside this window & fire up the second instance of XCTU.In the new window select the other port , COM14 . Settings are same as for the first modem.

Click Test/Query button to see that the second modem connection is confirmed.

Keep side by side both windows as below :

connect2

Now we shall see the first modem setting ,which is to be configured as COORDINATOR.

Click on Modem Configuration button of the left window (COM13).Make sure  the “Always Update Firmware” is checked & then click on Read button.

 

con3

If you are working on XCTU for the first time ,it will start Updating Source files .This may take 5 – 10 minutes.

update

If the source is up to date ,you see the configuration of modem when you click Read.

Select from the drop down Function set as “ZIGBEE COORDINATOR AT “ .

Note that it is Coordinator AT  & not API. Make sure that type of XBEE is XB24-ZB ,which means

Zigbee Protocol S2 modem.

Under Networking ,change the PAN ID to some four digit number,say 3312. You can leave it as 0,it doesn’t matter

for a point to point communication.

COORD1

Under Addressing folder click on Set next to NI-Node Identifier & enter COORDINATOR.

You can enter what ever name you like.To be precise enter as COORDINATOR & click OK.

COORD3

Also ,under Addressing folder you can see the unique Serial Number of the XBEE in 2 parts

Serial Number HIGH & LOW.

This is the same serial number you see at the back (pin side ) of the XBEE.

pin_side

Note down this number,as you’ve to feed it as Destination address of the other XBEE.

COORD2

Now click on the Write button  to fuse the changes we made on to the Modem.

WRITE

Now we shall configure the second modem as ROUTER.

Click on Read button of COM14 window .

From the drop down Function Set select “ZIGBEE ROUTER AT” & confirm the modem type as XB24-ZB.

Click on PAN ID & enter the same number we’ve given for the first modem (3312).

ROUT1

Under Addressing folder click NI –Node Identifier & enter name as ROUTER.

ROUT2

 

Now it is time to declare the Destination address for the modems.On COM14 window under addressing

click DH – Destination Address High & enter as 13A200 ,

which is the SH –Serial Number High of first modem.

click DL – Destination Address Low  & enter 408ADA92 ,

which is the SL –Serial Number Low of first modem.

Note that yours is different Serial number ,as you see at the bottom of your XBEE.

ADDRESS1

Click the Write button on the COM14 window.

Now click on COM13 window (COORDINATOR modem) & enter the address DH & DL ,

which is the serial number SH & SL of COM13 – Router modem

 

ADDRESS2

Don’t forget to click the Write button to enable the changes made.

ADDRESS3

Now the configuration setting is over.To test the connection click on Terminal in both the windows.

Type in some text inside COM13 (COORDINATOR) ,it will be reflected inside COM14 (ROUTER)

window.Same way type in some text inside COM14 , it will be received inside COM13.Once you configure

the modems ,you need not bother which one is Coordinator & which one is Router.

COMMN_OK

You can also test the AT commands.

Type in 3 consecutive +++ symbol & wait to get OK.Do not type Enter,just wait to get into command mode.

Type ATDL to get the Destination Low address

  ATSL to get the Serial Number LOW

ATID to get the PAN ID

ATCN  to Quit the Command mode.If you do not enter anything for 10 seconds,it will automatically

come out of command mode.

ADDRESS5

 

You can remove the XBEEs from the explorer boards & use it to interface with a Microcontroller chip.

You’ve to use pins 2 & 3 (TX/RX) of XBEEs to connect with a Microcontroller .

Watch this video  :

CONFIGURING SERIES 2 XBEES using XCTU

 

For availability of DIGI XBEE Radios & Explorer boards contact :

cooltext753793315                 cooltext753790696