Wireless Remote Using 2.4 Ghz NRF24L01 : Simple Tutorial Using of NRF24L01 & Arduino

446,834

346

128

Introduction: Wireless Remote Using 2.4 Ghz NRF24L01 : Simple Tutorial Using of NRF24L01 & Arduino

About: Hello I am Tech Creator Akshay I love electronics and get in touch for more projects

Hello Everyone this is my second instructable . After lots of surfing on GOOGLE when I wont able to find a easy and a simple tutorial for NRF24L01 transceiver then I decided to publish an instructable on this. This is a simple short and easy tutorial for NRF24L01 Radio 2.4GHz Transmitter Receiver. In this tutorial I am going to control led using a pair of NRF24L01 transceiver.

Step 1: Small Introduction About NRF 24L01 Transceiver

The nRF24L01 is a highly integrated, ultra low power (ULP) 2Mbps RF transceiver IC for the 2.4GHz ISM (Industrial, Scientific and Medical) band. With peak RX/TX currents lower than 14mA, a sub μA power down mode, advanced power management, and a 1.9 to 3.6V supply range, the nRF24L01 provides a true ULP solution enabling months to years of battery lifetime when running on coin cells or AA/AAA batteries .

Step 2: Material Require

  1. 2 PCS NRF24L01+2.4 GHz Wireless Transceiver module
  2. 2 Arduino any (I have used one arduino R3 & nano)
  3. Male to. femal jumpers
  4. LED
  5. Any Switch
  6. 10K resistor

Step 3: Connections

  • Connect the following pins to your Arduino:as shown in figure
  • Pin 9 - CE
  • Pin 10 - CS(N)
  • Pin 11 - MOSI
  • Pin 12 - MISO
  • Pin 13 - SCK
  • 3.3v - VCC
  • GND - GND
  • On the Receiver Pin 3 - LED
  • On the Transmitter Pin 7 - Button
  • same connection for receiver and transmitter and you can use any arduino board

Step 4: Coding Arduino

For coding arduino first we need some library files so follow the steps given below :

1. Download the ZIP file (library file zip folder from attachments ).

3. Unpack the ZIP file.

4. Go to arduino library folder

5. And paste both the folders named " nFR24L01" and "RF24" into it.

Now, program the Arduino receiver and transmitter

Code for Receiver

<p>#include <SPI.h><br>#include "nRF24L01.h"
#include "RF24.h"
int msg[1];
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;
int LED1 = 3;</p><p>void setup(void){
 Serial.begin(9600);
 radio.begin();
 radio.openReadingPipe(1,pipe);
 radio.startListening();
 pinMode(LED1, OUTPUT);}</p><p>void loop(void){
 if (radio.available()){
   bool done = false;    
   while (!done){
     done = radio.read(msg, 1);      
     Serial.println(msg[0]);
     if (msg[0] == 111){delay(10);digitalWrite(LED1, HIGH);}
     else {digitalWrite(LED1, LOW);}
     delay(10);}}
 else{Serial.println("No radio available");}}</p>

Code for Transmitter

<p>#include  <SPI.h><br>#include "nRF24L01.h"
#include "RF24.h"
int msg[1];
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;
int SW1 = 7;</p><p>void setup(void){
 Serial.begin(9600);
 radio.begin();
 radio.openWritingPipe(pipe);}</p><p>void loop(void){
 if (digitalRead(SW1) == HIGH){
 msg[0] = 111;
 radio.write(msg, 1);}}</p>

Step 5: Testing

This is a last step after completing the circuit and coding part we can easily test it by switching "ON" and "OFF". .

When switch is "ON" on transmitter side connected to pin 7 of arduino then led glows on receivers side connected to pin 3 of arduino .Video Shows the output of this project.

THANKS HOPE THIS WILL HELP YOU

5 People Made This Project!

Recommendations

  • Game Design: Student Design Challenge

    Game Design: Student Design Challenge
  • Make It Bridge

    Make It Bridge
  • Big and Small Contest

    Big and Small Contest

128 Comments

0
freshymc20
freshymc20

Question 2 years ago

Hello sir, can I use this module to transmit live video from robot camera and program it to control my robot go forward, backward, left, right?

0
carolmassinha
carolmassinha

4 years ago

Thankyou!

Funcionou ajustando alguns caracteres do código e, no meu caso, precisei ajustar uma linha da biblioteca (anexo imagem):

Code Receiver:

#include

#include "nRF24L01.h"

#include "RF24.h"

int msg[1];

RF24 radio(9, 10);

const uint64_t pipe = 0xE8E8F0F0E1LL;

int LED1 = 3;

void setup(void) {

Serial.begin(38400);

radio.begin();

radio.openReadingPipe(1, pipe);

radio.startListening();

pinMode(LED1, OUTPUT);

}

void loop(void) {

if (radio.available()) {

bool done = false;

while (!done) {

done = radio.read(msg, 1);

Serial.println(msg[0]);

if (msg[0] == 111) {

delay(10);

digitalWrite(LED1, HIGH);

}

else {

digitalWrite(LED1, LOW);

}

delay(10);

}

}

else

{

Serial.println("No radio available");

}

}

Code transmissor:

#include

#include "nRF24L01.h"

#include "RF24.h"

int msg[1];

RF24 radio(9, 10);

const uint64_t pipe = 0xE8E8F0F0E1LL;

int SW1 = 7;

void setup(void) {

Serial.begin(38400);

radio.begin();

radio.openWritingPipe(pipe);

}

void loop(void) {

if (digitalRead(SW1) == HIGH) {

msg[0] = 111;

radio.write(msg, 1);

// intuo que do modo que ajustei-copiei acima, deixa a variável mais variável.

}

}

Captura de Tela 2018-10-16 &agrave;s 01.37.09.png
0
SumanP13
SumanP13

4 years ago

Wonderful code and attachment. solved my 3 month spending in less minutes. Keep it up. Everyone please use the attached libraries.

0
Deimelp
Deimelp

5 years ago

Hi! Can I use the

NRF24L01 without an Arduino?

I want to send instructions and the

NRF24L01

Do what I want

to make a smart house. if not which one can I use. Sorry

for my English

1
DennisB36
DennisB36

Question 5 years ago

I'm having problems compiling your sketch. I'm getting:

error: void value not ignored as it ought to be

done = radio.read(msg, 1);

^

I've followed your code exactly as you have it with the exception of the CE, CS pins are 7 and 8. and are noted so in my sketch.

Any thoughts?

0
YvesG10
YvesG10

Answer 5 years ago

Although I do not have the code downloaded, I would think that if you look in the .h file where radio.read is defined, it is defined with void. That means that it does not return anything. Therefore you cannot assign the return value to the boolean variable done.

0
htvdanh
htvdanh

5 years ago

I followed but the result didn't work. I tried below link (with the source code + library) and it works:

https://brainy-bits.com/blogs/tutorials/how-to-use-the-nrf24l01-2-4ghz-wireless-module

0
AlfM4
AlfM4

Reply 5 years ago

yes, same for me. the example from brainy-bits works. the code here only makes some compiler errors.

0
PavanB16
PavanB16

Question 5 years ago on Introduction

Can I use this to transmit numbers and display it on LCD module ?

0
Matrix6322
Matrix6322

5 years ago

i'm already using pin 9 an 10 other action, can I use also pin 3 and 5, changing their divisors, to make them work faster, as default pin 9/10?

1
GregR89
GregR89

5 years ago

When i try to upload the code i get stray # in program error help?

0
TeodorH3
TeodorH3

5 years ago

or can i use esp 01 ?

0
TeodorH3
TeodorH3

5 years ago

Can it be used to receive signals from remote which uses 2.4GCOB-1A transmitter and after that transmit the signal to rc car/quadcopter ?

remote is SM-217-BKT (Syma quadcopter)

0
SangD3
SangD3

5 years ago

How to apply transfer audio from smartphone to speaker by this way? Coul you help me?

0
ChiaraL2
ChiaraL2

6 years ago

Even if I follow each step exactly, I get "No Radio Available"... I'm using an Arduino Uno as transmiter e an Arduino Mega as Receiver in order to switch on and off a led by a switch button. I've controlled again and again connections and it seems to be everything right. Which could be the problem?

0
RicardoG167
RicardoG167

Reply 5 years ago

I'm facing the same problem too

0
iTechnoLabz
iTechnoLabz

Reply 5 years ago

I got the issue solved by connecting VCC of nrf2401 to 5V

0
NickC245
NickC245

Reply 5 years ago

Did you found a solution? Unfortunately I'm facing the same problem