nRF24L01 Report

nRF24L01 Radio

The nRF24L01 MiRF-v2 Radio Module

This report documents the nRF24L01 data radio.  The nRF24L01 is an excellent, inexpensive, and well-packaged option for short-range wireless communications.  I will discuss the radio’s hardware interface and firmware, and present a driver I have written targetting the AVR platform.

In the mechatronics courses in computer science and software engineering at UVic, we have gone through several different radios for wireless data transfer.  In 2006 we used the paired WRL-08950 and WRL-08946, which were very cheap but also slow and extremely unreliable, and only offered one-way communication.  In 2008 we used the TXRX24G, which provided high speed, high range, bidirectional communication.  However, it suffered from transmission unreliability and a complex interface that made the software driver quite difficult to develop and maintain.  We have used Bluetooth solutions on occassion, but they are very expensive and complex, and thus not suitable for classes that might need a dozen or more radio units to satisfy the needs of all its projects.  Over the last few years, students have spent too much time dealing with radio problems instead of doing more interesting and relevant course work.

The Nordic Semiconductor nRF24L01 is descended from the TXRX24G, but it offers some important features that make it much easier to deal with:

  • Enhanced Shockburst™:  This is Nordic’s link layer protocol that gives the radio auto-acknowledgement, auto-retransmit, and packet loss detection capability.  It will make the wireless link much more reliable without adding complexity to the students’ application programs.
  • SPI bus:  The nRF24L01 implements a 4-wire Serial Peripheral Interface bus.  This allows the software driver to use the microcontroller’s native high speed SPI module for communications instead of having to do manual bit bashing, which is less reliable, slower, and more difficult to implement.
  • External antenna:  This should improve the new radio’s sensitivity and range over those of the old radios.
  • MultiCeiver™:  Each radio can receive packets on up to six different addresses.  This allows us to implement features such as selective packet broadcasting without sacrificing other functionality.
  • Other features:  Variable packet widths, packet queueing, ack packet payload, etc.

All examples and code in this report are based on the Atmel AT90USB1287 microcontroller (referred to as the AT90), but any microcontroller with an SPI driver should be able to use the radio.  In particular, the WinAVR toolchain should be able to compile this driver for any AVR chip, with some minor edits.  The port names and interrupt name may have to be changed to suit a given chip or application.  The driver code includes a fork for the Arduino.  That fork is written for the Arduino Mega, but it can be updated to work with other Arduino platforms by changing the pin assignments.

Table of Contents

9 thoughts on “nRF24L01 Report

  1. Mike

    I like what you have done here. Do you have any example code for these transceivers for two-way communications?


    Great work! I am trying to connect the nRF24L01 to an arduino board that already is using the Arduino hardware SPI for Ethernet (pins 10-13). My nRF24L01 is connected like this:
    CE – D3
    SCK – D7
    MISO – D6
    MOSI – D5
    IRQ – D2
    NSS – D8
    If I modify the pinouts directly in spi.cpp will this work or still conflict with the hardware SPI?

    1. Neil MacMillan Post author

      That will still conflict with the SPI. The MOSI, MISO, and SCK pins in the SPI module are hardwired to D11, D12, and D13 respectively.

      If you are using an Arduino Uno and feel adventurous you might instead be able to use the AVR’s USART in SPI mode, in which case you can use D1, D0, and D4 for MOSI, MISO, and SCK. I have never used the USART module in SPI mode but I think it would work. The ATmega328P datasheet [PDF, 12.5 MB] has more information in chapter 20. A quick search didn’t turn up any existing Arduino code to support the task.

  3. Tiago Pereira

    Hi, its possible create a bidiretional communication with these modules? That is, to be receiving data, but also send actions to uC.

    Best Regards

    Tiago Pereira

    1. Neil MacMillan Post author

      I’m not sure what you mean. I think it is possible for the radio to receive data over the air while it is communicating with the uC via SPI. I’ve never tried it though.

  4. Bence Balla


    I don’t know this thread is active, but I hope so. I am new to the NRF24L01 module, but I am amazed by its possibilities. I need some guideness. Here is my idea: I have two NRF24L01+ modules(extended range with PA, LNA on boards), two Arduino Megas with bluetooth modules (attached to RXTX simple serial pins) and two android phones with a handy bluetooth serial port software (basicaly it is a bletooth terminal window). So I would use this radio transciever modules to expand the range of data transmission. For now, I am not interested in topologies, token rings, error correction and all that network stuffs, I want to establish a stable “chat-like” connection between the two phones. What is the simpliest way to do it?

    Best wishes!

    Bence Balla


Leave a Reply

Your email address will not be published. Required fields are marked *

ERROR: si-captcha.php plugin says GD image support not detected in PHP!

Contact your web host and ask them why GD image support is not enabled for PHP.

ERROR: si-captcha.php plugin says imagepng function not detected in PHP!

Contact your web host and ask them why imagepng function is not enabled for PHP.