The RF24 Libraries

On this page

Go to the TMRh20 project page and download both the RF24 and RF24Network libraries (look for the Download links under "Newly Optimized RF24 NRF24L01 Radio Library for Arduino" and "Newly Optimized RF24Network Library Fork").

Note: at the time of writing, I found some issues with the main RF24Network library but the Development Fork worked fine, so to be safe you could download that one instead - it's on that same page near the top.

This will download and install everything - answer "y" to the questions about installing RF24 and RF24Network. You don't need RF24Mesh or RF24Ethernet for now, but it doesn't hurt to install them too. You might see some warnings while it's compiling the libraries but you can ignore those.

At this point, it might be worth taking a little detour and install samba. It will make working with files on the Pi a lot easier. Every time you would open a file in nano, you can just open it in Windows (for example in the excellent (& free) Notepad++ editor)

On the Raspberry Pi, use the following commands to download the rf24receiver code from this site together with the instruction file for the C compiler, then open the file to look at it:

This program assumes you'll be receiving data from an Arduino with a DHT temperature sensor. There are comments throughout the code that explain what's going on. When you're satisfied you understand what's going on you can exit nano and then compile the code & run it:

make
sudo ./hareceiver

You'll see a printout of some radio details, followed by a dot every 2 seconds while the Pi patiently waits for data until the Arduino starts sending.

Now for the Arduino, download the sketch and upload it to your Arduino, or use the codebender plugin below to send it directly. This sketch assumes your Arduino has a DHT temperature sensor, as explained in this guide.

Have a look at the code - the comments should explain what's going on. Once the Arduino code is uploaded and executing, you can open the Serial Monitor to see it send temperature data. In the Pi terminal window you should see the Pi receiving data and writing it out.

If you're using an Arduino Nano: when I tested this setup with the Nano instead of the Uno, having the Serial Monitor open made it not work. If you're having trouble with the Nano, try closing the Monitor and just check the Pi terminal to see if it's receiving data.

If the example doesn't work, try using the RF24Network files from the Development version mentioned earlier for the Pi (they're the same files as for the Arduino). Copy them to your Pi - overwriting the previous files - and compile using "sudo make install" while in the RF24Network folder.