Reliability of the communications between two RFM22

Hi there,

I am new to sparkfun products. I’ve got 2 sets of RFM22 and Arduino boards and tried running them as a pair, one is the server and the other is the client. I used the example codes provided, and two sets run on two computers, about 2 feet apart. First, the two talk to each other, which is good. But it seems the communication is very unreliable. I changed the “Hello World!” to a counter value (counting from 0 to 9 in a loop) to measure the reliability of the communication. The server gets about 7 numbers out of 10 numbers sent from the client, in turn, the client gets only 2-3 numbers back from the original 10 numbers it sent out. It seems the failure rate is as high as 30% loss in each way. Is there something wrong or this is the failure rate I should expect? I tried extending the delay in each transmission, it did not help.

dover

That is extremely poor performance. Did you use the recommended antennas?

What “example codes” did you use? Surely not the library mode described as:

RF22ReliableDatagram: addressed, reliable, retransmitted, acknowledged messages.

[http://www.airspayce.com/mikem/arduino/RF22/](http://www.airspayce.com/mikem/arduino/RF22/)

Hi jremington, thanks a lot for responding.

Yes, I was surprised by the low success rate. I must have missed something. I followed the Quickstart Guide to have made the antenna. It’s a piece of #22 solid wire. It’s 8.3cm long. But after threading it back thru the strain relief hole, the straight portion of the wire is about 7.9cm. (maybe my boards are not set for 919MHz? How can I find it out?). I used the demo codes from arduino. Just went to File->Examples->RF22 and loaded rf22_client and rf22_server for each board set connected to two computers. I noticed the transmission was not reliable. So, I changed the “Hello World!” to a counter value counting from 0-9. Then I found I only got about 7 numbers out of 10 numbers sent on each way.

Hi jremington,

I read the codes again. My suspicion about the frequency may be right. The comment in the code says “Defaults after init are 434.0MHz, 0.05MHz AFC pull-in, modulation FSK_Rb2_4Fd36”. But I put the function rf22.setFrequency(910.0); in void setup() in both server and client and tried again. No luck. The success rate is about the same. It seems I may need do more in setup.

// rf22_server.pde

// -- mode: C++ --

// Example sketch showing how to create a simple messageing server

// with the RF22 class. RF22 class does not provide for addressing or reliability.

Those antennas will work OK for that extremely close range, regardless of the frequency. Your problem is likely due to a noisy environment. Use the RF22ReliableDatagram class.

I’d guess it’s a mis-configuration of the radio.

Need to start with a working code example, unchanged parameters.

steve, I started with two sample codes, rf22_server and rf22_client, with no modification. I added my code only for finding out what’s going on after I noticed rf22_client got only a few replies from rf22_server. Most of the time it displays “No reply, is rf22_server running?” while rf22_server seems displaying lots more received “Hello World!”. After adding the counter, I found rf22_server actually also has lost about 30% transmissions.

jremington, I do have a noisy environment. On my desk and nearby, I have at least a wireless landline phone, an iphone, a wireless mouse, a wireless keyboard, two computers with wireless connections, and these two RFM22 sets, and a Siliconlab’s Energy Harvesting Node demo board. I removed the dangle which communicates with the Energy Harvesting Node demo board. It did not help. By the way, the Energy Harvesting Node demo board wireless communication seems working fine in this environment. Anyway, I will try other demo codes, RF22ReliableDatagram and etc and see if I will have a better luck with one of them.

Thank both of you. Have a great weekend!

The stock setup for the RFM22 radio should work OK, but perhaps others can chime in with their personal experience (I myself don’t use this particular radio/software combination). The Arduino forum has some possibly relevant entries, and there was this comment:

I don’t know how you were testing the RFM22B modules, but I have them hooked up to the 3.3v of the Arduino, and I found I need a 4700mFd cap on the 3v3 supply line to take the pulse when it transmits at full power.

The author probably meant "4700 microfarad". I looked through the RF22 docs and code, and was surprised to find that most of the data transmission modes do not include any sort of checksum or CRC error detection. This seems like a major oversight. The only option that does so seems to be the RF22ReliableDatagram class, which requires some extra work on your part, for example to configure device IDs etc.

Even the simplest RF protocols used for wireless devices like remote temperature sensors, etc. include a checksum, CRC or both, so that you can check whether the message is valid. It would be fairly simple to implement a CRC yourself, then you could use the RF22 class and just ignore messages that aren’t valid. Nevertheless I would expect much better performance (at such very close range) than you described in your first post.

Jremington,

Thank you for keeping helping me. I really appreciate it. One of the reasons I am trying RFM22 is hope it can take care of the RF communication so I can concentrate on functional programing on MCU side. I have tried rf22_reliable_datagram_client and rf22_reliable_datagram_server sample programs. Their reliability is better. I can get 80% to 90% successful transmissions with them. However, I still never get all 10 numbers even once. This is still not good enough for me. I hope to get 1% or better success rate. Is this something too much to expect? Also I have tried to find out how far two RFM22s can talk to each other. To my disappointment, they stopped communicating in about 10 feet apart. Before I put too much time into this project, I’d appreciate it very much if someone can tell me his/her real experience (not the deduction from the numbers on the datasheet) of this board such as the realistic expectations of the transmission distance and success rate of the transmission. Also some troubleshooting tips/tricks will be appreciated, such as if there is a pin I can measure with a multimeter or a scope, or a byte/bits from a register that I can read to give me some ideas of the RF signal strength or quality, and/or the threshold for reliable communication? Thanks folks.

For reference, I use the cheap 433 MHz TX/RX modules (e.g. http://winavr.scienceprog.com/example-a … llers.html), and routinely get 300 meters line of sight range using 1/4 wave whip antennas, with >99% reliability in an outdoor rural setting. I use my own rather simple error-checking code, roughly equivalent to the VirtualWire package for the Arduino.

Jremington,

Thanks a lot. The TX433 and RX433 look very interesting, and simple to interface! ^o^. I think I will give them a try. I need about 30 feet range and reliable transmission. 99% is definitely good enough for me. Again, thanks!

Error checking code is absolutely required with the cheap modules, VirtualWire is good.

You might also consider Pololu’s 2.4 GHz Wixel module, which is a complete, self contained solution for a number of different applications. I’ve used these a fair bit and they are extremely reliable up to 30 feet. http://www.pololu.com/catalog/product/1339