Trouble with nRF24 Modules

I am working on a weather station project with the intention of using two nRF24 modules to connect an Arduino Uno to a Uno WIFI Rev2 which then uploads the data to weather underground once its inside. The only part of this project that I can not get working is the transceivers. I've bought two pairs of these now and adapter boards, used shorter wires, tried all the codes available online and the best I have got is occasional random values from the receiver in the serial monitor.

Even when not using the Uno WIFI the same thing happens.

This is one particular code that ChatGPT wrote. The transmitter appears to work fine, but nothing is displayed in the receiver code. The RF24 library is installed on both devices.

// Transmitter code by ChatGPT
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(9, 8);  // CE, CSN pins

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(0xF0F0F0F0E1LL);  // Set the pipe address for communication
  radio.setPALevel(RF24_PA_HIGH);        // Set the power level
}

void loop() {
  const char *message = "Hello, receiver!"; // Message to send
  radio.write(message, strlen(message));   // Send the message
  Serial.println("Message sent: " + String(message));
  delay(1000);  // Wait before sending the next message
}
// Reciever code by ChatGPT
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(9, 8);  // CE, CSN pins

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(1, 0xF0F0F0F0E1LL); // Set the same pipe address as the transmitter
  radio.setPALevel(RF24_PA_HIGH);           // Set the power level
  radio.startListening();                  // Start listening for incoming messages
}

void loop() {
  if (radio.available()) {
    char message[32] = "";
    radio.read(&message, sizeof(message)); // Read the incoming message
    Serial.println("Received: " + String(message));
  }
}


Is having all the wires overlapping causing issues? When these are active the have been from 30cm to 1m apart with no change (although sometimes the outputs from the receiver change in frequency based on where I am standing near).


I have used the wiring suggestions from Last Minute Engineers

As evident I have also soldered a 10uF capacitor on the ground and vcc pins of each transceiver. I am both hoping and assuming that the modules work.

What should I do to make these work? I have heard about wrapping ground wires around some of the wires but am not sure which ones or how to do that. Any help would be greatly appreciatedd

My standard advice:

Keep asking the robot until he/she/it gives you the correct result you expect.

One answer could probably be 42.

Robin2's simple rf24 tutorial helped me a lot.

1 Like

Be aware that on an Arduino WiFi Rev2, the SPI pins are not available on pins 11/12/13 but on the six pin header.

I can't say why it would not work on a normal Uno.

What you are seeing is not that uncommon. Use a seperate 3V3 power supply that is well bypassed. Powering it from the Arduino is sometimes maybe proposition. It generates current spikes that require more current then the arduino is capable of supplying. Sometimes caps will help then later they may fail working.

Thank you for this, I now recall reading this at some point

Are the nRF24L01's plugged into little adapter boards? Do they have an AMS1117 5v to 3v3 regulator on them? If so, you need to apply 5v, not 3v3.

Make sure your ce and csn pins are the right way around (some modules label them CE = CNS and CSN = CE or something like that from memory) try and switch them

You can try set the palevels on both too low

Try and half the spi rate in RF24_config.h file. Look for the line #define RF24_SPI_SPEED 10000000.

You can try without the adaptor board and use 3.3v from the arduino. Ive had a few dodgy boards of these in the past

Thank you all, the solution has turned out to be using the Arduino 5V output into the regulator board. Although I still need to work out making it work with the Uno WIFI, does anyone know if it as simple as connecting to the ICSP pins as outlined on the Arduino Pinout diagram? (so in this case MISO to ICSP 1, SCK to ICSP 3 and MOSI to ICSP pin 4?)

It should be but I don't have an Arduino WiFi Rev2 to play with.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.