Sunday, June 22, 2014

Nrf24L01+ (RF24) Radio on Arduino Micro

The nRF24L01+ radios are an awesome piece of equipment for wireless Arduino projects: for just $2.45 (e.g. on Yourduino) you can get everything you need to make an Arduino wireless!  This thing is tiny, very power efficient, and very easy to code.

However, I wanted to post one note: if you're running on Arduino Micro, the commonly used pinout is wrong and will not work.  I just spent a few hours debugging, so I figured I'd share in case anyone else searches for this problem.

In the most commonly used getting started guide from Maniacbug - who is also the author of the RF24 library - he gives the pinout and connections for an Arduino Due, which should also work for an Arduino Uno (I haven't tried).  However, the Arduino Micro has its ISCP pins connected differently, so this pinout will not work!  To quote the official Arduino Micro product page on the board's I/O capabilities:

"SPI: on the ICSP header. These pins support SPI communication using the SPI library. Note that the SPI pins are not connected to any of the digital I/O pins as they are on the Arduino Uno, they are only available on the ICSP connector and on the nearby pins labelled MISO, MOSI and SCK."
 Easy to overlook, but key to our scenario!  In order for the SPI library to work (and the RF24 library uses SPI internally to communicate with the radio), we need to connect the SPI pins to the dedicated SPI pins, not the general IO pins.

Here's the pinout that worked for me:



Line
From Arduino Pin
To Radio Pin
GND
GND
1
3V3
3V3
2
CE
9
3
CSN
10
4
SCK
SCK
5
MOSI
MOSI
6
MISO
MISO
7


The Arduino Micro pins are shown in this diagram (taken from the product page).  The SCK, MISO and MOSI pins are on the top of the picture.



No comments:

Post a Comment