Hello everyone !
Firstly I want to apologize if my English isn't perfect yet, I'm French and already tried to post a message in the appropriate section but no one could answer my question, and I hope that it will have more answers here. ![]()
So I'm going to ask it very quickly, then explaining in detail :
- How to measure the distance between two Xbee's cards, which one being connected to an Arduino card ?
I was thinking about using the RSSI on the pin 6 of the Xbee, to exploit it later on (the signal strength is approximatively related to the distance between the two cards, I've seen that it can be very accurate on some videos).
But the problem is that I can't find any way to make it work, and videos are telling that it's possible to...
Knowing that I have this material at the moment :
- 2 Xbee's
- one Arduino Mega (I would like the RSSI to be workable by this card)
- one Arduino Uno
- one UartsBee usb/xbee adapter from Seeedstudio
- one Xbee shield for Arduino from libelium (but it seems to be useless and "weird" to use)
- wires and breadboard
In fact I have problems with configuring the Xbees with X-CTU and with the programs to enter in the different Arduino cards.
I've been searching a lot before asking here : I'm not able to follow the tutorials that explain how to configure Xbee's because they don't use the same adaptators as I do (and sadly I can't change it because it belongs to my school) and it changes a lot of parameters in X-CTU that I don't understand...
Also I tried another way : one arduino sends constant information through the Xbee (Serial.println("Junk")) and the other one is able to receive it and we can see on the adaptater that the led corresponding to RSSI is lit (meaning that it is connected to the other I imagine). But as I try to plug the 6th pin of Xbee (RSSI one) into a digital pin of the Arduino and to get its value with the appropriate function I think (pulseIn(pin, LOW, 200) -I saw on a webpage that we could use this one because RSSI acts like a PWM-), I can't get it to work again : it returns me either 0s or random numbers. So is there a certain way to plug it or is it just a direct cable between Xbee's pin and Arduino's one ?
The method I tried (but seems to be not working) is the following one :
I connect the first Xbee to the Arduino Uno with help of the libelium shield, letting default values in the Xbee (in X-CTU).
The code I enter in the Arduino Uno is this one :
void setup()
{
 Serial.begin(9600);
}
void loop()
{
 Serial.println("Junk");
}
Nothing complicated, it should just send constant messages.
In the Arduino Mega this time, I used the usb/Xbee adapter to connect it to the Arduino Mega : I put its pins on a breadboard, then connect +3.3V and Gnd to the Mega (I don't need to retrieve the messages, only the RSSI : so I don't connect RX and TX) and connect the pin of Xbee corresponding to the RSSI to the digital pin 2 on the Mega, then enter the following code :
void setup()
{
 pinMode(2, INPUT);
 Serial.begin(19200);
}
void loop()
{
 int rssi = pulseIn(2, LOW, 200);
 Serial.print("RSSI : ");
 Serial.println(rssi);
}
On Baud 19200, it returns me : "RSSI : 0". What did I do wrong ?
So I would be very happy to get some help from you, even better could you explain me exactly what to do etc.
And also if you think that it's better to talk in real time, maybe we can exchange some Skype adresses.
So, thanks a lot and have a nice day ! ![]()
Best regards, Thooto