user2199899
Published © GPL3+

Defeat nRF24L01 in three steps

A simple method for connecting nRF24L01 radio modules over the air is proposed.

IntermediateFull instructions provided2,089
Defeat nRF24L01 in three steps

Things used in this project

Hardware components

SparkFun nRF24L01+
×1
Arduino UNO
Arduino UNO
×1
Arduino ATmega 328P
×2
16 MHz Crystal
16 MHz Crystal
×2
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
Jumper wires (generic)
Jumper wires (generic)
×1
AA Batteries
AA Batteries
×1
Multilayer Ceramic Capacitor, 4.7 µF
Multilayer Ceramic Capacitor, 4.7 µF
×2
Capacitor 10 µF
Capacitor 10 µF
×2

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Mini Side Cutter, 120mm Length with 25mm Jaw Capacity
Mini Side Cutter, 120mm Length with 25mm Jaw Capacity
Solder Wire, Lead Free
Solder Wire, Lead Free
Solder Flux, Rosin
Solder Flux, Rosin

Story

Read more

Schematics

Scanner Receiver

Transmitter

Code

radio scanner

Arduino
ether scanner sketch for Arduino UNO board
/*
radio scanner
Defeat nRF24L01 in three steps
*/

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

//
// Hardware configuration
//

// Set up nRF24L01 radio on SPI bus plus pins 9 & 10

RF24 radio(9, 10); //Arduino UNO

//
// Channel info
//

const uint8_t num_channels = 128;
uint8_t values[num_channels];

//
// Setup
//

void setup(void)
{
  //
  // Print preamble
  //

  Serial.begin(9600);
  Serial.println("Scanner Air On");
  printf_begin();

  //
  // Setup and configure rf radio
  //

  radio.begin();
  radio.setAutoAck(false);

  // Get into standby mode
  radio.startListening();
  radio.printDetails();  
  delay(5000);              

  // Print out header, high then low digit
  int i = 0;
  while ( i < num_channels )
  {
    printf("%x", i >> 4);
    ++i;
  }
  printf("\n\r");
  i = 0;
  while ( i < num_channels )
  {
    printf("%x", i & 0xf);
    ++i;
  }
  printf("\n\r");
}

//
// Loop
//

const int num_reps = 100;

void loop(void)
{
  // Clear measurement values
  memset(values, 0, sizeof(values));

  // Scan all channels num_reps times
  int rep_counter = num_reps;
  while (rep_counter--)
  {
    int i = num_channels;
    while (i--)
    {
      // Select this channel
      radio.setChannel(i);

      // Listen for a little
      radio.startListening();
      delayMicroseconds(512);
      radio.stopListening();

      // Did we get a carrier?
      if ( radio.testCarrier() )
        ++values[i];
    }
  }

  // Print out channel measurements, clamped to a single hex digit
  int i = 0;
  while ( i < num_channels )
  {
    printf("%x", min(0xf, values[i] & 0xf));
    ++i;
  }
  printf("\n\r");
}

transmitter

Arduino
nRF24L01 transmitter sketch
/*
transmitter
Defeat nRF24L01 in three steps
*/

#include <SPI.h>
#include <RF24.h>
RF24 radio(9, 10); 
const uint32_t pipe = 111156789; 

byte data;

void setup() {
  Serial.begin(115200);
  Serial.println("TransmitterTester ON");

  radio.begin();               
  delay(2000);
  radio.setDataRate(RF24_1MBPS); 
  radio.setCRCLength(RF24_CRC_8); 
  radio.setChannel(0x6f);         
  radio.setAutoAck(false);       
  radio.powerUp();               
  radio.stopListening();  // do not listen to the radio, only transmission
  radio.openWritingPipe(pipe);   // open pipe for sending
}

void loop() {
  data = 109;
  radio.write(&data, 1);
  Serial.println("data= " + String(data));
}

receiver

Arduino
nRF24L01 receiver sketch
/*
receiver
Defeat nRF24L01 in three steps
*/

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

RF24 radio(9, 10); 

const uint32_t pipe = 111156789; 
byte data[1];
int scn;  // counter of broadcast listening cycles
int sg;  // counter of the number of received packets from the transmitter

void setup() {
  Serial.begin(9600);
  Serial.println("ReceiverTester ON");

  radio.begin();  
  delay(2000);
  radio.setDataRate(RF24_1MBPS); 
  radio.setCRCLength(RF24_CRC_8); 
  radio.setChannel(0x6f);         // set the channel
  radio.setAutoAck(false);       
  radio.openReadingPipe(1, pipe); // open the pipe for receiving
  radio.startListening();        // receive
}

void loop() {
  if (scn < 1000)
  { // listening to the air
    if (radio.available())
    {
      radio.read(data, 1);

      if (data[0] == 109) {
        sg++;
      }
    }
  } else {//total received
    {
      Serial.println("Received " + String(sg) + " packages");
      sg = 0;
    }
    scn = 0;
  }
  scn++;
  delay(20);

  if (scn >= 1000) scn = 1000; //counter overflow protection
}

Credits

user2199899

user2199899

0 projects • 3 followers

Comments