pcbway




Interfacing of Arduino with NRF24L01,nrf24L01 Arduino, Arduino 24L01, Arduino Nrf2401,nrf24l01 arduino example, arduino nrf24l01Hello friends, i hope you all are fine and enjoying. As i have been working on a project now a days and the one portion of my current project includes the interfacing of Arduino with nrf24l01 module. So, i thought why not share this knowledge with you people, maybe you learn something new and more interesting. Few days ago I have also posted a tutorial on Interfacing of XBee with Arduino in which we have seen how to make wireless communication between two XBee Modules which is also an RF module. So, now we are gonna have a look at How to make Wireless Communication between two NRF24L01 modules. I hope you are gonna enjoy this nrf24l01 arduino example.

So before staring this interfacing of Arduino with 24L01, lets have a little introduction of nrf24l01 module. NRF24l01 is in fact a Radio Transceiver module and it operates on 2.4 GHz frequency. This module is a by default half- duplex fabricated module and it has the capability to send and receive data simultaneously. By display it is a very small size module but it’s features are astonishing. For example this module is capable of sending from 1 to 25 bytes of raw data simultaneously and the data transmission rate is up to 1 mega bytes per second. If we summarize all the features of this small size but big capability module then, we can say that:

  • By using this NRF24L01 module we can send a message to a particular receiver.
  • We can receive a message from some particular sender. (remember as I told earlier, we can do both the steps simultaneously).
  • During sending the message through this module, we will have to specify the message sender’s and receiver’s address.
  • Also we will have to specify the size of that particular message, which we are going to transmit through this module.
  • In some particular applications, we also have to perform switching between the receiver and sending state. For example, if you are received a particular message then, we will stop the communication first and will read it and then you will send it. So in such situations, we have to perform the switching while sending or receiving data through this module.

Now above discussion was a brief introduction about NRF24l01 module. Now lets move towards the major theme of our project which is Interfacing of arduino with NRF24l01 module.

Note:

  • I encountered a problem of “Failed, response timed out” with NRF24L01+ while interfacing it with Arduino, if you got the same problem then read this post Interfacing of NRF24L01+ with Arduino – Response Timed Out. This nrf24l01 arduino example will help you in understanding this Response Timed Out problem.

Interfacing of Arduino with NRF24L01 Module

Arduino is a very powerful and versatile micro controller board and it gives us the ease to perform multitasking. NRF24l01 has total 8 pins. The pin configuration and the function of each pin is described below:

  • The very first pin is for GND and through the pin#1 of this module, ground is provided to module.
  • Pin#2 of this module is to provide power supply. This pin is designated as VCC. This module generally needs 1.9 to 3.6 volts for its operation. And in most cases we will apply 3 volts to it.
  • Pin#3 is designated as CE and it is used to select the mode of operation. Either you are using this module to transmit data or to receive data.
  • Pin#4 is designated as CSN and it is used to enable the SPI chip, embedded on the module.
  • Pin#5 is used to provide SPI clock to the module. When this pin is HIGH then, clock is enabled and when this pin is LOW then, the clock to this module is disabled.
  • Pin#6 is designated as MOSI and it is used to transmit data from this module to the external circuit.
  • Pin#7 is designated as MISO and if we wish to receive data through this module from any external source then, this pin is enabled.
  • Pin#8 is the last pin of this module and it is designated as IRQ pin.

In order to do this Arduino with NRF24L01 communication, you will need two Arduino boards and two NRF24L01 modules. Now I suppose that you have these 4 items in your hand. So, first of all, let’s do the transmitter side interfacing of Arduino with NRF24L01.

NRF24L01 As Transmitter
  • Connect your NRF24L01 with Arduino as shown in the below figure:

Interfacing of Arduino with NRF24L01,nrf24L01 Arduino, Arduino 24L01, Arduino Nrf2401




  • Total 7 pins of NRF24L01 will be connected while the 8th pin IRQ doesn’t need to connect.
  • Now, next thing you need to do is to download this RF24 Library of Arduino and place it in the libraries folder of your Arduino software so that we could compile our code of nrf24l01 arduino example.

Arduino Library for NRF24L01

  • We haven’t designed this library, we are just sharing it for the engineers to get some help.
  • Now upload the below sketch into your Arduino which you want to act as Transmitter.

  •  In this code, I have marked the variable Command, this is the variable which I am sending via NRF24L01, rite now its value is 1 which you can change.
  • So, if you want to send 3 you can change its value to 3.
  • Now lets design the receiver side.
NRF24L01 As Receiver
  • Again connect your Arduino with NRF24L01 as shown in below figure. Its same as we did for Transmitter side.

Interfacing of Arduino with NRF24L01,nrf24L01 Arduino, Arduino 24L01, Arduino Nrf2401

  • Now upload this below code into the Receiver and you will start receiving the value coming from transmitter.




  • Now open your Serial Monitor of Receiver side and you will see that you are getting “1” in the Arduino Serial Monitor which is the value of Command variable we set in the Transmitter side, as shown in below figure:

Interfacing of Arduino with NRF24L01,nrf24L01 Arduino, Arduino 24L01, Arduino Nrf2401

  • Its quite easy and I hope you will make it work in the first attempt but if you still got problem then ask in comments.
  • I will share more Arduino Projects on this RF module soon.

So, that’s all for today and I hope now you can easily Interface Arduino with NRF24L01 and can do the RF communication. If you have any problem in this Interfacing of Arduino with NRF24L01 then ask in comments and I will try my best to resolve them. Take care. 🙂

13 Comments

    • Hello, I have tried many times to get these chips talking without success .This is a very clear and easy to understand tutorial .Well done. The downside is i am like one of the other commentors getting just a series of numbers in the serial monitor eg.4294967295 what is wrong? its so simple ,I am getting no errors and the baud rate is correct.I have double checked all connections.

  1. Syed,
    Excellent write-up on interfacing the Arduino with the NRF24. I’ve been researching this for some time and found your explanation simplest to follw. One question: How would the transmit and receiver sketches change if I want to use all 6 pipes. Basically having 1 byte of data sent from 6 individual Arduinos to the central Arduino?

  2. I want to send two unsigned long variables, what do I have to edit in the sketch to make it work, can you explain also this part :
    typedef enum { role_ping_out = 1, role_pong_back } role_e;

    const char* role_friendly_name[] = { “invalid”, “Ping out”, “Pong back”};

    role_e role = role_pong_back;

  3. great, its working.
    i want to add a button to the transmitter side.and put led to the receiver side.when i press the button then led should turn on.
    what editing do i need in this code?

  4. Hello Sir,

    I need the NRF24L01 library for Proteus and I didn’t find it nowhere.
    May you please help me and show me any link to download it?

    Thanks in advance!

  5. hello, your above article was really helpful for the start up. i have this doubt, if nrf24l01 can be use to communicate with android. if possible, please do brief on it.

  6. Hi there! I did everything that you said step by step and my transmitter isn’t transmitting and my receiver isn’t showing a thing on the serial monitor… its just blank! I really need an advice guys 😀

  7. hello zain
    my nrf24 stoped working,
    I am wobdring what is the probleme ?
    what gonna happen if I Source them by 5v instead of 3.3v? would they have been burned ?
    the same question if i basculate the ground with 3.3v?

    I have nrf and nrf + antenne

    • Yeah they could be damaged if you don’t provide power supply correctly. So, I would suggest you to first check the default example and test your NRF chips.

  8. hello, how do i interface two arduino to communicate to pc using nrf 24? this mean that my two arduino are both tx and pc is the Rx
    thank you

Leave a Reply

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

Post comment