I started working on a project which require communication with multiple radios. I started looking at nRF24L01 chip and found it to be very useful, cheap little device which has many features built-in. Initially I got two AVRs to talk to each other through the simple library found here (http://www.tinkerer.eu/AVRLib/nRF24L01). But I found multiple issues with the library when the number of nodes in the network increases,
- Didn’t support retries
- Dynamic packet sizes
- Channel scanning, etc
It was a simple library to start with and understand how the radio actually works in different configurations. I didn’t want to spend lot of time implementing all features I wanted so started looking around for complete libraries for nRF24L01, and I found RF24.
RF24 is one of the most complete libraries available for the nRF24L01[+]. So I implemented my project using RF24, It was an excellent library for AVRs (Arduino), but there was no port for devices running linux, as one of the nodes in my network was running linux I had to hack the code in order to get it to work on the beaglebone. So I had to spend a weekend hacking the RF24 library to come up with a very thin layer below the library to support all its features on embedded linux boards. I used a beaglebone for testing.
This is a Beaglebone port of the popular RF24(nrf24l01) library posted on https://github.com/maniacbug/RF24/.
If you find the library is out of sync with the Arduino library please drop an email to email@example.com
Contains portions of the GPIO library posted here,
Complete wiki can be found here
- Refer to RF24 documentation.
- You need a beaglebone with SPI enabled. Look here for a tutorial http://www.yellowfeather.co.uk/2012/03/userland-spi-on-the-beaglebone-with-ubuntu/
How to connect the pins
- I used one of these boards to test the library. http://iteadstudio.com/store/images/produce/Wireless/RF2401/RF24013.jpg
- Connect PIN 1 (GND) of NRF24L01 board to Expansion header P9 PIN 1(GND) of Beagleboard
- Connect PIN 2 (VCC) of NRF24L01 board to Expansion header P9 PIN 3(3v3) of Beagleboard
- Connect PIN 3 (CE) of NRF24L01 board to Expansion header P9 PIN 27(GPIO3_19) of Beagleboard
- Connect PIN 4 (CSN) of NRF24L01 board to Expansion header P9 PIN 25(GPIO3_21) of Beagleboard
- Connect PIN 5 (SCK) of NRF24L01 board to Expansion header P9 PIN 31(SPI1_SCLK) of Beagleboard
- Connect PIN 6 (MOSI) of NRF24L01 board to Expansion header P9 PIN 30(SPI1_D1) of Beagleboard
- Connect PIN 7 (MISO) of NRF24L01 board to Expansion header P9 PIN 29(SPI1_D0) of Beagleboard
- Note that the library uses a GPIO pin in BeagleBone as CS pin, which is an workaround/issue exist in the code. Planning to fix it whenever I have time.
- Project is written using NetBeans and I have commited some files used by netbeans IDE.
- main.c contains a program which prints out the information of the connected NRF24L01 device and ping demo.
- you may need to upload the Arduino sketch in ‘pingpair_dyn_arduino_pongback’ directory to a Arduino board in order for both Beaglebone and Arduino to run interactively.
Download the source here