Defeat nRF24L01 in three steps
A simple method for connecting nRF24L01 radio modules over the air is proposed.
Devices & Components
Arduino Uno Rev3
Capacitor 10 µF
Solderless Breadboard Half Size
Multilayer Ceramic Capacitor, 4.7 µF
Jumper wires (generic)
16 MHz Crystal
nRF24L01+
ATmega 328P
AA Batteries
Hardware & Tools
Soldering iron (generic)
Solder Flux, Rosin
Mini Side Cutter, 120mm Length with 25mm Jaw Capacity
Solder Wire, Lead Free
Software & Tools
Arduino IDE
Project description
Code
radio scanner
arduino
ether scanner sketch for Arduino UNO board
1/* 2radio scanner 3*/ 4 5#include <SPI.h> 6#include "nRF24L01.h" 7#include "RF24.h" 8#include "printf.h" 9 10// 11// Hardware configuration 12// 13 14// Set up nRF24L01 radio on SPI bus plus pins 9 & 10 15 16RF24 radio(9, 10); //Arduino UNO 17 18// 19// Channel info 20// 21 22const uint8_t num_channels = 128; 23uint8_t values[num_channels]; 24 25// 26// Setup 27// 28 29void setup(void) 30{ 31 // 32 // Print preamble 33 // 34 35 Serial.begin(9600); 36 Serial.println("Scanner Air On"); 37 printf_begin(); 38 39 // 40 // Setup and configure rf radio 41 // 42 43 radio.begin(); 44 radio.setAutoAck(false); 45 46 // Get into standby mode 47 radio.startListening(); 48 radio.printDetails(); 49 delay(5000); 50 51 // Print out header, high then low digit 52 int i = 0; 53 while ( i < num_channels ) 54 { 55 printf("%x", i >> 4); 56 ++i; 57 } 58 printf("\ 59\ "); 60 i = 0; 61 while ( i < num_channels ) 62 { 63 printf("%x", i & 0xf); 64 ++i; 65 } 66 printf("\ 67\ "); 68} 69 70// 71// Loop 72// 73 74const int num_reps = 100; 75 76void loop(void) 77{ 78 // Clear measurement values 79 memset(values, 0, sizeof(values)); 80 81 // Scan all channels num_reps times 82 int rep_counter = num_reps; 83 while (rep_counter--) 84 { 85 int i = num_channels; 86 while (i--) 87 { 88 // Select this channel 89 radio.setChannel(i); 90 91 // Listen for a little 92 radio.startListening(); 93 delayMicroseconds(512); 94 radio.stopListening(); 95 96 // Did we get a carrier? 97 if ( radio.testCarrier() ) 98 ++values[i]; 99 } 100 } 101 102 // Print out channel measurements, clamped to a single hex digit 103 int i = 0; 104 while ( i < num_channels ) 105 { 106 printf("%x", min(0xf, values[i] & 0xf)); 107 ++i; 108 } 109 printf("\ 110\ "); 111}
transmitter
arduino
nRF24L01 transmitter sketch
1/* 2transmitter 3Defeat nRF24L01 in three steps 4*/ 5 6#include <SPI.h> 7#include <RF24.h> 8RF24 radio(9, 10); 9const uint32_t pipe = 111156789; 10 11byte data; 12 13void setup() { 14 Serial.begin(115200); 15 Serial.println("TransmitterTester ON"); 16 17 radio.begin(); 18 delay(2000); 19 radio.setDataRate(RF24_1MBPS); 20 radio.setCRCLength(RF24_CRC_8); 21 radio.setChannel(0x6f); 22 radio.setAutoAck(false); 23 radio.powerUp(); 24 radio.stopListening(); // do not listen to the radio, only transmission 25 radio.openWritingPipe(pipe); // open pipe for sending 26} 27 28void loop() { 29 data = 109; 30 radio.write(&data, 1); 31 Serial.println("data= " + String(data)); 32}
radio scanner
arduino
ether scanner sketch for Arduino UNO board
1/* 2radio scanner 3Defeat nRF24L01 in three steps 4*/ 5 6#include <SPI.h> 7#include "nRF24L01.h" 8#include "RF24.h" 9#include "printf.h" 10 11// 12// Hardware configuration 13// 14 15// Set up nRF24L01 radio on SPI bus plus pins 9 & 10 16 17RF24 radio(9, 10); //Arduino UNO 18 19// 20// Channel info 21// 22 23const uint8_t num_channels = 128; 24uint8_t values[num_channels]; 25 26// 27// Setup 28// 29 30void setup(void) 31{ 32 // 33 // Print preamble 34 // 35 36 Serial.begin(9600); 37 Serial.println("Scanner Air On"); 38 printf_begin(); 39 40 // 41 // Setup and configure rf radio 42 // 43 44 radio.begin(); 45 radio.setAutoAck(false); 46 47 // Get into standby mode 48 radio.startListening(); 49 radio.printDetails(); 50 delay(5000); 51 52 // Print out header, high then low digit 53 int i = 0; 54 while ( i < num_channels ) 55 { 56 printf("%x", i >> 4); 57 ++i; 58 } 59 printf("\ 60\ "); 61 i = 0; 62 while ( i < num_channels ) 63 { 64 printf("%x", i & 0xf); 65 ++i; 66 } 67 printf("\ 68\ "); 69} 70 71// 72// Loop 73// 74 75const int num_reps = 100; 76 77void loop(void) 78{ 79 // Clear measurement values 80 memset(values, 0, sizeof(values)); 81 82 // Scan all channels num_reps times 83 int rep_counter = num_reps; 84 while (rep_counter--) 85 { 86 int i = num_channels; 87 while (i--) 88 { 89 // Select this channel 90 radio.setChannel(i); 91 92 // Listen for a little 93 radio.startListening(); 94 delayMicroseconds(512); 95 radio.stopListening(); 96 97 // Did we get a carrier? 98 if ( radio.testCarrier() ) 99 ++values[i]; 100 } 101 } 102 103 // Print out channel measurements, clamped to a single hex digit 104 int i = 0; 105 while ( i < num_channels ) 106 { 107 printf("%x", min(0xf, values[i] & 0xf)); 108 ++i; 109 } 110 printf("\ 111\ "); 112}
receiver
arduino
nRF24L01 receiver sketch
1/* 2receiver 3Defeat nRF24L01 in three steps 4*/ 5 6#include <SPI.h> 7#include "nRF24L01.h" 8#include "RF24.h" 9 10RF24 radio(9, 10); 11 12const uint32_t pipe = 111156789; 13byte data[1]; 14int scn; // counter of broadcast listening cycles 15int sg; // counter of the number of received packets from the transmitter 16 17void setup() { 18 Serial.begin(9600); 19 Serial.println("ReceiverTester ON"); 20 21 radio.begin(); 22 delay(2000); 23 radio.setDataRate(RF24_1MBPS); 24 radio.setCRCLength(RF24_CRC_8); 25 radio.setChannel(0x6f); // set the channel 26 radio.setAutoAck(false); 27 radio.openReadingPipe(1, pipe); // open the pipe for receiving 28 radio.startListening(); // receive 29} 30 31void loop() { 32 if (scn < 1000) 33 { // listening to the air 34 if (radio.available()) 35 { 36 radio.read(data, 1); 37 38 if (data[0] == 109) { 39 sg++; 40 } 41 } 42 } else {//total received 43 { 44 Serial.println("Received " + String(sg) + " packages"); 45 sg = 0; 46 } 47 scn = 0; 48 } 49 scn++; 50 delay(20); 51 52 if (scn >= 1000) scn = 1000; //counter overflow protection 53}
transmitter
arduino
nRF24L01 transmitter sketch
1/* 2transmitter 3Defeat nRF24L01 in three steps 4*/ 5 6#include 7 <SPI.h> 8#include <RF24.h> 9RF24 radio(9, 10); 10const uint32_t pipe = 111156789; 11 12 13byte data; 14 15void setup() { 16 Serial.begin(115200); 17 Serial.println("TransmitterTester 18 ON"); 19 20 radio.begin(); 21 delay(2000); 22 radio.setDataRate(RF24_1MBPS); 23 24 radio.setCRCLength(RF24_CRC_8); 25 radio.setChannel(0x6f); 26 27 radio.setAutoAck(false); 28 radio.powerUp(); 29 radio.stopListening(); 30 // do not listen to the radio, only transmission 31 radio.openWritingPipe(pipe); 32 // open pipe for sending 33} 34 35void loop() { 36 data = 109; 37 radio.write(&data, 38 1); 39 Serial.println("data= " + String(data)); 40}
Downloadable files
Scanner Receiver
Scanner Receiver

Transmitter
Transmitter

Transmitter
Transmitter

Scanner Receiver
Scanner Receiver

Comments
Only logged in users can leave comments