I want to extend nrf24 range with antenna to 1km or above. Please help me

/*
14CORE NRF24L01 MASTER CONTROLLER/TRANSMITTER
*/
#include <SPI.h> //Include SPI Code Library which can be downloaded below
#include "nRF24L01.h" //Include NRF24L01 Code Library which can be downloaded below
#include "RF24.h" //Inlcude NRF24 Code Library which can be downloaded below

int msg[0];
RF24 radio(9,10); // The NRF24L01 Pin CE and Pin CSN
const uint64_t pipe = 0xE8E8F0F0E1LL; //Communication Pip Address
int switchButton1 = 7; // Push button connected to Arduino pin 7
int switchButton2 = 8;
int switchButton3 = 3;
void setup(void){
Serial.begin(9600); //Start Serial Communication at baud rate 9600
radio.begin();
radio.openWritingPipe(pipe);} //Open Communication Pipe

void loop(void){
if (digitalRead(switchButton1) == LOW){ // When the push button has been press it will send radio signal to the RX to turn the LED into HIGH
msg[0] = 1;
radio.write(msg, 1);

}
if (digitalRead(switchButton2) == LOW){ // When the push button has been press it will send radio signal to the RX to turn the LED into HIGH
msg[0] = 2;
radio.write(msg, 1);

}
if (digitalRead(switchButton3) == LOW){ // When the push button has been press it will send radio signal to the RX to turn the LED into HIGH
msg[0] = 3;
radio.write(msg, 1);

}}

/*
14CORE NRF24L01 SLAVE/RECIEVER
*/

#include <SPI.h> //Include SPI Code Library which can be downloaded below
#include "nRF24L01.h" //Include NRF24L01 Code Library which can be downloaded below
#include "RF24.h" //Inlcude NRF24 Code Library which can be downloaded below

int msg[1];
RF24 radio(9,10); // NRF24L01 Pin
const uint64_t pipe = 0xE8E8F0F0E1LL; //Start Pipe Communication Address

#define Indicator1 A0
#define Indicator2 A1
#define Indicator3 A2//This the LED which is connected to Arduino Pin 3
void setup(void){
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(1,pipe);
radio.startListening();
pinMode(Indicator1, OUTPUT);
pinMode(Indicator2, OUTPUT);
pinMode(Indicator3, OUTPUT);}

void loop(void)
{
if (radio.available())
{ bool done = false;
while (!done)
{ done = radio.read(msg, 1);
Serial.println(msg[0]);
if (msg[0] == 1){digitalWrite(Indicator1, LOW);}
else {digitalWrite(Indicator1,HIGH);}
if (msg[0] == 2){digitalWrite(Indicator2, LOW);}
else {digitalWrite(Indicator2,HIGH);}
if (msg[0] == 3){digitalWrite(Indicator3, LOW);}
else {digitalWrite(Indicator3,HIGH);}
}}
else digitalWrite(Indicator1,HIGH); digitalWrite(Indicator2,HIGH); digitalWrite(Indicator3,HIGH);
Serial.println("No Radio Transmission");
}

Your post was MOVED to its current location as it is more suitable.

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

I want to extend nrf24 range to 1km or above.

So you want to go up to what distance ?

And what is the actual project and describe the location and environment of RX and TX ?

If you want long distances, then there are much better choices of radio module than the NRF24 ................

sorry for that. this is my first time post. so...

Are you using the NRF24 + PA + LNA or the one with the PCB antenna?

I want to sent the data between two nrf24 with range 1km or above. the location is open field. I have antnna version nrf24, I don't know how to use the low frequency.

with antenna bro. It is disconnected only 15m. I don't know how to use low frequency and how to code. I am just begineer. pls help me.

I belive if you set the radio.setPALevel(RF24_PA_MAX); and maybe radio.setDataRate(RF24_250KBPS); it will reach longer.

bro. can U fix this in my code above? pls help me.

What is your programs purpose? Does it have a button? What are the schematics? Do you have a different code for the reciver/transmitter? A really good thing Ive learned with my time using arduino is that you should not rush things and make them good and understand them from bottom to top. Make a schematic, if it takes a day drawing do it so you understand it. Then you Start building the program to its purpose based on you schematic and plan.

1 Like

yes bro. My hardware has three buttons. I want to control three relay ON and OFF, form about 1km or above.

NRF24l01-Remote-Switching-Arduino-Board-Relay-Receiver
NRF24l01-Remote-Switching-Arduino-Board-Relay-Transmitter

These two pictures are examples. I want to modify to control three relay form more range. Now it can only control about 25m.

add the two lines in the setup() that I posted earlier, setdatarate and palevel. By default the palevel (power amplifier) is low

ok bro. I'll try it. Thank you so much bro.

If your using the NRF24 modules with the power amplifier and SMA antenna socket, be aware that in a lot of places in the World you may be limited to a maximum power output of 10mW.

Which means dont use the RF24_PA_MAX setting as that can send out circa 150mW. On some versions of RF24 this can be close to the power output you get even when RF24_PA_MIN is used.

There are plenty of other radio modules, especially for use in the 434Mhz, 868Mhz or 915Mhz bands which will cover the 1km without the need to use high levels of RF power.

If you want to span 1 km, you use an antenna. :roll_eyes:

LoRa unit would be a better choice for long range.

I would agree, but there are other modules apart from LoRa ones that would provide the 1km range in the 434Mhz, 868Mhz or 915Mhz bands.

Starting with a premise that I want\need more than 1km from only an NRF24 is the wrong place to start in my opinion.