NRF24L01-RF24-Examples

From ArduinoInfo
Jump to navigation Jump to search

nRF24L01 Examples using the RF24 Libraries

These libraries have been created by Maniacbug but are now maintained by TMRh20


Here are Maniacbug's ideas:
I really want to communicate wirelessly between Arduinos for cheap.
I love the idea of “The Internet of Things”, with everything I can look, see, touch all connected together. The problem is the cost. Zigbee modules seem to be the standard, but they are just too much to be a reasonable solution for putting everything on the Internet.

The Nordic nRF24L01, built into a small module and sold by mdfly.com for $6.50 (and YourDuino.com for $4.75 [Now $2.45] ) is an excellent solution. It’s cheap, fast (2 Mbps), easy, reliable, and low-power. It entirely implements the Data Link Layer in hardware, handling addressing, collisions, and retry, saving us lots of work on the software side. Zigbee has the brand recognition, but this little guy puts it to shame.

Download RF24 Library here (follow installation instructions or download through the Arduino IDE itself!)

Design Goals: This library is designed to be...

  • Maximally compliant with the intended operation of the chip
  • Easy for beginners to use
  • Consumed with a public interface that's similiar to other Arduino standard libraries
  • Built against the standard SPI library.

Library Documentation: Online HERE

Link to nRF24L01 Data Sheet. If you want to understand what you can do with this "little" radio, download the data sheet. In particular you may want to read pages 7-8-9 ( For Overview and Features), and page 39 (MultiCeiver, which allows 6 Arduinos to talk to a Primary Arduino in an organized manner). Fortunately the board-level products we have take care of many of the physical and electrical details and Antenna Impedance Matching etc., and this library takes care of lots of register initialization and operational details.

After you download and copy the RF24 Library, start the IDE, click File>Examples>RF24 and you'll see several example sketches to start with. Some are these:

  • GettingStarted This is an example of how to use the RF24 class. Write this sketch to two different nodes. Put one of the nodes into 'transmit' mode by connecting with the serial monitor and sending a 'T'. The ping node sends the current time to the pong node, which responds by sending the value back. The ping node can then see how long the whole cycle took
  • pingpair This is an example of how to use the RF24 class. Write this same sketch to two different nodes, connect the role_pin to ground on one. The ping node sends the current time to the pong node, which responds by sending the value back. The ping node can then see how long the whole cycle took.


A Big ArduinoThanks to J. Coliz AKA ManiacBug and TMRh20 for his great work on this!