How to get the RSSI of an Xbee using Arduino!
It took so much time to get this working. But know everything works fine. Using RSSI you can make many funny projects, like object detection and so on. Check out the link below for more information about RSSI.
XBee modules have an RSSI (Received Signal Strength Indicator) pin that outputs a PWM signal representing this value. But how do you turn that PWM duty cycle into a useable integer on your microcontroller? Luckily Arduino has a function made for just this application:pulseIn.
pulseIn returns the duration of a pulse (specified HIGH or LOW) in microseconds (µs). The 200 is a timeout value in µs—it waits this long to see if there’s going to be a pulse. Since the XBee’s RSSI PWM period is 200µs, we want to wait at most that long to see if there’s a pulse at all.
Since this function gives you a duration, it’s up to you to map that to a value relevant to your program. Since the maximum duration of the pulse would be 200µs, you could map that to your logical maximum.
Keep in mind that if you were planning on using API Mode anyway, every API Mode packet has the latest RSSI within it.
Feel free to ask me questions.