nRF24L01+ low range and noise

Hi there.

On my project I'm using these chips for communication between 2 Arduino and I can say work quite well.

I've only 2 problems:

  1. the range is really low (less than 1-2 meter)

  2. something I get really strange results reading the received payload.
    Example:

Source send:
data[0] = 12;
data[1] = 13;
(correctly checked with a serial print in the client)

Recevicer get:
data[0] = 39492;
data[1] = 2993;

Maybe wireless electromagnetic interferences ?

Thanks !

Could you post code of sender and receiver? (use the # button to get code tags )

What is the datatype of data[0] / data[1] ?

  • decreasing the default data rate from 2Mbps to 1Mbps helps normally with these chips.

You might also want to increase the number of retransmits, assuming you are using Shockburst.

Do not expect too much from these modules, especially if you are using modules with a chip antenna or even one printed on the circuit board. An external antenna can increase reception notably.

You might also want to check for a channel in the 2.4GHz band which is interference free.

In fact, you can use nRF24L01+ you already have and the small program I posted here (http://arduino.cc/forum/index.php/topic,54795.msg392325.html#msg392325) for doing a simple scan of the 2.4 GHz band.

Run this scanner for a while and than choose a channel were there is no activity. WLANs are constantly transmitting; also watch out for any of these simple wireless surveillance cameras. These usually feature rather strong transmitters spoiling a lot of neighboring channels. Of course, your local microwave oven might also be active in the 2.4 GHz band... :wink:

A note on the corrupt data reception you are seeing: usually, the nRF24L01+ utilize a CRC and other means to ensure data integrity. If something gets transmitted, it tends to be rather stable. Are you transmitting each byte individually? If so, try to transmit larger chunks - the nRF24L01+ can transmit up to 32 bits in one shot. From my experience, errors like this are most likely caused by ones own software or the library one is using.

Thank you so much for your answer.

Do you know how to set a lower data rate ?
I've found this command online:

Mirf.configRegister(0x26,0x07); //Air data rate 1Mbit, 0dBm, Setup LNA

is it correct ? I can't find any detailed guideline for Mirf library .....

For CRC errors I'm transmitting a payload of 13 bytes with these commands:

Mirf.payload = 13;

byte data[Mirf.payload];

data[0] = ....;
data[1] = ....;
................
data[12] = ....;

Mirf.send(data);

I need to trasmitt lot of values.

Hi un1x:

un1x:
Do you know how to set a lower data rate ?
I've found this command online:

Mirf.configRegister(0x26,0x07); //Air data rate 1Mbit, 0dBm, Setup LNA

is it correct ? I can't find any detailed guideline for Mirf library .....

I am afraid not. The register to set is the 0x06, not 0x26. And if I remember correctly, you should zero every bit of this register, except bits 2:1 (that gives you maximal output power). Thus, you would want to write the value of 0x06 to this register. Actually, the mirf-lib comes with a predefined value for the register address. Thus

// Set 1MHz data rate
   Mirf.configRegister(RF_SETUP,0x06);

should to the trick. Since the least significant bit of this reg is ignored, 0x07 is actually equivalent to 0x06 in this case.

But please check the data sheet of the device, page 58 for details before proceeding. I am recalling this from memory....

For CRC errors I'm transmitting a payload of 13 bytes with these commands:

Mirf.payload = 13;

byte data[Mirf.payload];

data[0] = ....;
data[1] = ....;
................
data[12] = ....;

Mirf.send(data);




I need to trasmitt lot of values.

Well, that is basically correct. But note that the Mirf-lib (at least my version) does not like byte*, so an explicit cast needs to be done. Also remember that your chip might try to retransmit the data several times if you have enabled Shockburst (which I strongly recommend). So the following piece of code is probably a slightly better approach:

Mirf.payload = 13;
byte data[Mirf.payload];

// ... fill in your data into your array

// hand over to transmitter
Mirf.send((byte*)data);

// give the chip the time to transmit (and retransmit in case of errors)
while( Mirf.isSending() ) ;

You seem really skilled in Mirf programming :slight_smile:

I don't understand the difference between my istruction and (byte*) one because I'm not experienced enough.

How did you learned advanced commands for Mirf library ?

Bye !

P.S: I didn't reported the "while sending" instruction but it was in my code.

... basically, my approach is to read the source code of one or ideally several libs and/or code which is already out there, and than read and understand the datasheet of the manufacturer. From this, start to use the lib which fits you most or start to write a new one... :slight_smile:

And actually: I was wrong with need of the cast to a byte-pointer "(byte*)", as your data array is actually already a byte array.

So... - this remark of mine is useless in this case. You do not need to do such a cast. Won't hurt either, however :wink:

One shouldn't just copy things in a hurry...