Arduino Using NRF24L01 Rf Module

About: Mechanical engineer, Entrepreneur, Maker, robotic systems expert and founder of Robimek and RobiBot

Intro: Arduino Using NRF24L01 Rf Module

I will discuss the use of NRF24L01 transceiver module of the models commonly used in wireless communications.

You can use it easily to your use of this module is very easy and good range of projects. In addition, the price is also affordable. Low power consumption and 2.4GHz frequency operation also gives us the advantage.

http://www.robimek.com/arduino-ile-nrf24l01-rf-modul-kullanimi/

http://make.robimek.com/arduino-using-nrf24l01-rf-module/

Step 1: NRF24L01 2.4GHz Transceiver Module

  • Pcb module and an external antenna models are available.While the range of PCB model can go up to 250 m to 1000 m in range external antenna model.
  • Bi-directional communication by both the buyer to make your project can use both the transmitter module.

Step 2: Module Pin Connections:

The module communicates using SPI protocol.Therefore, you should make looking at the arduino pin connector model SPI pins. Let's show the pin connections with Arduino UNO as an example.

nRF24L01 Arduino Uno
VCC3.3 V

GNDGND

CS 7

CE 8

MOSI11

MISO12

SCK13

One of the other receiver of the wireless communication module when you need to set the transmitter.
A module according to status of the project can also be used if desired both the transmitter and receiver. In case the receiver or transmitter module that does not change the cable connection. These connections are the same for all situations.

Step 3: Sample Applications:

Wireless servo motor control with potentiometer

You can make the necessary connections by looking at the receiver and transmitter circuit in Fig.A receiver module for other modules of the software will also perform data transfer by identifying the wireless transmitter.

Step 4: Transmitter Software:

#include <SPI.h>

#include "RF24.h"

int msg[1]; //SCK -> 13//MISO -> 12//MOSI -> 11//CSN -> 7//CE -> 8

RF24 radio(8,7);

const uint64_t pipe = 0xE8E8F0F0E1LL;

int potpin = 0;

int val;

void setup(void)

{

radio.begin();

radio.openWritingPipe(pipe);

}

void loop(void)

{

val = analogRead(potpin);

val = map(val, 0, 1023, 0, 179);

msg[0] = val;

radio.write(msg, 1);

}

Step 5: Receiver Software:

#include <Servo.h>

#include <SPI.h>

#include "RF24.h"

Servo myservo;

//SCK -> 13//MISO -> 12//MOSI -> 11//CSN -> 7//CE -> 8

RF24 radio(8,7);

const uint64_t pipe = 0xE8E8F0F0E1LL;

int msg[1];

void setup()

{

myservo.attach(9);

radio.begin();

radio.openReadingPipe(1,pipe);

radio.startListening();

}

void loop()

{

if (radio.available())

{

bool done = false;

while (!done)

{

done = radio.read(msg, 1);

myservo.write (msg[0]);

}

} Servo.h>}

Step 6: Description of Function:

First we need to define the CE Software and CSN pins.
nrf24l01p attractive (7.8); >> Here's command 7.p the CSN 8.p is defined as the CE pin. In this function on behalf of the receiver module "receiver" We named. "nrf24l01p transmitter (7,8);" >> Here's command 7.p the CSN 8.p is defined as the CE pin. On behalf of transmitter modules in this function "transmitter" We named. Spı.beg the added library SP for communicating with the SPI protocol (); The setup communications function is started by writing into. "alici.channel (90);" >> defined communication channel value of 90 yaptık.b receiver module in the setup value should be the same value in both modules. Values between 0 and 125 can be written. "verici.channel (90);" we do >> the value defined in the setup, the communication channel 90 transmitter module. This value can be written in the same value range from 125 olmalıdır.0 in both modules. "alici.rxaddress (" control ");" >> We set the receiver module with the function name and address to the "control" gave the name. "verici.txaddress (" control ");" >> we set this function with the name and address of the transmitter module to the "control" gave the name. The two modules also address the communication channel name and value must be the same.

Important Note: Module communication between both modules also can not be obtained between VCC and GND pins and placing it between 10 uF 3.3 uF capacitor in the value and try again.

http://www.robimek.com/arduino-ile-nrf24l01-rf-modul-kullanimi/

http://make.robimek.com/arduino-using-nrf24l01-rf-module/

Share

    Recommendations

    • Optics Contest

      Optics Contest
    • Audio Contest 2018

      Audio Contest 2018
    • Electronics Tips & Tricks Challenge

      Electronics Tips & Tricks Challenge

    21 Discussions

    0
    None
    Nguyễn VănK

    2 years ago

    The basic of communication between 2arduino. it's very simple, watch my video to find out

    2 replies
    0
    None
    phannghiaNguyễn VănK

    Reply 2 years ago

    Your video is vietnamese, i am vietnamese and it helps me so much ^_^.Finally ,i can do it. But you can't help people here with this video.^^

    0
    None
    manofgresley

    Question 2 months ago on Step 5

    Hi.

    I am having a problem uploading your Receiver sketch, i get an error message saying "void value not ignored as it ought to be" for line "done = radio.read(msg 1 ); "

    Can you help me out please, what RF library did you use ?

    Regards

    Ray

    1 more answer
    0
    None
    PhilY10

    1 year ago

    Please help! I have problem verifying the receiver code, please check the error message below.

    -------------------------------------------------------------------------------------------------------

    Arduino: 1.8.1 (Windows Store 1.8.1.0) (Windows 10), Board: "Arduino Nano, ATmega328"

    C:\Users\ysc96\Documents\Arduino\Receiver\Receiver.ino: In function 'void loop()':

    Receiver:23: error: void value not ignored as it ought to be

    done = radio.read(msg, 1);

    ^

    Receiver:26: error: expected unqualified-id before '.' token

    } Servo.h>}

    ^

    exit status 1
    void value not ignored as it ought to be

    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.
    3 replies
    0
    None
    Manolov4PhilY10

    Reply 1 year ago

    Hey there. I am facing the same problem. Any solution?

    0
    None
    AliasmkManolov4

    Reply 1 year ago

    If you downloaded the library from the Arduino library manager, it may be an old version of the code.

    If you search for RF24 on GitHub you should be able to find the latest version. https://github.com/maniacbug/RF24

    1) Go to the link and click "Clone or Download"
    2) Click "Download ZIP"
    3) Go to your Arduino folder (should be in your Documents folder)
    4) Go to Libraries/RF24 folder
    5) Delete everything in the RF24 folder
    6) Open the zip and extract the files into the RF24 folder (should be dragging multiple files, not a folder. See photos)

    Close Arduino IDE and reopen it. Should work now.

    Alternatively, you can fix it yourself using the library you have downloaded.


    1) Go to your Arduino folder (should be in your Documents folder)
    2) Go to the Libraries/RF24 folder
    3) Open RF24.h and change line 205 from void read(... to bool read(... then save the file. See photo
    4) Open RF24.c
    5) Change line 1102 from void read(... to bool read(...
    6) Change line 1108 from write_register(... to return write_register(... . See photo.
    7) Save the file. You should be able to compile now.

    If you cant find the lines based on the line numbers, just do a Ctrl-F search for read( and you should be able to find the functions.

    Let me know if it works/doesn't work/you have any questions.

    Screen Shot 2017-08-20 at 12.34.49 AM.pngScreen Shot 2017-08-20 at 12.28.52 AM.pngScreen Shot 2017-08-20 at 12.28.42 AM.png
    0
    None
    AliasmkAliasmk

    Reply 1 year ago

    Upon further investigation, the GitHub link I supplied is actually an older version, but is likely the one the OP was using. Since then the library has been updated to break OPs code, causing your original error.

    You can either use the older version in the GitHub link, follow my alternate steps to make it work with the new library, or read the documentation the library to fix OPs code so that it's compatible with the new library. Good luck!

    0
    None
    Fadhela Khalaf

    1 year ago

    hi >> i need to know more how to read valuese recived wirelessly to arduino and display it on VB >> could you help please

    0
    None
    remaa

    2 years ago

    hi sir, i have to control the robot car project. Where the rear wheels in the form of a dc motor is controlled with flex sensors and front wheels in the form of a servo motor controlled by the accelerometer sensor. Robot controller with a car connected with nrf24l01. if one of the sensors to control I can. but if it combines both to control I can not. Both sensors transmit data simultaneously . dc motors and servo motors confused receive data so that its movement is chaotic. How should I fix this? can you help me.? Can I send my program to you and you see.? Please. My email: rema_adhe@yahoo.com

    0
    None
    bluegreen1211

    2 years ago

    Tesekkurler hocam. Elinize saglik. -Kenan

    0
    None
    arrow faster

    2 years ago

    your are the best for this......................................

    0
    None
    Dodutils

    3 years ago

    Hi,

    Couldn't compile using Arduino IDE 1.6.5, nRF24L01p.h file not found :-( I tried to google around but could not find this declaration file

    regards.

    2 replies
    0
    None
    Science102

    2 years ago

    I have also been having problems with trying to compile and upload this code to my arduinos. It is telling me there is a problem with " #include <nRF24L01p.h> ". I believe this means that I do not have the proper library but can't seem to find an nrf24l01 library that works. I hope someone can help me to solve this problem and guide me to the right library downlaod.

    0
    None
    abinay777

    3 years ago

    AND CAN ALSO SHOW THE PROGRAM FOR THE RECEIVER AND THE TRANSMITTER