Optimized High Speed Arduino driver for nRF24L01 2.4GHz Wireless Transceiver
Design Goals: This library is designed to be...
- More compliant with the manufacturer specified operation of the chip, while allowing advanced users
- to work outside the reccommended operation.
- Utilize the capabilities of the radio to their full potential via Arduino
- More reliable and feature rich
- Easy for beginners to use, with well documented examples and features
- Consumed with a public interface that's similiar to other Arduino standard libraries
- Built against the standard SPI library.
April 2014: Official Release: Still some work to do, but most benefits have been realized
- The library has been tweaked to allow full use of the FIFO buffers for maximum transfer speeds
- Changes to read() and available () functionality have increased reliability and response
- Extended timeout periods have been added to aid in noisy or otherwise unreliable environments
- Delays have been removed where possible to ensure maximum efficiency
- Full Due support with extended SPI functions
- ATTiny 24/44/84 25/45/85 now supported.
- More! See the links below and class documentation for more info.
Please refer to:
This chip uses the SPI bus, plus two chip control pins. Remember that pin 10 must still remain an output, or
the SPI hardware will go into 'slave' mode.
- Uno, Nano, etc (328 based boards)
- Mega Types (2560, 1280, etc)
- ARM (Arduino Due) via extended SPI methods
- ATTiny 24/44/84 25/45/85
- Raspberry Pi
- See the documentation for more info
The table below shows how to connect the the pins of the NRF24L01(+) to different boards. CE and CSN are configurable.
|PIN||NRF24L01||Arduino UNO||ATtiny25/45/85 ||ATtiny44/84 |
|1||GND||GND||pin 4||pin 14|
|2||VCC||3.3V||pin 8||pin 1|
|3||CE||digIO 7||pin 2||pin 12|
|4||CSN||digIO 8||pin 3||pin 11|
|5||SCK||digIO 13||pin 7||pin 9|
|6||MOSI||digIO 11||pin 6||pin 7|
|7||MISO||digIO 12||pin 5||pin 8|
Raspberry Pi Configuration:
Library functions are mostly the same.
See the included examples for RPi specific usage
Raspberry Pi - PreConfig
If SPI is not already enabled, load it on boot:
A. Update the tool via the menu as required
B. Select Advanced and enable the SPI kernel module
C. Update other software and libraries:
sudo apt-get update sudo apt-get upgrade
#New: RPi RF24 Library Installer for all RF24 libraries
A. Download the install.sh file from http://tmrh20.github.io/RF24Installer/RPi/install.sh
B. Make it executable:
chmod +x install.sh
C. Run it and choose your options:
D. Run an example file from one of the libraries:
cd rf24libs/RF24/examples_RPi make sudo ./gettingstarted
RPi - RF24 Quick-Start
A. Make a directory to contain the RF24 and possibly RF24Network lib and enter it:
mkdir ~/rf24libs cd ~/rf24libs
B. Clone the RF24 Repo
git clone https://github.com/tmrh20/RF24.git RF24
C. Change to the new RF24 directory
D. Build the library, and run an example file:
sudo make install cd examples_RPi make sudo ./gettingstarted
RPi - RF24Network Quick-Start
A. Enter the same directory that contains the RF24 library folder
B. Clone the RF24Network Repo
git clone https://github.com/tmrh20/RF24Network.git RF24Network
C. Copy the RF24Network folder to the current directory, and delete the rest
D. Build the library
sudo make install cd examples_RPi make sudo ./helloworld_rx OR sudo ./helloworld_tx
Using pin 15/GPIO 22 for CE, pin 24/GPIO8 (CE0) for CSN
Can use either RPi CE0 or CE1 pins for radio CSN. Choose any RPi output pin for radio CE pin.
RF24 radio(RPI_V2_GPIO_P1_15,BCM2835_SPI_CS0, BCM2835_SPI_SPEED_8MHZ); or RF24 radio(RPI_V2_GPIO_P1_15,BCM2835_SPI_CS1, BCM2835_SPI_SPEED_8MHZ); RPi B+: RF24 radio(RPI_BPLUS_GPIO_J8_15,RPI_BPLUS_GPIO_J8_24, BCM2835_SPI_SPEED_8MHZ); or RF24 radio(RPI_BPLUS_GPIO_J8_15,RPI_BPLUS_GPIO_J8_26, BCM2835_SPI_SPEED_8MHZ);
|PIN||NRF24L01||RPI||RPi -P1 Connector|
See http://www.airspayce.com/mikem/bcm2835/index.html for BCM2835 class documentation.
Note: The BCM library has been customized slightly to allow use of hardware CE pins not in use for SPI, and to include a millis() function.
Based on the arduino lib from J. Coliz firstname.lastname@example.org.
the library was berryfied by Purinda Gunasekara email@example.com.
then forked from github stanleyseow/RF24 to https://github.com/jscrane/RF24-rpi
Network lib also based on https://github.com/farconada/RF24Network