Electro BOY
Published © GPL3+

NRF24L01 testing circuit using Arduino

A simple circuit with minimal components which allows you to test the Nrf24l01 modules, range and other parameters. Just for testing purpose

IntermediateFull instructions provided1 hour8,443
NRF24L01 testing circuit using Arduino

Things used in this project

Hardware components

SparkFun Transceiver Breakout - nRF24L01+
SparkFun Transceiver Breakout - nRF24L01+
×1
SparkFun Transceiver Breakout - nRF24L01+ (RP-SMA)
SparkFun Transceiver Breakout - nRF24L01+ (RP-SMA)
×1
Arduino Nano R3
Arduino Nano R3
×1

Software apps and online services

EasyEDA
JLCPCB EasyEDA
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Servo Motor, Premium Male/Male Jumper Wires
Servo Motor, Premium Male/Male Jumper Wires

Story

Read more

Custom parts and enclosures

Gerber files

Schematics

Transmitter circuit

Receiver circuit

Code

Transmitter code

Arduino
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

#define buttonPin1 3

int buttonState1 = 0;
RF24 radio(9, 8); // CE, CSN

const byte address[6] = "00002";

void setup() {
  pinMode(buttonPin1, INPUT_PULLUP);
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
}
void loop() {
  buttonState1 = digitalRead(buttonPin1);

  if (buttonState1 == 1)
  {
    buttonState1 = 1;
  }
  else  if (buttonState1 == 0)
  {
    buttonState1 = 0;
  }

  Serial.print(buttonState1);
  radio.write(&buttonState1, sizeof(buttonState1));
}

Receiver code

Arduino
https://mytectutor.com/how-the-nrf24l01-wireless-transceiver-module-works-with-arduino/

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

#define led1 3


int buttonState = 0;

RF24 radio(9, 8); // CE, CSN
const byte address[6] = "00002";

void setup() {
  Serial.begin(9600);
  pinMode(led1, OUTPUT);
  digitalWrite(led1, HIGH); 
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  delay(100);
}
void loop() {
  radio.startListening();
  while (!radio.available());
  radio.read(&buttonState, sizeof(buttonState));
  Serial.println(buttonState);
  delay (100);

  if (buttonState == 1) {
    digitalWrite(led1, LOW);
  }
  else  if (buttonState == 0) {
    digitalWrite(led1, HIGH);
  }
}

Credits

Electro BOY

Electro BOY

57 projects • 53 followers
Electronics is my passion. I am not professional, Always learning something new. I am good at soldering, designing pcb, Arduino programing.

Comments