Getting started with nrf24: Hardware connection


The nrf24 chips are all SPI-based, which means they use a bit clock (SCK), chip select (CS#), and two data lines (MISO, MOSI) to communicate with the host.  In addition, there is a chip enable (CE) that is used as an external control over the radio itself.  Finally, if your application calls for it, you can elect to connect the interrupt line (IRQ), which tells you when various events complete within the nrf24 itself, to save you from status polling.

I won’t cover the various non-digital connections at this point, but rather leave that to other sources such as the schematic for SparkFun’s nrf24l01+ module.  I’ll probably write a section on that eventually though, stay tuned.

Now, to connect it to your average microcontroller, you simply want to find the SCK/MISO/MOSI pins and connect them straight across.  The CS# pin may or may not go to one labeled on the microcontroller as such (or SS# for “slave select”), and in general it doesn’t matter because most microcontrollers do not maintain automatic control over the slave/chip select lines in master mode, since there could be an arbitrary number of them.  CE is even more loose as far as were you connect it, since it’s not actually part of the SPI interface itself anyway.  IRQ would ideally connect to a microcontroller pin that’s capable of actually triggering an interrupt, should you wish to use that functionality.

Here’s the nrf24l01+ connected up to an ATmegaXX8:

An Xmega is “better” since you can use any of the “serial” ports you want, and since every single pin is capable of triggering an interrupt you can wire IRQ anywhere you want as well:

However, if you are prepared to “bitbang” your interface, you can connect it any which way you want.  If communication speed and efficiency is not your main concern, this can make your board routing significantly easier:

A special case are the various nrf24 chips which also contain microcontrollers.  Examples are the nrf24LE1 and nrf24LU1(+).  The actually SPI interface is present inside the chip, but instead of having to wire it up, they’ve simply connected them inside the chip.  In that sense it’s almost the same as connecting up a nrf24l01+ to a regular 8051 microcontroller and using the existing SPI registers, except you’re just using a different SPI port.  Kindof.

Now another option to seriously consider in your PCB design is that of actually driving the chip’s power entirely from the microcontroller.  This gives you the ability to completely turn off the chip if you so desire (for power savings), or to hard reset the chip in case it goes wonky (which I seem to have happen on a regular basis):

Be sure that the maximum current of the nrf24l01+ does not exceed that which your microcontroller can supply.  In the above case, the Xmega is capable of driving 20mA on each pin, which is plenty of headroom over the 13.5mA max draw of the nrf24l01+.  If your chip doesn’t drive that hard, you can simply connect multiple pins together.  Just make sure those pins all turn on at exactly the same time, or you’ll short out your power supply and probably fry your microcontroller…

The next post will cover the software side of the physical connection: getting and setting registers, transferring actual packet data, and making the radio actually radiate.



  1. If your uc can’t power the nrf directly, you could also just use an extra transistor. Adds to the part count, but safer than depending on software to switch a bunch of pins together.

    • Yup, although it should be perfectly safe to switch several at a time on most MCUs, especially if you set the level and then set the direction of the pins with byte-wide RMW (or in the case of the Xmega, the OUTSET and DIRSET registers). OTOH, on a conventional AVR that could be bad, since setting the OUT bit on a pin that’s configured for input can engage the pull-up resistor, possibly suppling some microamps to the nrf24 a few cycles early.

      Your posting here just now is a little creepy though, since I was talking with a friend just last night at Dorkbot about linking him up with you to talk about some stuff…..

  2. Will there be any more tutorials? Especially around the
    programming part?

    • I had to give up on the nrf24 work for now because my product development was bogging down. I came up with another programming board that should work wired, which I’ll try to post about soon. I still plan on getting back to this at some point, since I want to finish the remote programming tool and I’m using the chip for another “secret project”.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: