RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver

finnduino:
It's still showing this when I look status of module:
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = 16 bits
PA Power = PA_HIGH

Should radio.setDataRate(RF24_250KBPS); affect immediately?

This will never work, because the 250KBPS speed is only available on the newer nRF24L01+ chip, not the older nRF24L01. Get the data sheets from Nordic and read up on the chip differences.

Thanks much this thread, PaulS and Pico, I got this working at least some way. Now I've Mega which has W5100 ethernet to connect Cosm, and with 433Mhzh transmitter to control Nexa by using it's webserver, and now also nRF24L01+ to read temperatures from Nano with nRF24L01+ ds18b20. This works ok but code looks bad, I think I need to use interrupts, more studying :roll_eyes:

Hi Finnduino,

Can you please tell us more details of how you have the nRF24L01 and Ethernet interfaces wired? What did you need to do to get them both working together?

Thanks!

I've tried several libraries and found this library the best and have the best range... thank you to maniacbug for such a wonderful libraries..

I'm using a compatible wireless module from inhaos.com ? Everything done inhouse ) for my testing...

I've a question to ask, can this library or future enhancements ack similar like serial TX/RX on both sides ?

finnduino:
Thanks much this thread, PaulS and Pico, I got this working at least some way. Now I've Mega which has W5100 ethernet to connect Cosm, and with 433Mhzh transmitter to control Nexa by using it's webserver, and now also nRF24L01+ to read temperatures from Nano with nRF24L01+ ds18b20. This works ok but code looks bad, I think I need to use interrupts, more studying :roll_eyes:

hey finnduino,

just like terryking228, i think it would be interesting to know how you managed to get an ethernet shield working together with a NRF24l01+ module at the same time :wink:

cheers,
stefan

Having following Arduino (clone) 1280 <--> NRF24L01, hopefully I checked these ok:
51: MOSI
GND: GND
52: SCK
50: MISO
48: CE
49: CSN
3V: VCC
GND: GND
Pin6 is connected to 433Mhz transmitter
Pin5 is connected to 433Mhz receiver (not used but just connected)
Pin22 has thermometers (2pcs)
w5100 network board is normally attached to default pins of 1280, not yet any other problems than this is slow...

Some parts of my currently ugly code:
#include <ERxPachube.h>
#include <SPI.h>
#include <Client.h>
#include <Ethernet.h>
#include <Server.h>
#include <Udp.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <NexaTransmitter.h>
#include <RF24Network.h>
#include <RF24.h>

--- clip -- ... and so on
byte mac[] = { 0xE8, 0xB3, 0x3A, 0x30, 0x41, 0x65};
IPAddress ip(192,168,1,13);
IPAddress device(192, 168, 1, 13); // Only if useDhcp is false
IPAddress gateway(192, 168, 1, 1); // Only if useDhcp is false
IPAddress subnet(255, 255, 1, 0); // Only if useDhcp is false
IPAddress dnsIP(192, 168, 1, 1); // Only if useDhcp is false
int ONE_WIRE_BUS = 22 ;
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress thermometer;

//radio:
RF24 radio(48,49);
RF24Network network(radio);
const uint16_t this_node = 0;
const uint16_t other_node = 1;

struct payload_t
{
unsigned long ms;
unsigned long counter;
};

void setup(){

Ethernet.begin(mac, ip,dnsIP,gateway,subnet);
pinMode(ledPin, OUTPUT);
dataout.addData(0);
dataout.addData(1);
dataout.addData(2);
pinMode(txPin, OUTPUT);
// clip enabling Nexa 433Mhz ---
NexaTransmitter remote(6, 12345678); // Create the nexa remote on pin6 with remote id
// radio up:
SPI.begin();
radio.begin();
network.begin(/channel/ 90, /node address/ this_node);
// end setup
//After that there is void loop(), having things like:
network.update();
while ( network.available() )
{
// If so, grab it and print it out
RF24NetworkHeader header;
payload_t payload;
network.read(header,&payload,sizeof(payload));
Serial.print("Received packet #");
Serial.print(payload.counter);
//and so on
}

Here screenshot how test version is currently working, I go to web page, then it at least somehow shows current temperature 25,12'C from sensor connected directy to Mega1280 but also 22'C received from 2.4Ghz sensor. It's sending those values to Cosm and 433Mhz switches are controlled by http GET commands

Thanks to maniac bug libraries, I managed to get both Arduino UNO & Raspberry Pi connected using the nRF24L01+

Hi Stanley

I see in your link the nrf24 lashup on a breadboard. Do you have any trouble with the power supply there. This is in light of discussion at.

http://arduino.cc/forum/index.php/topic,149551.0.html

I see a couple of electrolytics on the breadboard but they don't seem to be related to the nrf24.

I am expecting some nrf24s soon and am currently planning a new proto shield.

I see in your link the nrf24 lashup on a breadboard. Do you have any trouble with the power supply there. This is in light of discussion at.

No issues at all for all Inhaos modules, the regular nRF24L01+ modules or even the ones with PA+LNA and Ext 2dBi antenna...

Are you expecting issues or facing such power issues ??

Stanley:
Are you expecting issues or facing such power issues ??

In the light of your comment, no. I believe these things should be addressed by the board manufacturer in accordance with the recommendations of the chip manufacturer and should not be something for the end user to get too paranoid about.

However there have been some issues and bypass caps have been seen as solution. See the abovementioned link. As to it being the routine solution, who would know?

For all that, I have reserved space on my proto for a tantalum right next to the power pins, so I have no qualms about installing it. I have not yet received my transceivers and I'm just trying to have all the ducks lined up as I have to have everything up and running by the end of May.

Maniacbug, great job on the library, really looks complete, only im having problems getting it to work with a pair of nrf24l01+ modules. I am pretty sure they are wired correctly. Can't seem to get any of the rf24 examples to work. Here is the radio.printDetails from both modules with the getting started code in it.

*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK
ROLE: Ping out
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xf0f0f0f0e1 0xf0f0f0f0d2
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xf0f0f0f0e1
RX_PW_P0-6 = 0x08 0x08 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x27
CONFIG = 0x0f
DYNPD/FEATURE = 0x00 0x00
Data Rate = 250KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_HIGH

*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK
ROLE: Pong back
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xf0f0f0f0d2 0xf0f0f0f0e1
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xf0f0f0f0d2
RX_PW_P0-6 = 0x08 0x08 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x27
CONFIG = 0x0f
DYNPD/FEATURE = 0x00 0x00
Data Rate = 250KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_HIGH

on the ping out module is get:
Now sending 26533...failed.
Failed, response timed out.

in the serial terminal, and nothing in the pong back. I am using the Leonardo arduino modules and Arduino ver 1.52 software. All the signals look ok on a scope. the only signal that looks a bit strange is the 3.3vdc, which has a .2vpp ripple on it, really don't think this is the problem though. any feedback is greatly appreciated.

I would add a large capacitor across 3.3v and gnd. I have had issues with the power supplies on arduinos (chinese clones :p), and that solved it every time. And I am going to attempt to make a wireless DMX transmitter with these transceivers, which will require sending a 512 byte packet at least every 50 ms. Any suggestions on optimizing settings and code to be able to pass data at this speed? I read earlier in this thread about removing the delays in the write function, should I do that?

Any help would be great,
ematson5897

ematson5897, much thanks that did it.

wow i really cant believe it, the 24l01 pulls next to no current too! wow cheap Chinese crap!!!! they probably dont even test to see if the power supply can handle any they of load! added two 100uF caps one one each module. I wonder if reducing the ripple even more will help in reception, ie increase the range, hmmmmm

again thanks :slight_smile:

No problem! And yes it should receive less noise, so you might be able to get away with longer distances

I was thinking of 10 mike tantalums I have to hand

Also I found a documentation error. The code and documentation do not line up for the setPALevel command

void RF24::setPALevel ( rf24_pa_dbm_e level )
Set Power Amplifier (PA) level to one of four levels.

Relative mnemonics have been used to allow for future PA level changes. According to 6.5 of the nRF24L01+ specification sheet, they translate to: RF24_PA_MIN=-18dBm, RF24_PA_LOW=-12dBm, RF24_PA_MED=-6dBM, and RF24_PA_HIGH=0dBm.

Parameters:
level Desired PA level.

/**
 * Power Amplifier level.
 *
 * For use with setPALevel()
 */
typedef enum { RF24_PA_MIN = 0,RF24_PA_LOW, RF24_PA_HIGH, RF24_PA_MAX, RF24_PA_ERROR } rf24_pa_dbm_e ;

You use min,low,high,and max in code but docs say otherwise

And for those interested, I am porting this library to energia (arduino for ti launchpad)

Great library and great job from maniacbug!

I am using 2 Arduino UNOs with 2 nRF24L01+ on top, bought from iTeadStudio.

When using the RF24 library I am facing the exact same problem as egghead did. I am receiving STATUS at the beggining, but only "Failed, response timeout" when trying to transmit. I will try to connect a capacitor between 3.3V and GND pins to see if this can fix the problem.

On the other hand, when trying the RF24Network library, the network seems to operate fine, with only minor problem some dublicates showing up on the serial monitor (Received packet #544 at 109000, Received packet #544 at 1090000).

So I can not figure out if the RF24 library is suitable for the nRF24L01+ modules or the simple ones. Do I have to use only the nRF24Network library, to make my modules work?

axel12p:
When using the RF24 library I am facing the exact same problem as egghead did. I am receiving STATUS at the beggining, but only "Failed, response timeout" when trying to transmit. I will try to connect a capacitor between 3.3V and GND pins to see if this can fix the problem.

On the other hand, when trying the RF24Network library, the network seems to operate fine, with only minor problem some dublicates showing up on the serial monitor (Received packet #544 at 109000, Received packet #544 at 1090000).

So I can not figure out if the RF24 library is suitable for the nRF24L01+ modules or the simple ones. Do I have to use only the nRF24Network library, to make my modules work?

Which example sketch are u using ??

Can you paste the output here in ...

RF24Network are using the RF24 libs.. so if RF24Network is working, then RF24 libs "should" be working...

For debugging, I suggest putting some Serial.println() statements at various checkpoint to "see" what is going on with the radio/libs.. was the timeout caused by other reasons...

I even use radio.available( &pipe_num) to loop thru the 6 pipes one by one to "see" what's going on...

For yr case, it should be just using pipe0 and pipe1 ...

http://maniacbug.github.com/RF24/classRF24.html#ace7dd139fabc16b77cb8325faa07620f

You should use the "latest" fork RF24 libs from others....

To fix my Mega issues I used a 47uF cap and a .1 uf cap right at the connector and 0805 parts solder nicely between .1"/2.54 cm pins.. , Just stack them like bricks.

Bob

Firstly I would like to thank you both for your help!

My hardware configuration is the same as this mentioned in maniacbug's blog (Getting Started with nRF24L01+ on Arduino | maniacbug). I have double checked the wiring and everything seems to be fine. I have also tried to connect the RF modules to Arduino boards through female to male wires but nothing changed. I have bought five RF modules and tried several combinations with no luck. My Arduinos are UNO R2 and R3, but I don't think that this matters.

The libraries I have installed were those from maniacbug's github (maniacbug · GitHub). I have downloaded the zip file and extracted it to my libraries folder.

As you can imagine, the first example that I have tried, was the "GettingStarted" example. The first Arduino is powered throught the USB cable and the other through a 5V wall adapter.
When I open the Serial Monitor I am getting the result shown below:

If I interchange the position of the two Arduinos I am receiving this:

As you can see the wiring seems OK (I don't receive any zeros), but there is also no communication between the two modules.

The strange thing is that when I' ve uploaded the helloworld_tx and helloworld_rx examples included in the RF24Network library, a connection has been established between the two modules (messages like: "Received packet #544 at 109000" showed up at the Serial Monitor of the receiver).

I didn't knew that newer libraries have been released, so I tried earlier the RF24 library from gnulnulf with the exactly same results :frowning:

I will try to put some Serial.println() statements to the code for debugging and also add a capacitor between 3.3V and GND pins (I also have some 0805 SMD capacitors) hoping that any of these solutions may help...