NRF24L01 Wireless Transceiver Module



Arduino Tutorial 27 : NRF24L01 Wireless Transceiver Module

In this tutorial we will learn how to use the nRF24L01 Wireless Transceiver Module.
We will control the servo motor with using the potentiometer via nRF24L01 Wireless Transceiver Module.

---

Hardware Required:

Arduino Board - https://goo.gl/Rqc5w2
nRF24L01 Adapter - https://goo.gl/UWQtWy
Potentiometer - https://goo.gl/MPwcEM
Servo Motor - https://goo.gl/iywd5p
F to F Jumper - https://goo.gl/TdGrkk
M to M Jumper - https://goo.gl/VRzUN4
9V Battery Plug - https://goo.gl/aBKusM
9V Battery - https://goo.gl/3EIJcf
Breadboard - https://goo.gl/08nnr1

Recomended Site - https://goo.gl/V9nYtx

---

RF24 Library - https://goo.gl/z8uy2d

Circuit Program - https://goo.gl/PDBwqe

---

Get the Code:
/*
---- Transmitter Code ----
Mert Arduino Tutorial & Projects (YouTube)
Please Subscribe for Support
*/

#include <SPI.h>                      //the communication interface with the modem
#include "RF24.h"                     //the library which helps us to control the radio modem

int msg[1];

RF24 radio(5,10);                     //5 and 10 are a digital pin numbers to which signals CE and CSN are connected.
                                      
const uint64_t pipe = 0xE8E8F0F0E1LL; //the address of the modem, that will receive data from Arduino.


void setup(void){
  radio.begin();                      //it activates the modem.
  radio.openWritingPipe(pipe);        //sets the address of the receiver to which the program will send data.
}

void loop(void){
  msg[0] =  map (analogRead(0), 0, 1023, 0, 179); 
  radio.write(msg, 1);
}

/*
---- Receiver Code ----
Mert Arduino Tutorial & Projects (YouTube)
Please Subscribe for Support
*/

#include <Servo.h>    //the library which helps us to control the servo motor
#include <SPI.h>      //the communication interface with the modem
#include "RF24.h"     //the library which helps us to control the radio modem

Servo myServo;        //define the servo name

RF24 radio(5,10);     /*This object represents a modem connected to the Arduino. 
                      Arguments 5 and 10 are a digital pin numbers to which signals 
                      CE and CSN are connected.*/

const uint64_t pipe = 0xE8E8F0F0E1LL; //the address of the modem,that will receive data from the Arduino.

int msg[1];

void setup(){
  myServo.attach(3);                //3 is a digital pin to which servo signal connected.
  radio.begin();                    //it activates the modem.
  radio.openReadingPipe(1, pipe);   //determines the address of our modem which receive data.
  radio.startListening();           //enable receiving data via modem
  }

void loop(){
  if(radio.available()){            //checks whether any data have arrived at the address of the modem
    bool done = false;              //returns a “true” value if we received some data, or “false” if no data.
    while (!done) {
      done = radio.read(msg, 1);
      myServo.write(msg[0]);
    }
  }
}