Arduino Uno, RF24 Antenna, won't work
Hi everyone,
I've started working on an Arduino project, but I can't get it to work.
I have two working Arduino Uno boards, and I've connected an RF24 antenna to each one. The goal is to send a short message from one board to another over a distance of a few dozen metres, without Bluetooth, Wi-Fi or wires. Unfortunately, I can't get it to work. Chat GPT even gave me some test communication code, but it didn't work. I don't think it's a hardware issue, as I've checked everything. I'd appreciate any thoughts that could help me solve this problem.
Thank you in advance for your replies.
Here are the transmitter and receiver codes and the corresponding logs:
Transmitter :
#include <SPI.h>
#include <RF24.h>
RF24 radio(9,10);
const byte addr[6] = "00001";
bool token = true;
void setup() {
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(addr);
radio.stopListening();
// Paramètres à ajuster manuellement si besoin :
radio.setChannel(108); // change par ex. 76, 100, 108
radio.setDataRate(RF24_1MBPS); // essayer 250kbps pour portée max
radio.setPALevel(RF24_PA_LOW); // essayer PA_MAX, PA_HIGH, PA_LOW
Serial.println("TX DEBUG ready");
}
void loop() {
Serial.print("TX ch=");
Serial.print(radio.getChannel());
Serial.print(" dr=250kbps palvl=");
Serial.print((int)radio.getPALevel());
Serial.println();
bool ok = radio.write(&token, sizeof(token));
Serial.print("write returned = ");
Serial.println(ok ? "ACK" : "NO_ACK");
delay(15000);
}
Logs:
TX DEBUG ready
TX ch=108 dr=250kbps palvl=1
write returned = NO_ACK
TX ch=108 dr=250kbps palvl=1
write returned = NO_ACK
6 Replies
Receiver :
#include <SPI.h>
#include <RF24.h>
RF24 radio(9,10);
const byte addr[6] = "00001";
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, addr);
radio.startListening();
Serial.println("RX DEBUG ready");
}
void loop() {
Serial.print("ch=");
Serial.print(radio.getChannel());
Serial.print(" | RPD=");
Serial.print(radio.testRPD());
Serial.print(" | avail=");
Serial.println(radio.available());
delay(15000);
}
Log :
RX DEBUG ready
ch=76 | RPD=0 | avail=0
Arduino card :
https://fr.aliexpress.com/item/1005006053120735.html?spm=a2g0o.order_list.order_list_main.23.5d0d5e5bXZusey&gatewayAdapt=glo2fra
Antenna
Gokelomg Lot de 2 émetteurs-récepteurs NRF24L01+PA+LNA avec anten...
Gokelomg Caractéristiques :
Gain PA : 20 dB.
Gain LNA : 10 dB.
Fréquence : 2,4 GHz ~ 2,5 GHz
Portée : plus de 800 mètres de ligne de vision.
Fréquence multifonction : 125 fréquence.
Courant de fonctionnement (maximum) : 115 mA.
Courant de fonctionnement reçu (max) : 45 mA.
Tension de fonc...
"Chat GPT even gave me some test communication code"
We are not allowed to help with code generated by chat gpt.I am able to understand every lign of Arduino, I had written a programme myself, but since it wasn't working, I asked ChatGPT to write me a simple test code to make sure that the error wasn't due to my coding skills. By the way, this code didn't come directly from ChatGPT, I modified it afterwards to change the methods and parameters in order to better understand my problem. So I really don't see why it would be difficult to help me in this situation.
And I forgot to mention that I really want to learn and improve my Arduino skills in order to take on more challenging projects.
You can test the devices using known working examples.
Here is one: https://github.com/nRF24/RF24/blob/master/examples/GettingStarted/GettingStarted.ino
If it doesn't work, maybe there is a hardware issue.
Thanks for your help, i will try this weekend