NRF24L01 Transceiver Not Receiving

I'm working on a problem with radio control so I purchased two NRF24L01 transceivers and two Arduino Nanos. I got one of the transceivers to send, but can't get the other to consistently receive. What's weird is I had it working for literally 30 seconds, then I went to clean some code up and then it stopped working. I then undid what I had changed and reverted it back to when it was working and recompiled but it stopped receiving. They are connected the exact same way:

CE --> 9
CSN --> 10
SCK --> 13
MO --> 11
MI --> 12

I'm using a 3.3V regulator for each transceiver so that's not an issue. Since I'm only have one cable to connect to my computer for power I am using a 9V battery connected to the transmitter. For the receiver I'm using the power from USB to the board and out the 5V pin on the board to the 3.3V regulator and then to the receiver module.

Here is the code for the transmitter:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

#define CE_PIN   9
#define CSN_PIN 10

RF24 radio(CE_PIN, CSN_PIN);
const uint64_t pipe = 0xE7E7E7E7E7;

void setup() {
  radio.begin();
  radio.openWritingPipe(pipe);
  radio.setPALevel(RF24_PA_MIN);
  radio.setDataRate(RF24_250KBPS);
  radio.disableDynamicPayloads();
  radio.setAutoAck(false);
  radio.stopListening();
  Serial.begin(115200);
}

void loop() {
  float val = map(analogRead(A0), 0, 1023, 1, 100);
  Serial.print(radio.write(&val, sizeof(val)));
  Serial.print(" ");
  Serial.println(val);
  delay(1);
}

Here is the code for the receiver:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

#define CE_PIN   9
#define CSN_PIN 10

RF24 radio(CE_PIN, CSN_PIN);
const uint64_t pipe = 0xE7E7E7E7E7;

void setup() {
  radio.begin();
  radio.openReadingPipe(0, pipe);
  radio.setPALevel(RF24_PA_MAX);
  radio.setDataRate(RF24_250KBPS);
  radio.disableDynamicPayloads();
  radio.setAutoAck(false);
  radio.startListening();
  Serial.begin(115200);
}

void loop() {
  float val;
  if (radio.available()) {
    radio.read(&val, sizeof(val));
    String transData = String(val);
    Serial.println(transData);
    delay(1);
  }
  else {
    Serial.println("-");
    delay(1);
  }
  delay(1);
}

I'm not sure what's going on. Some help would be great as both setting these up and troubleshooting for these modules are a pain.

1 Like

If by 'a 9V battery' you mean one of those small ones often found in domestic fire alarms, then try a better battery, particularly as your using it to power a transmitter. Try a set of AAs for instance.

Have a look at this Simple nRF24L01+ Tutorial.

Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.

The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work

There is also a connection test program to check that the Arduino can talk to the nRF24 it is connected to. If the first example does not work be sure to try the connection test for both of your Arduinos. Nothing will work if the connection test fails.

A common problem with nRF24 modules is insufficient 3.3v current from the Arduino 3.3v pin. This seems to be a particular problem with the nano. The high-power nRF24s (with the external antenna) will definitely need an external power supply. At least for testing try powering the nRF24 with a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.

If you are using the high-power nRF24s (with the external antenna) it may help to have a distance of about 3 metres between the two nRF24s so that the signal does not overwhelm the receiver. However someone on the Forum has had them working without that separation - I don't have any personal experience with them. If you are new to nRF24s it may be better to start with a pair of low power modules with the pcb antenna.

...R

srnet:
If by 'a 9V battery' you mean one of those small ones often found in domestic fire alarms, then try a better battery, particularly as your using it to power a transmitter. Try a set of AAs for instance.

This is not an issue, I had it hooked up to a 5V power supply previously and it did not work, I attached the 9V battery simply because I only have one USB to power one of the Arduinos. I bought another one it's coming tomorrow.

Robin2:
Have a look at this Simple nRF24L01+ Tutorial.

Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.

The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work

There is also a connection test program to check that the Arduino can talk to the nRF24 it is connected to. If the first example does not work be sure to try the connection test for both of your Arduinos. Nothing will work if the connection test fails.

A common problem with nRF24 modules is insufficient 3.3v current from the Arduino 3.3v pin. This seems to be a particular problem with the nano. The high-power nRF24s (with the external antenna) will definitely need an external power supply. At least for testing try powering the nRF24 with a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.

If you are using the high-power nRF24s (with the external antenna) it may help to have a distance of about 3 metres between the two nRF24s so that the signal does not overwhelm the receiver. However someone on the Forum has had them working without that separation - I don't have any personal experience with them. If you are new to nRF24s it may be better to start with a pair of low power modules with the pcb antenna.

...R

I'll take a look tomorrow once I receive another USB cable just so both Arduinos are receiving the same amount of power from the same source.

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