SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By dmnchief001
#114670
I was wondering if it were possible to do the following:

Use two RFM22 Transceivers (http://www.sparkfun.com/products/9821) to detect proximity from one another.

I need my two Arduino Pro Mini 328's (http://www.sparkfun.com/products/9220) to know how far apart they are from one another.

I need an alarm to trigger when the two devices are 15ft from one another and then alarm again when the two devices are 25ft from one another. I will be starting at 0ft and then separating the two devices to 25ft.

Is this possible with the chips I've chosen? Is this type of problem solvable with RF?
By MichaelN
#114677
I assume you're planning on using the RSSI register on the RFM22 to detect signal strength and deduce the range from that? The problem is that the RF path loss is highly variable, and will depend on the orientation & height of the equipment, any obstructions etc. If you're closely controlling these variables in your application, you should be able to do what you want.

If not, you might want to use ultrasonic instead, since you can use "time of flight" to measure distance much more easily (sound travels at 340 meters/sec, compared with 300 MILLION meters / sec for RF). For example, the "master" unit could send an ultrasonic pulse train which is detected by the "slave", which then responds with its own pulses. The Master unit just has to measure the elapsed time.

You could also combine RF and ultrasonic, particularly if you need to transfer data between the units.
By dmnchief001
#114697
Thanks for you comment.

I don't think I can't use ultrasonic, because there will be obstructions between the devices. I need the devices to determine distance from one another, while walls are in the way.

Anyways, yes. I was planning on determining signal strength on the RFM22 to deduce the range. I've been looking around for similar projects like this, but I can't find any.

Could I get a short example code for how to measure the signal strength, and then have one arduino alarm when it reaches 15ft?
By MichaelN
#114722
As I said, unless your equipment will be in repeatable positions and orientations, the path loss will vary significantly and RSSI will only be a very rough guide of distance. What kind of accuracy do you need?

Sorry, can't help with code, as I haven't used these modules or Arduinos. I believe HopeRF has sample code for the modules which may get you started.
By stevech
#114806
yes, received signal strength varies widely unless there is perfect line of sight and no obstructions or major sources of reflections.
About all you can reliably do is sense on a log scale (dB), where a 20dB change means something - but it may mean 20 ft. or 100 ft. Also there's the inverse square law in RF propagation - doubling the distance halves the power. It's not linear. In line of sight.