Arnov Sharma
Published © GPL3+

Arduino Based NRF24 Transmitter-Receiver Setup

PCB Version of NRF24 Arduino Based Transmitter and Reciever

BeginnerFull instructions provided2 hours8,752

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×2
Nordic Semiconductor NRF24L01
×2
Resistor 10k ohm
Resistor 10k ohm
×3
Resistor 1k ohm
Resistor 1k ohm
×2
LED 0603
×2
Analog joystick (Generic)
×1
PTS 645 Series Switch
C&K Switches PTS 645 Series Switch
×5
JLCPCB Customized PCB
JLCPCB Customized PCB
×1
Arduino UNO
Arduino UNO
×1
UTSOURCE Electronic Parts
UTSOURCE Electronic Parts
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Custom parts and enclosures

TRANSMITTER

Gerber data

RECEIVER

Schematics

TRANSMITTER

RECEIVER

Code

RECIEVER Lv2

C/C++
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define led 2
RF24 radio(7, 8); // CE, CSN
const byte addresses[][6] = {"00001", "00002"};
boolean buttonState = 0;
void setup() {
  pinMode(2, OUTPUT);
  radio.begin();
  radio.openWritingPipe(addresses[1]); // 00002
  radio.openReadingPipe(1, addresses[0]); // 00001
  radio.setPALevel(RF24_PA_MIN);
}
void loop() {
  
  delay(5);
  radio.startListening();
  while (!radio.available());
  radio.read(&buttonState, sizeof(buttonState));
  if (buttonState == HIGH) {
    digitalWrite(led, HIGH);
  }
  else {
    digitalWrite(led, LOW);
  }
}

TRANSMITTER Lv2

C/C++
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

#define button 2
RF24 radio(7, 8); // CE, CSN
const byte addresses[][6] = {"00001", "00002"};

boolean buttonState = 0;
void setup() {
  pinMode(button, INPUT);

  radio.begin();
  radio.openWritingPipe(addresses[0]); // 00001
  radio.openReadingPipe(1, addresses[1]); // 00002
  radio.setPALevel(RF24_PA_MIN);
}
void loop() {
  
    delay(5);
    radio.stopListening();
    buttonState = digitalRead(button);
    radio.write(&buttonState, sizeof(buttonState));
  }

TRANSMITTER Lv1

C/C++
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>


RF24 radio(7, 8);  // CE, CSN


const byte address[6] = "00001";

void setup()
{
  radio.begin();
  

  radio.openWritingPipe(address);
  

  radio.stopListening();
}
void loop()
{
  
  const char text[] = "HOW YOU DOIN"; //message
  radio.write(&text, sizeof(text));
  
  delay(1000);
}

RECEIVER Lv1

C/C++
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>


RF24 radio(7, 8);  // CE, CSN


const byte address[6] = "00001";

void setup()
{
  while (!Serial);
    Serial.begin(9600);
  
  radio.begin();
  
  
  radio.openReadingPipe(0, address);
  
  
  radio.startListening();
}

void loop()
{
  
  if (radio.available())
  {
    char text[32] = {0};
    radio.read(&text, sizeof(text));
    Serial.println(text);
  }
}

Credits

Arnov Sharma

Arnov Sharma

310 projects • 307 followers
Just your average MAKER

Comments