Arduino Tutorial: Arduino NRF24L01 Wireless Tutorial with Arduino Uno


Dear friends welcome to another video! This
is Nick from educ8s.tv and today we are going to take a look at the impressive NRF24L01
wireless transceiver module. We are going to learn how to add wireless capability to
our Arduino Projects! Without any further delay let’s get started!
In this video we are going to build a simple project just to demonstrate how easy it is
to add wireless capability to our Arduino Projects. I have two Arduinos here. This one
is sending some data every second, and the other one is receiving the data and displaying
it at the serial monitor. As you can see this one way communication is working fine and
the range is very good, I can easily get more than 10 meters! The theoretical range that
we can achieve is about 100 meters. The NRF24L01 module is a low cost bi-directional
transceiver module. The cost of it is less than 3$! You can find a link for it in the
description of the video. It operates at the 2.4GHz band and it can achieve at a data rate
of 2Mbits! Impressive isn’t it? It uses the SPI interface in order to communicate
with Arduino, so it is very easy to use with it. We have to connect 7 of the 8 pins of
the module in order to make it work with Arduino. Let’s see how to do it.
Unfortunately we can’t plug the module in the breadboard so we are going to use male
to female wires in order to connect the module to Arduino. Pin number 1 of the module is
GND. You have to connect it to Arduino Ground. The next pin is Vcc. You have to connect it
to the 3.3V output of the Arduino Uno. Be careful! Do not connect it to 5V or you will
destroy your module! The third pin is named CE and you can connect it to any digital pin
you like. In this example I am going to connect it to digital pin 7. Pin 4 is CS and you can
connect to any digital pin as well. I am going to connect to digital pin 8. The next pin
is SCK which goes to digital pin 13 of the Arduino Uno. The next pin is MOSI which goes
to digital pin 11 and the last pin in MISO which goes to digital pin 12. That’s it!
Now let’s power up the project and see if we can receive the data that the other module
is sending! Great! As you can see, we receive the data packages that the other module sends.
Now let’s see the code of the code for both the receiver and transmitter.
First of all, we have to download the RF24 library in order to make our life easier when
we work with the NRF24L01 wireless modules. You can find the link for the library in the
description of the video. Let’s first see the Transmitter code. It
sends out a simple data structure which contains an Integer, a Float, and a character array.
In order to establish a communication link we have to create a “pipe” between the
two modules. That pipe needs to have an address. Both modules have to write and read from the
same pipe in order to communicate. That’s the first thing we define in our code, we
set the pipe address to “0”. Next we define the channel at which we want to communicate
with the other module. The NRF24L01 chip supports 126 different channels. Both modules need
to use the same channel in order to communicate with each other. In this example I am using
channel 115. Next, I define that I want to use the maximum transmitting power that the
module offers. It uses more power but extends the range of the communication. Next we define
the data rate of the transmission. I set it to 250Kbs which is the lowest possible data
rate in order to achieve better range. The next step is to open the pipe in order to
write to it later. In the loop function, we send the data structure
we have defined by writing the data structure to the pipe, we change the values of the data
structure in order to send different packages at every loop and wait for a second. That’s
a basic sender program. Let’s now see the receiver program. At first
we define the same data structure that is going to receive the data. Next, we define
the same pipe address that we used in the transmitter program as well. We initialize
the module with the same parameters that we used in the transmitter and we open the pipe.
In the loop function we wait for data, and when there is data available in the pipe we
save that data in the data structure and print them in the serial monitor. That’s it. You
can find the code of this project in link in the description of the video.
As you can see we the code of the project is very easy! We send data from one Arduino
to the other. It is a simple one way communication, we don’t know if the second Arduino receives
the data, we send new data all the time. In a future video, I am going to show you how
to achieve bi-directional communication with these modules in order to have a more reliable
communication. This video is intended to be simple project in order to demonstrate that
these modules are a great easy way to start with wireless projects. Many of my future
projects will use these modules! I would like to know your experiences with the NRF24L01
modules. Do you use them in your projects? If so, do you have any advice to share with
us? Please post your comments or ideas in the comments section below.
Also, if you want to see the latest channel news, like what project I am currently working
on, you can follow the Facebook page of the channel at https://www.facebook.com/educ8stv
. If this is your first time here, I would love
to have you subscribed. In this channel I post videos about DIY projects every Saturday.
I build projects with Arduino, Raspberry Pi, I build robots and simple electronic circuits.
I hope you will join our community. I love making things and helping people doing the
same. I hope that you will join our community. Until next Saturday, Watch, Learn, Build!

100 comments on “Arduino Tutorial: Arduino NRF24L01 Wireless Tutorial with Arduino Uno”

  1. Julio Zaga says:

    Thanks a lot, simple and good explain

  2. Vaibhav Gautam says:

    Hi,

    Thanks for this informative tutorial but when i tried this i am not sure why my code is not entering the first if condition(radio.available()),

    i added else saying
    Serial.print("no radio available n")

    but it is not entering the the first if condition. can you please help me with this ?

  3. Tauhidul Islam Mesbah says:

    can you make automatic house plant watering with arduino

  4. Ravindra Khopade says:

    i want to connect multiple arduinos and form private area network. Is it possible with nrf24l01 module

  5. abbas khan says:

    can we send video signals through nrf24l01???

  6. DFMD LP says:

    nice tutorial @educ8s.tv , could you please make a tutorial for the HC-12 long range modul?

  7. Naven Suresh says:

    In this project there is no need to have another receiver arduino
    The transmitter arduino is simply sending the data even when the receiver arduino is not connected.
    Waste of time….

  8. Jaykrishna R Sakin says:

    I want to use this for my project
    WIRELESS SPEED SYNCHRONIZATION OF DC MOTORS
    Can I???

  9. manolejder says:

    Hi,
    It seems that the receiver nRF25 doesn't work. Whether the message on Serial Monitor for transmiter is ok, like in your tutorial, the message for receiver is:
    Package: 0.00 in a continous scrolling. Can you give me a help!
    Thank You!

  10. Rithik Sriram says:

    can i do a project using only one

  11. Ganesh Kothavale says:

    can we send data from nrf24l01+ to an android phone, if possible how can we retrieve the data from android phone

  12. Dharmendra Savaliya says:

    Hello sir,
    Can we use NRF24L01 with Arduino for commercial automation ?

  13. ChocolateSheetCookies says:

    If there are several of this communicating at the same time on the same channel, will there be interference?

    I plan to make several battle bots all preset to the same channel, but just wondering if it will be an issue.
    Or should I make a toggle switch to toggle between several channels?

  14. OE8PCK says:

    Thank you very much for this wonder tutorial. Do you have any experiance with a Teensy 3.2 and the NRF24L01? I tried the same rx code on this board but the rx did not work. Just a thought. 🙂

  15. carlos godfather says:

    re file trexo linux kai to nrf24l01 to exo syndesei se pro mini kai den mou paizoun… ksereis kati? to exeis dokimasei?

  16. miguel pico says:

    does that library also work for arduino mega 2560?

  17. Sagar Saha says:

    Is it necessary that both has to be arduino uno? I have arduino uno and arduino mega!! Will it work??

  18. Jeppe Allerslev says:

    Hi, great tutorial! But i have one small problem. I copied everything you did in the video, and used the exact same code. My two devices can send and recieve signals, but they are pure gibberish . It just sends some random symbols, and prints them to the serial monitor. This happens on both the sending end and the recieving. I have confirmed that the recieving end is actually getting its data from the other device.

  19. Pablo C. Izaguirre Artavia says:

    The best teacher that i found in Youtube ! Thanks From Costa Rica !

  20. Ilmawan adit says:

    sir which code should i modify in my receiver if i want set my receiver as server with many clients ?

  21. madgab1010 says:

    Hi, sorry i'm verry newby with arduino and i ask me a question; in the website https://github.com/TMRh20/RF24 . Wich library that i have to download for the nrf24l01? Cause i'm confuse with all the file. thank you

  22. ShibaTheDestroyer says:

    Great and concise summary!

  23. Jan Geirnaert says:

    can the same hardware NRF24L01 transceiver be used as well as receiver and as sender?

  24. Jan Geirnaert says:

    is there any LED indicator that the devices are sending / receiving?

  25. Jan Geirnaert says:

    is the PIN layout for the receiver the same as for the transmitter

  26. Jan Geirnaert says:

    I am having a few problems… The serial monitor of arduino.tx.device.1 shows that it is transmitting (tx button is yellow blinking while the serial monitor shows the output of what is sent). The arduino.device.2 is only showing rx led blinking when I UNPLUG the cable from pin8 or pin7 of the arduino.device.2 / any suggestions?

  27. TheOrenbarak says:

    FINALLY GOT IT TO WORK THANKS TO THIS VIDEOS!!!
    Thanks a lot bro! great example!

  28. Rahul Kashyap says:

    can it work without computer

  29. Chrysippus says:

    As someone who doesn't know C I don't understand the following:
    byte adresses[][6] = {"0"};
    then
    myRadio.openWritingPipe(addresses[0]);
    It's creating an array with a single item and using the first one, right? And that item is just 6 NUL bytes?

  30. Sachin Agnihotri says:

    i am trying to make one small mesh network , but i am facing many problems . i want some guidance to make this projects. i have four nrf24l01 i want to connect all of them in a mesh such that if any of the module is in out of range data should reach at that module by another path in which it is connected.

  31. baibhav says:

    my receiver is not working properly.. it's just showing random values in serial monitor when I'm trying to send a struct or array. I've checked the connection and baud rate.everything works fine if a send just one value like an integer

  32. Ilmawan adit says:

    thanks very good explanation from your videos sir!

    will you make another example nrf24l01 in arduino with multiple node ? (many tranceiver and 1 master ?) i think is very helpful for us

  33. BarbasBandas 666 says:

    I am having problems with the nrf24l01. Capacitors, power supllies and PA Levels dont changed anything…. When I open the GettingStarted Sketch I receive either 0 or random numbers or even the Serial Monitors just blocks. Baud rate settings are ok too. They were working kind off bad yesterday but today nothing. Can anybody help me? Is it possible that my libraries are not working correctly??

  34. Eldon Tenorio says:

    Hi Nick, any advice why communication fails when I move the two Arduinos with the NRF24L01 modules away for only about one meter apart? Thanks in advance for the reply.

  35. Watch Dog says:

    IF one NRF acts as a transmitter how many maximum NRF receivers we can use to get the data from the transmitter?

  36. Hole to another Universe says:

    I‘ve have seen somebody with that thing transmitting data over 64km

  37. aykut sirma says:

    I have done as you said in your video and add a led if myRadio.available() is successful or not. And my led is ON but nothing appears on my serial monitor or thy appear after a long time – then I get the text message with 0 and weird numbers on my serial monitor. I even don't get a clean text on my serial monitor too. Do you know what might be the cause of it ? or maybe my nrf24l01 is malfunctioned ?If it is like that I will get a new one :(. For the last two days I didn't figure out why I don't see any text on serial monitor and even I get them after a long period and thy are not showing this too : Text to be transmitted.

    Package:0
    0.00

    Package:0
    0.00

    Package:0r⸮⸮⸮
    Package:0
    0.00

    Package:0
    0.00

  38. Peter Allen says:

    My attempt works fine except my receive program will only serial print 26 letters (including spaces) out of 60 odd…. I have been tinkering with the program.. any HELP Please.

  39. matthias kathriner says:

    cant understand anything sorry, thanks for the try!

  40. Kadir Güzel says:

    THANK YOU SO MUCH FİNALLY IT'S WORKED THANK YOU MAN THANK YOU SO MUCH!!

  41. I.MOHAMED SAIF says:

    I saw the video but there is some thing error in the connections we have give due to which the transmitter is not transmitting and receiver is not receiving.

  42. gulfsurfco says:

    Nice instructions. I have been looking for a concise and well presented instruction and your video has been one of the best ones. Thanks.

  43. SportingLisbon says:

    The greatest tutorial I've ever seen about NRF24L01. Thank you for your help and efforts to prepare such an explanatory tutorial. Thumbs up 🙂

  44. DVEX49 says:

    Thx man, helps a lot

  45. Nitin Dangwal says:

    hi nice video.

  46. Assaf Alshochat says:

    if i accidently connected to 5V for few minuts. the module is dead for sure?

  47. DrekerboyStudio says:

    hi i followed everything but it keeps recieving all kinds of weird symbols.
    and yes i tried to switch from baud rate. so thats not the problem.
    please someone help me!
    Thanks.

  48. maniwal rohit says:

    nice explanation…Thank-You 🙂

  49. Manoj Reddy says:

    why do we have to use only 11 12 13 pins for mosi miso ans sck? can anyone pls explain?

  50. Emilijus Lukosius says:

    NOT WORKING WITH MEGA

  51. RISING HEAD says:

    Can I make 4 transmitter and 1 recever. If Yes, than HOW .plz,plz,plz

  52. Shishir Imran says:

    automaticaly works before putting signal..whats the problem?

  53. Elektronik Atölyem says:

    Excellent

  54. Mrityunjay Sharma says:

    your explanation gave me orgasm dude !!! Keep going 🙂

  55. Zdenek S says:

    Thank you! I am beginner, before this video, I've already tried 4 simple manual how to get nrf24l01 module to work with no success. I thought I must have hardware problem, but fortunately I found you video and now it works perfectly! I am happy you are here.

  56. DENİZ CEYLAN says:

    are you greek?

  57. v zolo says:

    μπορω να χρησιμοποιησω το module αυτο σε ενα rc boat?

  58. Ammar Khalil says:

    I'm facing a problem while compiling on my laptop running Arduino 1.6.8 while same code compiled on my Pc running Arduino 1.8.5.
    error is
    "invalid conversion from 'byte* {aka unsigned char*}' to 'uint64_t {aka long long unsigned int}' [-fpermissive]
    "
    help my figure out this problem. thnaks

  59. DBZ MAN says:

    Can I make one module transfer and receive?

  60. Konuya Bak says:

    this with MODULE DIY RC CAR : http://www.konuyabak.com/teknoloji/programlama/arduino/arduino-ile-rc-car-kumandali-araba-yapimi.html

  61. Ascanio Fiori says:

    Hi. I have tried this, but unfortanely I could not succeed. I have used a Arduino uno and a nano. Checked out wire many times, checked code. No way and I do not understand why.

  62. Ricky Bates says:

    I used 2 different transmitter units and 2 different power supplies. It seemed to only transmit when I hold my finger on either the CSM or MISO pins. Strange but i'm sure I'll find a bad jumper wire or something.

  63. arjun6136 says:

    Hello my receiver part of the code isn't working. I'm using teensy 3.2 for it. Can anyone help me regarding this.

  64. BRO JAN says:

    are there any effect if i use different baud rate between transmit and receive..?

  65. stop stop says:

    How many rang of nrf24 ?????

  66. Shouvik Mukherjee says:

    How do I use this module for mesh communication pls suggest me pls

  67. Farah Mohammed says:

    Too many thanks

  68. Apoorva Rampal says:

    I have done the exact connections, also have included the RF24 library, copied the same code, set the baud rate 115200 but still receiver serial COM port is showing nothing. I have used nrf24l01+PA+LNA , there is antenna mounted too. Also I am using Arduino IDE version 1.8.1. It will be helpful if you give a quick reply. And also I am powering these two boards through same laptop ports not using any power bank or additional power supply.

  69. Xian Yx says:

    Bro izit okay if i replace nano with uno ?

  70. Aisha AB says:

    Thank you!

  71. Marcelo Arias says:

    great video !!

  72. Mark Ruiz says:

    I am sensing humidity temperature turbidity and UV from one uno to another uno, however, only half of the data is received, the rest is set to all 0’s……any idea why? :/

  73. Mark Ruiz says:

    I am sensing humidity temperature turbidity and UV from one uno to another uno, however, only half of the data is received, the rest is set to all 0’s……any idea why? :/

  74. Sayan Chowdhury says:

    Hi, I am using this code for the receiver. The transmitter looks fine in the serial monitor, but the receiver throws pure gibberish on the serial monitor. Adjusted the baud to all possible values. Not working. Please help. #include <SPI.h>

    #include <nRF24L01.h>

    #include <RF24.h>

    RF24 radio(7, 8); // CE, CSN

    const byte address[6] = "00001";

    void setup() {

    Serial.begin(115200);

    radio.begin();

    radio.openReadingPipe(0, address);

    radio.setPALevel(RF24_PA_MIN);

    radio.startListening();

    }

    void loop() {

    if (radio.available()) {

    char text[32] ="";

    radio.read(&text, sizeof(text));

    Serial.println(text);

    delay(1000);

    }

    }

  75. Alfred Kasereka says:

    The one I have doesn't have pins. How to plug it?

  76. Double-Life Nightcore says:

    Why does the RF module doesn't work once the power is reconnected to it !

    I mean.. it receive the data efficiently ..however when the power of the receiver is reconnected, it does not receive any data at all ! Can someone tell why this is happening

  77. 93Hangman says:

    I'm curious, how do you go about programming the NRF24L01 Wireless Transceiver? Once you plug it into the R3 Uno board, and then connect it to the pc, I'm assuming you use the software that comes with the board itself and then use the code that you provided in the video and go from there? Just trying to make sure I fully understand.

  78. Alex Doan says:

    Will you make a tutorial on connectivity between devise (i.e. sensor) and IoT platforms? I'm deeply interested in ThingsBoard? for example. TNX

  79. Karthick Ramkrish says:

    How to connect 4 rf transmitter at single Arduino atmega?

  80. Sreekanth Mp says:

    https://youtu.be/bGkJzkPC0xg
    Operating heavy machine by remote using NRF24L01& Arduino Uno
    Please watch and subscribe

  81. Gab EA says:

    Thank you for the instructions, really helped me. I have a question, Is there a way that I can decrease the range of the module? because i'm using it for just a short range function which rely on the limits of range of the module. Thank you in advance

  82. Lund Johnson says:

    Great tutorial that helped a lot. The set up works well. I'm not sure tho how to change the code in such a way as it could be reading the data from a sensor then sending that instead. If anyone has any help please let me know.

  83. Akshay David says:

    Very nice! Made it simple to understand

  84. Eran Betzalel says:

    Hi , i watched this tutorial NRF TX and RX with arduino and it was very helpfull. now im trying to do something more compicated, to have 2 arduino tx and rx when im press a button (depends on which one)
    for example when im press "arduino 1" button, the LED on arduino 2 blink and when im press on "arduino 2" button, the LED on arduino 1 blink.
    I realy need help its for my project in my college.
    thank you very much.

  85. Gaurav Mittal says:

    Can I use the analog pins as digital pins for pins 11-13? My LCD is already taking up digital pins 11-13

  86. Blackbirduino says:

    5v will destroy my model? are u sure?

  87. Nery Romani says:

    Solo se ve cuando transmite pero no cuando recibe, ese es el problema que tienen muchos y que se ha visto en varios foros. Podrías ayudar a poder recibirlo?

  88. Hashem Skhita says:

    i have nrf24l01 with antenna and i have one without antenna .. They can not communicate with each other
    ..
    Should they be the same type
    ..

  89. Lasted says:

    how can i find out the directivity pattern of nrf24l01+?

  90. JanosTerroz says:

    Well done video. Thanks

  91. Oncle Dan says:

    Good evening, all
    I got my new nRF24L01+, and I followed this video very carefully .. without success. Both modules does not seem to communicate between eachother. I am working mainly with Nano boards and connections are the same for this simple project.

    I checked the connections (Yes! 3,3V, not 5V.), the code is identical (Copied/Pasted it) and included all the libraries stated in the code. The transmitting side « seems » to be doing its job all right, but the at the receiver end, the condition « myRadio..available() » is never true and, consequently, the data never gets read.

    Do you have any idea why this is happening? Does the modules not have to be paired prior to the communication? I'm quite new in Arduino programming so, don't get into reading from and writing to the registers.

    All say it's a simple way to achieve communication .. but I fail to male it work, despite all efforts to do so. Could someone please help me get this going ?

    Thank you for your input. I am grateful to any help provided. Until then, you all have a nice day!

  92. Shahrul Iman says:

    thanks for the information… 👍

  93. unglaubich uberlieber says:

    your tutorial is certainly an eye opener, bravo bravo bravo, now i will try to adapt this to a "network" environment with a nrf24l01 to multiple receivers… again many thanks

  94. Kundan Gaikwad says:

    I am not able to obtain bidirectional communication ? Only one arduino sends msg and received at other but second one is not sending back.

  95. Jeran rai says:

    Somebody help me, We only defined the CE and CSN pin of the NRF24lo1 to the arduino in the code, what happened to the rest of the three NRF24l01 pins ( SCK, MOSI, MISO) in the code, or it dosent matter to the code ! so we could randomly connect these pins to any digital pins in arduino differently in transmitter and receiver ?

  96. xx sd says:

    Can we use any module as an transmitter and receiver or is is like this is transmitter and the other is reciver(if you buy the reciver module you can only receive data or it can send and receive). Plz help it for my drone

  97. Lil Dank says:

    tysm for this clear tutorial, could not get to work at first, but then I double-checked the connections on the website and realized I had connected 1 cable wrong and got it working 😀

  98. Genaro Talavera says:

    hello, I have a problem whit librari nRF24L01.h, because dont read and the comand setPAlevel dont working

  99. Nidhi Khamayacha says:

    I am getting error pgm_read_ptr was not declared in this scope

  100. Abdul Azeemuddin says:

    I want to transmit the excel sheet data from one system to other how can i do it .
    Can you please help me out !!

Leave a Reply

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