Skip to content

Commit df0384e

Browse files
authored
v2.1.1
1 parent ccf1119 commit df0384e

File tree

3 files changed

+127
-38
lines changed

3 files changed

+127
-38
lines changed

nRFBox_V2/blejammer.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ void IRAM_ATTR handleButtonPress() {
4848

4949
void configureRadio(RF24 &radio, byte channel) {
5050
radio.powerDown();
51-
delay(1000);
51+
delay(500);
5252
radio.powerUp();
5353
radio.setAutoAck(false);
54-
radio.setPALevel(RF24_PA_LOW);
55-
radio.setDataRate(RF24_250KBPS);
54+
radio.setPALevel(RF24_PA_HIGH);
55+
radio.setDataRate(RF24_2MBPS);
5656
radio.stopListening();
5757
radio.setChannel(channel);
5858
}
@@ -165,7 +165,9 @@ void blejammerSetup(){
165165
esp_bt_controller_deinit();
166166
esp_wifi_stop();
167167
esp_wifi_deinit();
168+
168169
u8g2.begin();
170+
169171
pinMode(MODE_BUTTON, INPUT_PULLUP);
170172
attachInterrupt(digitalPinToInterrupt(MODE_BUTTON), handleButtonPress, FALLING);
171173

nRFBox_V2/jammer.cpp

Lines changed: 93 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,50 @@
1111
#define BT3 26 // data rate
1212
#define BT4 25 // PA level
1313

14-
#define CE_PIN 5
15-
#define CSN_PIN 17
14+
15+
#define CE_A 5
16+
#define CSN_A 17
17+
18+
#define CE_B 16
19+
#define CSN_B 4
20+
21+
#define CE_C 15
22+
#define CSN_C 2
23+
24+
RF24 radioA(CE_A, CSN_A);
25+
RF24 radioB(CE_B, CSN_B);
26+
RF24 radioC(CE_C, CSN_C);
1627

1728
#define SCREEN_WIDTH 128
1829
#define SCREEN_HEIGHT 64
1930

20-
RF24 radio(CE_PIN, CSN_PIN);
2131

22-
const int num_channels = 64;
23-
int value[num_channels];
24-
int valuesDisplay[32];
25-
int channels = 1;
26-
const int num_reps = 50;
27-
bool jamming = false;
28-
const byte address[6] = "00001";
32+
const int num_channels = 64;
33+
int value[num_channels];
34+
int valuesDisplay[32];
35+
int channels = 1;
36+
const int num_reps = 50;
37+
bool jamming = false;
38+
const byte address[6] = "00001";
2939

3040
uint8_t dataRateIndex = 0; // Index for cycling through data rates
3141
uint8_t paLevelIndex = 0; // Index for cycling through PA levels
3242

3343
extern U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2;
3444

3545

36-
3746
void setRadioParameters() {
3847
switch (dataRateIndex) {
39-
case 0: radio.setDataRate(RF24_250KBPS); break;
40-
case 1: radio.setDataRate(RF24_1MBPS); break;
41-
case 2: radio.setDataRate(RF24_2MBPS); break;
48+
case 0: radioA.setDataRate(RF24_250KBPS); radioB.setDataRate(RF24_250KBPS); radioC.setDataRate(RF24_250KBPS); break;
49+
case 1: radioA.setDataRate(RF24_1MBPS); radioB.setDataRate(RF24_1MBPS); radioC.setDataRate(RF24_1MBPS); break;
50+
case 2: radioA.setDataRate(RF24_2MBPS); radioB.setDataRate(RF24_2MBPS); radioC.setDataRate(RF24_2MBPS);break;
4251
}
4352

4453
switch (paLevelIndex) {
45-
case 0: radio.setPALevel(RF24_PA_MIN); break;
46-
case 1: radio.setPALevel(RF24_PA_LOW); break;
47-
case 2: radio.setPALevel(RF24_PA_HIGH); break;
48-
case 3: radio.setPALevel(RF24_PA_MAX); break;
54+
case 0: radioA.setPALevel(RF24_PA_MIN); radioB.setPALevel(RF24_PA_MIN); radioC.setPALevel(RF24_PA_MIN); break;
55+
case 1: radioA.setPALevel(RF24_PA_LOW); radioB.setPALevel(RF24_PA_LOW); radioC.setPALevel(RF24_PA_LOW); break;
56+
case 2: radioA.setPALevel(RF24_PA_HIGH); radioB.setPALevel(RF24_PA_HIGH); radioC.setPALevel(RF24_PA_HIGH); break;
57+
case 3: radioA.setPALevel(RF24_PA_MAX); radioB.setPALevel(RF24_PA_MAX); radioC.setPALevel(RF24_PA_MAX); break;
4958
}
5059

5160
Serial.print("Data Rate: ");
@@ -55,31 +64,57 @@ void setRadioParameters() {
5564
}
5665

5766
void radioSetChannel(int channels) {
58-
radio.setChannel(channels);
67+
radioA.setChannel(channels);
68+
radioB.setChannel(channels);
69+
radioC.setChannel(channels);
5970
}
6071

6172
void jammer() {
62-
const char text[] = "xxxxxxxxxxxxxxxx";
73+
int methode = 1;
74+
75+
const char text[] = { 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55,
76+
0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55 };
77+
78+
if (methode = 0) {
6379
for (int i = ((channels * 5) + 1); i < ((channels * 5) + 23); i++) {
6480
radioSetChannel(i);
65-
bool result = radio.write(&text, sizeof(text));
66-
if (result) {
67-
Serial.println("Transmission successful");
68-
} else {
69-
Serial.println("Transmission failed");
70-
}
81+
bool resultA = radioA.write(&text, sizeof(text));
82+
bool resultB = radioB.write(&text, sizeof(text));
83+
bool resultC = radioC.write(&text, sizeof(text));
84+
7185
delay(10);
7286
}
87+
}
88+
89+
if (methode = 1) {
90+
for (int i = 0; i < 22; i++) { // Jam across 22 channels
91+
int channelA = ((channels * 5) + 1) + i;
92+
int channelB = ((channels * 5) + 1) + i + 1;
93+
int channelC = ((channels * 5) + 1) + i + 2;
94+
95+
// Set each radio to a different channel
96+
radioA.setChannel(channelA);
97+
radioB.setChannel(channelB);
98+
radioC.setChannel(channelC);
99+
100+
// Transmit payload on all three channels simultaneously
101+
radioA.write(&text, sizeof(text));
102+
radioB.write(&text, sizeof(text));
103+
radioC.write(&text, sizeof(text));
104+
105+
delay(10); // Delay before hopping to the next set of channels
106+
}
107+
}
73108
}
74109

75110
void pressBt01() {
76111
static unsigned long last_interrupt_time = 0;
77112
unsigned long interrupt_time = millis();
78113
if (interrupt_time - last_interrupt_time > 200) {
79-
if (channels < 13) {
114+
if (channels < 14) {
80115
channels++;
81116
} else {
82-
channels = 0;
117+
channels = 1;
83118
}
84119
Serial.print("Channel: ");
85120
Serial.println(channels);
@@ -119,6 +154,18 @@ void pressBt04() {
119154
last_interrupt_time = interrupt_time;
120155
}
121156

157+
void configure(RF24 &radio) {
158+
radio.begin();
159+
radio.openWritingPipe(0xFFFFFFFFFF);
160+
//radio.setAutoAck(false);
161+
radio.powerDown();
162+
delay(500);
163+
radio.powerUp();
164+
radio.setPALevel(RF24_PA_MIN);
165+
radio.setDataRate(RF24_250KBPS);
166+
radio.stopListening();
167+
}
168+
122169
void jammerSetup(){
123170
Serial.begin(115200);
124171

@@ -133,17 +180,28 @@ void jammerSetup(){
133180

134181
SPI.begin();
135182

136-
pinMode(CE_PIN, OUTPUT);
137-
pinMode(CSN_PIN, OUTPUT);
183+
pinMode(CE_A, OUTPUT);
184+
pinMode(CSN_A, OUTPUT);
185+
186+
pinMode(CE_B, OUTPUT);
187+
pinMode(CSN_B, OUTPUT);
188+
189+
pinMode(CE_C, OUTPUT);
190+
pinMode(CSN_C, OUTPUT);
138191

139192
u8g2.begin();
140193
u8g2.clearBuffer();
141194
u8g2.sendBuffer();
142195

143-
radio.begin();
196+
197+
configure(radioA);
198+
configure(radioB);
199+
configure(radioC);
200+
201+
//radio.begin();
144202
setRadioParameters();
145-
radio.openWritingPipe(address);
146-
radio.stopListening();
203+
//radio.openWritingPipe(address);
204+
//radio.stopListening();
147205

148206
Serial.println("Radio configured and ready");
149207
}
@@ -203,9 +261,9 @@ void jammerLoop(){
203261
delay(50);
204262

205263
if (jamming) {
206-
u8g2.setCursor(80, 60);
264+
u8g2.setCursor(80, 60);
207265
u8g2.print("Active ");
208-
Serial.println("Starting jamming on channel " + String(channels + 1));
266+
Serial.println("Starting jamming on channel " + String(channels));
209267
jammer();
210268
}
211269
}

nRFBox_V2/nRFBox_V2.ino

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@
1919
#include "spoofer.h"
2020
#include "sourapple.h"
2121

22+
23+
#define CE_PIN_A 5
24+
#define CSN_PIN_A 17
25+
26+
#define CE_PIN_B 16
27+
#define CSN_PIN_B 4
28+
29+
#define CE_PIN_C 15
30+
#define CSN_PIN_C 2
31+
32+
RF24 RadioA(CE_PIN_A, CSN_PIN_A);
33+
RF24 RadioB(CE_PIN_B, CSN_PIN_B);
34+
RF24 RadioC(CE_PIN_C, CSN_PIN_C);
35+
2236
//U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0); // [full framebuffer, size = 1024 bytes]
2337
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
2438

@@ -76,9 +90,24 @@ void about() {
7690
u8g2.sendBuffer();
7791
}
7892

93+
void configureNrf(RF24 &radio) {
94+
radio.begin();
95+
radio.powerDown();
96+
delay(500);
97+
radio.powerUp();
98+
//radio.setAutoAck(false);
99+
//radio.setPALevel(RF24_PA_HIGH);
100+
//radio.setDataRate(RF24_2MBPS);
101+
//radio.stopListening();
102+
}
103+
79104

80105
void setup() {
81106

107+
configureNrf(RadioA);
108+
configureNrf(RadioB);
109+
configureNrf(RadioC);
110+
82111
u8g2.begin();
83112
u8g2.setBitmapMode(1);
84113

0 commit comments

Comments
 (0)