Introduction: 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/
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/

Participated in the
Epilog Contest VII
28 Comments
Question 1 year ago on Step 5
done=radio.read(msg1);
error
exit status 1
void value not ignored as it ought to be
who can advise me>
d
Answer 1 year ago
i also have same problem
Question 1 year ago
Help. I tried doing the Hello World example & there is some issue I added the capacitors at I put & checked every connection but somehow it takes around an hour of restarting & checking the connections for the modules to connect to each other & once they are connected it's not a problem I can disconnect them for some time & again they work but everytime I keep them disconnected for over night I have to spend an hour sometimes 2 for them to work again this has haulted all my efforts as I have classes & work during the day & every night I wana work on this my work is left incomplete as most of time is gone only to start the connection between them
please help
2 years ago
So how many of these modules can be paired or controlled by one master receiver?
Reply 2 years ago
125 channels and 6 slaves with each frequency. Do the math ;)
Question 3 years ago
If i use bigger antena with nrf 24lo1 is it effects my module ?
Question 3 years ago on Step 1
Can nrf24l01 with PCB antenna and nrf24l01 with external antenna make a pair.....
Because I am planning for RC in which I don't have enough space for external antenna...
But I want a better range...
I can use external antenna in the transmitter...
6 years ago
The basic of communication between 2arduino. it's very simple, watch my video to find out
Reply 3 years ago
can you add some subs?
Reply 6 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.^^
Question 4 years 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
Answer 4 years ago
write this instead:
while (radio.available())
{
radio.read(msg, 1);
5 years 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
"Show verbose output during compilation"
option enabled in File -> Preferences.
Reply 5 years ago
Hey there. I am facing the same problem. Any solution?
Reply 4 years 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.
Reply 4 years 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!
5 years ago
hi >> i need to know more how to read valuese recived wirelessly to arduino and display it on VB >> could you help please
5 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
5 years ago
This is awesome.
6 years ago
Tesekkurler hocam. Elinize saglik. -Kenan