xbee series 2 (Znet 2.5) RSSI

Hey everybody,

I have a problem and hope that there might be somebody who has an idea :) I am working with XBee shields Series 2 (or Znet 2.5, whatever you prefer). All in all I have 6 shields that are mounted to Arduino Duemilanoves which have some LEDs and Sensor technique connected. One additional Arduino has the MCU removed and works as the network coordinator (Znet 2.5 Coordinator AT), the other modules are configured as Znet 2.5 Router/End Device(s). The communication is working fine, I can send and receive signals and messages and everything else. But I was wondering if it is somehow possible to force the shields to send a RSSI signal permanent or at least on request... So the best would be if all the modules send the signal strength to the coordinator who will send them to the PC and display them on any kind of graphical interface (my dream ::) )I was reading a lot about RSSI and unfortunately most of the tutorials are for the series 1 and it seems that even in API mode Series 2 doesn´t send the RSSI signal in the package. And I don´t really want to work with the ATDB command due to the fact that modules should be able to send their signals all the time. So I guess I only have two options, first: one of you guys has a solution for me or second: I have to buy the series 1 modules in order to fix this problem. But I would prefer solution one ;-) And for now it doesn´t matter that much how to display the signal strength (Processing or any other program). Or maybe if somebody knows how the Range Test with X-CTU is performed? Because this one is working, too but only if I configure the devices with each other DH/DL, SH/SL address and let them send the same messages at the same time. But the principle would be the same I guess?

So any help is welcome!!! thanks a lot...

Hi series 1 and series 2 use tow different protocol so is impossibole for them to communicate togheter, well i don't understand why you can't use the DB AT command but an option could be connect the Xbee pin6 to an analog in of the arduino, the pin6 can be configured to report the RSSI in "pwm format" so you could read the value from arduino, elaborate it and send back to the coordinator... make sense to you?

Alessandro

hey, thanks for your reply... maybe I didn´t explain it well but I know about the protocol problem, Its not possible to communicate between those two. My master plan was just to swap out the series 2 against series 1 to get rid of the problem :)

I found this pin-thing in many posts but to be honest, I don't know how to connect the pin6 to analog input of the arduino. do I have to wire it up or is it just a virtual connection?

oh and as regarding the DB command... Its written in the manual that is not very exact and its better to use it rarely, so I was searching for alternatives but could not find a good one. But if you could explain the pin6 connection? that would be really gread... 8-)

thank you so much!!!!!

ok now the issue 1 vs 2 is clear,
reagrding the pin6 should be simple and yes you need to wire phisically the Xbee pin6 with an Analog IN pin of Arduino, my only concern regard the fact that pin6 is a PWM out and i don’t know if arduino have problem to use this kind of signal as a “normal” (voltage variation) signal i can say 90% yes becouse of the high speed of the PWM out and low speed of the Analog in of Arduino that should “see” the PWM as a continous signal… but, you have to try

ok so I will try this out and see how the Arduino likes a continues signal. Did you do this pin6 connection thing yourself? I am just worried of destroying the XBee shield. So I just solder a wire to the pin and plug it into one analog port? Or do I need resistors in between? sorry for the stupid questions and thanks for your patience :)

Good question! I have the exact same doubt, Arduina. Have you discover it ? Anyone knows ? I'm trying to figure out a way to get the RSSI from a xbee module ( I have 2 series 1 and 2 series 2, so the serie is not a problem ;) ). Thanks !

I will try it out tomorrow and will let you know... cross ur fingers (for me and the shields ;-) )

no proble connection RSSI to analog in because xbee operate a 3.3 V and arduino 5V so perfectly compatible, other thing would be connect an Digital or Analog out of arduino to the xbee (for example in my case i connect the sleep pin) in thi case you nedd a 2\3 resistor partitor in order to low the 5 V form to a 3.3 or less (non too less) to xbee. Also the shield operata in the same way... arduini RX in connected directluy to xbee arduino TX pass trough a partitor

ah ok, sounds like hope ;-) but do you have a photo of your setup? i didnt find a single image of a wire soldered to the xbee shield pins and i am still a bit worried (not to do any damage to the shield and the pins)... that would be great help... thanks alot :)

sooo, today I did it :-) I soldered a wire to pin 6 of the shield and connected it directly to the analog pin... and, its working. I receive signals (either "0" or a whole bunch of numbers). so this one is working but now I am a bit confused about the numbers I receive. When I send the ATDB command, the shield responds with for example "37" which is the received signal strength in -dBm... but the data coming directly from the Arduino are something like this "686686". Does anybody know what this reading shows? is it like a 3byte message and one part of it is the -dBm value? or do I have to convert it somehow? thanks for your help!

have you configured the pin 6 as RSSI output using x-ctu sw?

Your analog input is going to read a value between 0 and 1023 which corresponds to 0 to 5v. Because an Xbee uses 3.3v logig, the max value seen by the analog pin is 3.3v. If your Xbee pin 6 is set to 3.3v that would be a value of approximately 675 from the analog read. Im assuming your 686686 is really 686 repeated which is close to the theoretical 675. you can take a multimeter and read the voltage of the xbee pin 6 to confirm this.

I don't have any info on configuring the xbee to output rssi on pin 6, but assuming it is possible, and that it changes voltage with varying signal strength, you can then use the analog in value of 0 to 675 to determine the signal strength. You would have to perform an experiment to associate the analog value with the "signal strength".

hey everybody, thanks a lot for your help :) It makes sense to me with the numbers now and I will try it out... 8-)

hi arduina any update? i plan to use the same methods in my project feedback are welcome ;)

Ciao

Hey...

ok, what I did: I soldered a wire directly to pin6 of the Xbee Shield and then plugged the other end of the wire into digital pin 9. I read also in this forum that not all pins are able to receive PWM signals. Here is a photo:

Anyway, for the sketch I used the pulseIn function:

duration= pulseIn(pwmpin,HIGH); if(duration!= lastdurstate) { Serial.println(duration); }

This function gives me values between 0 and 255... I tested it in our office and it worked quite well: the greater the distance between coordinator and module the smaller were the values I received. But I didn´t programm a filter function yet because what happens sometimes is that I receive values like -123456 or 123456 when coordinator and module are lying next to each other (very close). But for my prototype it worked. Finally. ;-) So thanks again for your help and suggestions and good luck for your projects!!!

Hello Arduina, and hello everybody! :slight_smile:
I’m quite new with Arduino and I’m now facing the same problem that was posted in this forum… I’ve tried to wire the XBee board pin 6 (I’m using this XBee Simple Board http://www.robot-italy.com/product_info.php?products_id=749) to the analog pin 3 on the Arduino. I’ve used this code, but it’s not working and I don’t know why… :’(

/*
   XBee_Receive_Example3_modifiedRSSI
  
  An example of using the Arduino board to receive data from the 
  computer.  In this case, the Arduino boards turns on an LED when
  it receives the character 'H', and turns off the LED when it
  receives the character 'L'.
  
  The data can be sent from the Arduino serial monitor, or another
  program like Processing (see code below), Flash (via a serial-net
  proxy), PD, or Max/MSP.
  
  The circuit:
  * LED connected from digital pin 13 to ground
  
  created 2006
  by David A. Mellis
  modified 14 Apr 2009
  by Tom Igoe and Scott Fitzgerald
  
  modified 2009
  by Marta86
  
  http://www.arduino.cc/en/Tutorial/PhysicalPixel
  */

 const int ledPin = 13; // the pin that the LED is attached to
 int incomingByte;      // a variable to read incoming serial data into
#define analogPin 3
 int RSSI=0; // holds the Received Signal Strength Value
int address=0; // holds the 16-bit address of the sender

 void setup() {
   // initialize serial communication:
   Serial.begin(9600);
   // initialize the LED pin as an output:
   pinMode(ledPin, OUTPUT);
     pinMode(analogPin, INPUT);
    

 }

 void loop() {
   // see if there's incoming serial data:
   if (Serial.available() > 0) {
     // read the oldest byte in the serial buffer:
     incomingByte = Serial.read();
     // if it's a capital H (ASCII 72), turn on the LED:
     if (incomingByte == 'H') {
       digitalWrite(ledPin, HIGH);
     } 
     // if it's an L (ASCII 76) turn off the LED:
     if (incomingByte == 'L') {
       digitalWrite(ledPin, LOW);
     }
   }
   address = Serial.read(); // the sixth byte is the low part of the address
      RSSI = Serial.read(); // the seventh byte is the RSSI value
      analogWrite(10,(100-RSSI)*2); // analog write a brightness roughly corresponding to distance
 }

…Could please someone help me?
Arduina, could you maybe post your code? (ehm… and if u are italian, we can write in italian too, would be easier for me :wink: …)

Tx a lot :sunglasses:

Hello everybody, i’ve tried to upload the following sketch on the first Arduino + XBee (the “sender unit”):

/*
   XBee_Send_Example3_modifiedRSSI
  
  An example of using the Arduino board to send data from the 
  computer.  In this case, the Arduino boards should send the RSSI value to the other XBee
  
  The data can be sent from the Arduino serial monitor, or another
  program like Processing (see code below), Flash (via a serial-net
  proxy), PD, or Max/MSP.
  
  created 2006
  by David A. Mellis
  modified 14 Apr 2009
  by Tom Igoe and Scott Fitzgerald
  
  modified 2009
  by Marta86
  
  http://www.arduino.cc/en/Tutorial/PhysicalPixel
  */
  
  int RSSI=0; // holds the Received Signal Strength Value

 void setup()
{
  Serial.begin(9600);
}

void loop()
{
  RSSI = Serial.read();
  Serial.print(RSSI);
  Serial.print('H');
  delay(1000);
  Serial.print('L');
  delay(1000);
}

Then, i’ve uploaded this sketch to the second Arduino+XBee (the receiving unit):

/*
   XBee_Receive_Example3_modifiedRSSI
  
  An example of using the Arduino board to receive data from the 
  computer.  In this case, the Arduino boards turns on an LED when
  it receives the character 'H', and turns off the LED when it
  receives the character 'L'.
  
  The data can be sent from the Arduino serial monitor, or another
  program like Processing (see code below), Flash (via a serial-net
  proxy), PD, or Max/MSP.
  
  The circuit:
  * LED connected from digital pin 13 to ground
  
  created 2006
  by David A. Mellis
  modified 14 Apr 2009
  by Tom Igoe and Scott Fitzgerald
  
  modified 2009
  by Marta86
  
  http://www.arduino.cc/en/Tutorial/PhysicalPixel
  */

 const int ledPin = 13; // the pin that the LED is attached to
 int incomingByte;      // a variable to read incoming serial data into
#define analogPin 3
 int RSSI=0; // holds the Received Signal Strength Value
int address=0; // holds the 16-bit address of the sender

 void setup() {
   // initialize serial communication:
   Serial.begin(9600);
   // initialize the LED pin as an output:
   pinMode(ledPin, OUTPUT);
    

 }

 void loop() {
    //address = Serial.read(); // the sixth byte is the low part of the address
      //RSSI = Serial.read(); // the seventh byte is the RSSI value
   // see if there's incoming serial data:
   if (Serial.available() > 0) {
     // read the oldest byte in the serial buffer:
     incomingByte = Serial.read();
     
     // if it's the RSSI value (ASCII 72), print the value on the serial:
     if (Serial.read() == RSSI) {
       Serial.print("RSSI");
     }
     
     // if it's a capital H (ASCII 72), turn on the LED:
     if (incomingByte == 'H') {
       digitalWrite(ledPin, HIGH);
       Serial.print("HIGH");
     } 
     // if it's an L (ASCII 76) turn off the LED:
     if (incomingByte == 'L') {
       digitalWrite(ledPin, LOW);
       Serial.print("LOW");
     }
   }
  
      //Serial.print(10,(100-RSSI)*2); // analog write a brightness roughly corresponding to distance
 }

In this way I can see a series of <<-1HL-1HL-1HL-1HL-1HL-1HL-1HL-1HL-1HL76HL79HL87HL72HL73HL71HL72HL76HL79HL87HL72HL73HL71HL72HL76HL79HL87HL72HL73HL71HL72HL-1HL-1HL-1HL-1HL-1HL-1HL-1HL-1HL-1HL-1HL-1HL76HL79HL87HL72HL73HL71HL72HL76HL79HL87HL72HL73HL71HL72HL76HL79HL87HL72HL73HL71HL72HL76HL79HL87HL72HL73HL71HL72HL76HL79HL87HL72HL73HL71HL72HL76HL79HL87HL72HL73HL71HL72HL76HL79HL87HL72HL73HL71HL72HL76HL79HL87HL72HL73HL71HL72HL76HL79HL87HL72HL73HL71HL72HL76HL79HL>>
on the serial monitor… a certain value, “H” that means HIGH and “L” that means LOW. On the first and second time, the value was -1 when the receiving unit was disconnected, and was turning into 76, 79, 87, or whathever, once connected… from the third time I’ve tried to disconnect the receiver, the sender unit simply continued to return 76, 79 or whathever continuously, like nothing was happened…
On the receiving unit, I simply have my LED turning on and off depending on the char received, and LOWHIGHLOWHIGH… is written on the serial monitor… but not the RSSI value! :frowning:

Could anyone help me? I need to have the RSSI value in order to finish my project!! :’(

Thnks a lot!

Marta

Hey arduina...how did u do the setup for activating the RSSI pin on the xbee? and what is 'lastdurstate'? Could also please post a bit of your code.

Hi Arduina, coming back to the question of using the PWM output or the API command, I couldn't find anything on the manual that does NOT suggest to use the DB command, quoting the manual:

It is possible to measure the received signal strength on a device using the DB command. DB returns the RSSI value (measured in –dBm) of the last received packet. However, this number can be misleading. The DB value only indicates the received signal strength of the last hop. If a transmission spans multiple hops, the DB value provides no indication of the overall transmission path, or the quality of the worst link – it only indicates the quality of the last link and should be used sparingly. The DB value can be determined in hardware using the RSSI/PWM module pin (pin 6). If the RSSI PWM functionality is enabled (P0 command), when the module receives data, the RSSI PWM is set to a value based on the RSSI of the received packet. (Again, this value only indicates the quality of the last hop.) This pin could potentially be connected to an LED to indicate if the link is stable or not.

As a matter of fact I used both the PWM approach and the API command on Xbee 2.5 seriess (non Pro) and I didn't encounter any problem. Please note that the RSSI refers to the last HOP and in both cases is not reliable to measure the distance particularly in the 2.4 Ghz bandwidth where reflections are nasty unless you are in anechoic chamber! I use the RSSI in combination with a motion sensor to understand if 2 sensors are moving away. I also used an arduino xbee shield, I can post some of the code if anybody is still interested.

Hi epokh, thanks for your post, it was very helpful! But do you mind sharing the code, too? I’m trying to set up a very similar project, so it would be very good have a code for reference. Thanks so much!