Introduction: Arduino Using NRF24L01 Rf Module

Picture of 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

Picture of 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:

Picture of 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:

Picture of 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/

Comments

PhilY10 (author)2017-03-23

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.
Manolov4 (author)PhilY102017-08-03

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

Aliasmk (author)Manolov42017-08-19

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.

Aliasmk (author)Aliasmk2017-08-19

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!

Fadhela Khalaf (author)2016-11-03

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

remaa (author)2016-08-30

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

Ahmed Reda (author)2016-08-20

This is awesome.

bluegreen1211 (author)2016-03-16

Tesekkurler hocam. Elinize saglik. -Kenan

arrow faster (author)2016-03-15

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

Nguyễn VănK (author)2015-12-02

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

phannghia (author)Nguyễn VănK2016-02-23

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.^^

Dodutils (author)2015-10-14

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.

Science102 (author)2016-02-12

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.

Akshay Jha (author)2015-10-18

Great work sir

abinay777 (author)2015-10-13

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

abinay777 (author)2015-10-13

THANK YOU SIR FOR THE INSTRUCTABLES IT WAS REALLY HELPFUL,

SIR IF YOU DON'T MIND CAN YOU SHOW HOW TO CONTROL A 5V-9V DC MOTOR AND A SERVO MOTOR EACH WITH A TRIM POTENTIOMETER OR A PUSH BUTTON (ONE FOR THE DC MOTOR AND ANOTHER FOR THE SERVO MOTOR ) ALL WIRELESSLY USING JUST ONLY 2 ARDUINO UNO WITH EXPLANATION AND DIAGRAM

IT WILL BE REALLY REALLY REALLLY HELPFUL

About This Instructable

51,988views

135favorites

License:

Bio: Mechanical engineer, Entrepreneur, Maker, robotic systems expert and Robimek founder
More by sezgingul:Arduino Mini CNC Making Robot Hand With  Plastic PipesUse of Microphone Module
Add instructable to: