Simple device-to-device communication with the NRF24L01+ module

December 29, 2017 Jeremy Cook, Engineering Consultant

Wireless communication can take many forms, from WiFi to Bluetooth, to LoRaWAN and everything in between. For an extremely low-cost option for Arduino projects (under $2 for each transceiver), it’s tough to beat the NRF24L01+. While its range is limited to 100 meters or less line-of-sight, it’s perfect for simple remote control and data transmission applications.

Besides its low cost, one benefit is that once the RX and TX microcontroller are programmed, you simply turn both on and they communicate without the hassle of pairing or logging on as you would with a WiFi or Bluetooth device. It’s also extremely small, making it easy to stuff into your latest IoT contraption. To explore its capabilities, I turned to this instructable by Akshay Jha, which outlines how to setup this type of communication via a pair of Arduino boards. He used an Uno and a Nano, as did I, but other Arduino combinations should work for this experiment as well.

I first wired up the NRF24L01+ modules to the Arduino boards as outlined per Jha’s instructions, which was actually the toughest part of the build. I didn’t have the proper jumper wires available, and had to resort to more soldering and wire cutting/stripping than would have normally been necessary. As outlined in this post, stocking up on cheap parts ahead of time can really be worth it, and I ordered the proper wires soon after this was completed. Another tip that I saw too late is to snap headers into individual pieces before trying to take them out by melting the solder—this would also have saved me some frustration when I took a set out in order to solder directly to the NRF24L01+ board.

With wiring complete, I programmed each Arduino as specified, but changed the first two lines to the following:

#include <SPI.h>

#include <nRF24L01.h>

#include <RF24.h>

I also modified the delay functions in the two pieces of code, including adding a delay at the end of the transmitter routine.

After this wiring and programming work, I had a set of components that, when the NRF24L01+ was plugged into the transmitting Nano, the receiving Uno would then blink an LED, and stop when power was disconnected, proving one was controlled by the other. You can also check this via serial output. One thing to note is that pin 13 is in use by the transceiver module, meaning that, as written, you will need to wire in an LED instead of use the one that is already onboard.

While I’m still in the early stages of using this device, I’m excited at the possibilities for such a tiny and inexpensive module for IoT applications. Looking through the Arduino IDE Library Manager, several interesting applications have been explored, including mesh networking, and even Bluetooth LE communication. At a price of around $2, this module is certainly worth consideration for your next wireless project.

Jeremy S. Cook is a freelance tech journalist and engineering consultant with over 10 years of factory automation experience. An avid maker and experimenter, you can see some of his exploits on the Jeremy Cook’s Projects YouTube Channel

No Previous Articles

Next Article
Benefits of publishing your work for MakerPros
Benefits of publishing your work for MakerPros

By moving on to the next project or task without reflecting on and recording what we’ve done, we lose some ...