# NRF24L01 Not reading info properly with mega board

**URL:** <https://forum.arduino.cc/t/nrf24l01-not-reading-info-properly-with-mega-board/1455098>\
**Category:** Networking, Protocols, and Devices\
**Created:** [August 9, 2026, 2:49am UTC](https://forum.arduino.cc/t/nrf24l01-not-reading-info-properly-with-mega-board/1455098 "2026-08-09T02:49:38Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![user55551](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/user55551/32/1279350_2.png) [@user55551](https://forum.arduino.cc/u/user55551)\
**Post date:** [August 9, 2026, 2:49am UTC](https://forum.arduino.cc/t/nrf24l01-not-reading-info-properly-with-mega-board/1455098/1 "2026-08-09T02:49:38Z")

</div>

I have been working on this robot which is voice controlled but I want to make it controllable by a controller as well. I have a makeshift controller with a joystick 3 buttons ands a potentiometer controlled by an Arduino Nano. The actual robot is controlled by a mega board For future reference When I refer to robot that's the main project with the mega. The controller is the nano. Both of the sections have an NRF24L01 for communication. So my big problem is that the nano/controller is able to read the joystick positions but once it is sent it turns to garbage and just 0s and numbers in the thousands. WHICH IT SHOULD NOT BE. I've checked the wiring about 50 times. The two NR24L01 modules are powered by the same external 3.3V power supply WITH a 10uF capacitor. I am just trying to get the joystick X and Y to print on the Robot serial monitor. _ **The first code below is the controller/sender and the second is the Robot/Receiver.** _ For anyone who has some tips to help I'm just really frustrated since its taken me so long.

Controller Code

```arduino
#include <SPI.h>

#include <nRF24L01.h>

#include <RF24.h>

#include "printf.h"

RF24 radio(8,9);// ce and csn pins

int16_t data\[6\];

const byte address\[6\] = "12345";

void setup() {

  printf_begin();

  Serial.begin(115200);

  while (!Serial) {

    // some boards need to wait to ensure access to serial over USB

  }

  radio.begin();

  

  radio.setDataRate(RF24_1MBPS);  

  radio.setPALevel(RF24_PA_MIN);

 

  RF24 radio(8, 9, 1000000);

  radio.printDetails();

  

  radio.openWritingPipe(address);

  radio.stopListening();

  pinMode(6, INPUT);

  pinMode(7, INPUT);

  pinMode(2, INPUT);

}

void loop() {

  data\[0\] = analogRead(A0);

  data\[1\] = analogRead(A2);

  data\[2\] = analogRead(A1);

  data\[3\] = digitalRead(6);

  data\[4\] = digitalRead(7);

  data\[5\] = digitalRead(2);

  // Print the ACTUAL values being read

  Serial.print("X: ");

  Serial.print(data\[0\]);

  Serial.print(" | Y: ");

  Serial.print(data\[1\]);

  Serial.print(" | Z: ");

  Serial.print(data\[2\]);

  Serial.print(" | B1: ");

  Serial.print(data\[3\]);

  Serial.print(" | B2: ");

  Serial.print(data\[4\]);

  Serial.print(" | B3: ");

  Serial.println(data\[5\]);

  bool sent = radio.write(&data, sizeof(data));

  Serial.print("Write: ");

  Serial.println(sent ? "SUCCESS" : "FAILED");

  Serial.println("----------------");

  delay(100);

}

```

RECEIVER/ROBOT CODE

```arduino
#include <Servo.h>

Servo Myservo;

#define RPWM 11

#define LPWM 10

#include <Wire.h>

#define TRIG 48

#define ECHO 46

long duration;

float distance;

int Speed = 180;

#include <SPI.h>

#include <nRF24L01.h>

#include <RF24.h>

const byte address\[6\] = "12345"; // Mailbox

int16_t data\[6\];

RF24 radio(7,8);

int CanPrint = true;

int Mode = 6;

#include "DFRobot_DF2301Q.h"

DFRobot_DF2301Q_UART asr(&Serial);

uint8_t lastCmd = 0;

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 29, 27, 26, 24, 25);

#include "printf.h"

void setup() {

  printf_begin();

  Serial.begin(115200);

  pinMode(TRIG, OUTPUT);

  pinMode(ECHO, INPUT);

  pinMode(Mode, INPUT_PULLUP);

  lcd.begin(16, 2);

  Myservo.attach(9);

  Myservo.write(90);

 

  

  radio.begin();

 

  radio.setDataRate(RF24_1MBPS);

  radio.setPALevel(RF24_PA_MIN);

       // Match the transmitter!

  radio.printDetails();

  radio.openReadingPipe(0, address); 

  radio.startListening();

  lcd.setCursor(0, 0);

  pinMode(RPWM, OUTPUT);

  pinMode(LPWM, OUTPUT);

  RF24 radio(7, 8, 1000000);

  while (!asr.begin()) {

    Serial.println("Communication failed!");

    delay(3000);

  }// DFRobot

  Serial.println("Begin OK!");

  // Increase listening time

  asr.settingCMD(DF2301Q_UART_MSG_CMD_SET_WAKE_TIME, 180);

}

void loop() {

 

  if (digitalRead(Mode) == HIGH) {

  

    if (CanPrint == false) {

     CanPrint = true ;

     lcd.clear(); // Clear the screen

     lcd.home();

     lcd.print("Controller Mode ");

    }

    

    if (radio.available()) {

      radio.read(&data, sizeof(data));

      lcd.clear(); // Clear the screen

      lcd.home();

      lcd.print(data\[0\]);

      Serial.print("X: ");

      Serial.print(data\[0\]);

      Serial.print(" Y: ");

      Serial.println(data\[1\]);

    }

    

  } // Controller mode is High

  

 

  if (digitalRead(Mode) == LOW) { // Voice mode is Low

    digitalWrite(TRIG, LOW); // Make sure it starts off

    delayMicroseconds(2);

    digitalWrite(TRIG, HIGH); // Send the trigger pulse

    delayMicroseconds(10);

    digitalWrite(TRIG, LOW); // Stop the pulse

    duration = pulseIn(ECHO, HIGH);

    distance = duration \* 0.034 / 2;

    if (distance < 10.16 && distance > 0) {

      lcd.clear(); // Clear the screen

      lcd.home();

      lcd.print("Too Close");

    }

    uint8_t cmdID = asr.getCMDID();

 

    if (CanPrint == true) {

     cmdID = 0;

     CanPrint = false;

     lcd.clear(); // Clear the screen

     lcd.home();

     lcd.print("Voice Mode ");

    }

    if (cmdID == 0) {

    delay(100);

    return;

    }

   // Print command received

   Serial.print("Command ID: ");

    Serial.println(cmdID);

   if (cmdID == 0) {

      return;

   }

    Serial.print("Command ID: ");

    Serial.println(cmdID);

    lastCmd = cmdID;

    if (cmdID == 5) {

      // BACKWARDS

      lcd.clear(); // Clear the screen

      lcd.home();

      lcd.print("Going Backwards");

      Serial.println("Going backwards");

      analogWrite(RPWM, 0);

      analogWrite(LPWM, Speed);

    }

    else if (cmdID == 22) {

      // FORWARD

      lcd.clear(); // Clear the screen

      lcd.home();

      lcd.print("Going Forwards");

      Serial.println("Going forwards");

      analogWrite(RPWM, Speed);

      analogWrite(LPWM, 0);

    }

    else if (cmdID == 7) {

      // LEFT

      lcd.clear(); // Clear the screen

      lcd.home();

      lcd.print("Turning Left");

      Serial.println("Turning Left");

      Myservo.write(65);

    }

    else if (cmdID == 8) {

      // RIGHT

      lcd.clear(); // Clear the screen

      lcd.home();

      lcd.print("Turning Right");

      Serial.println("Turning Right");

      Myservo.write(123);

    }

    else if (cmdID == 9) {

      // STRAIGHT

      lcd.clear(); // Clear the screen

      lcd.home();

      lcd.print("Straightening");

      lcd.setCursor(0, 1);

      lcd.print("Out");

      Serial.println("Straightening");

      Myservo.write(90);

    }

    else if (cmdID == 6) {

      // STOP

      lcd.clear(); // Clear the screen

      lcd.home();

      lcd.print("Stopping");

      Serial.println("Stopping");

    }

    else if (cmdID == 10) { //MX SPEED

      // MAX SPEED

      lcd.clear(); // Clear the screen

      lcd.home();

      lcd.print("Maximum Speed");

      Serial.println("Maximum speed ");

      Speed = 255;

    }

     else if (cmdID == 11) { // Low speed

      if (Speed > 5) {

        lcd.clear(); // Clear the screen

        lcd.home();

        lcd.print("Lowering Speed");

        Speed = Speed - 25;

      }

    }

    else if (cmdID == 12) { // Inc speed

      if (Speed <= 230) {

        lcd.clear(); // Clear the screen

        lcd.home();

        lcd.print("Increasing Speed");

        Speed = Speed + 25;

      }

    }

    else if (cmdID == 13) { //Half Speed

      lcd.clear(); // Clear the screen

      lcd.home();

      lcd.print("Half Speed");

      Speed = 180;

    }

  }

  

 

  // Wait for module to settle

  delay(45);

  lastCmd = 0;

}

```

if anyone could tell me whats wrong I would INSANELY appreciate it.

---

<div class="post-metadata">

**Author:** ![horace](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/horace/32/1014299_2.png) [@horace](https://forum.arduino.cc/u/horace)\
**Post date:** [August 9, 2026, 4:54am UTC](https://forum.arduino.cc/t/nrf24l01-not-reading-info-properly-with-mega-board/1455098/2 "2026-08-09T04:54:58Z")

</div>

it is a good idea to check that the SPI connection to the radio has initialised OK, e.g.

```arduino
void setup() {
  Serial.begin(115200);
  radio.begin();
  if (radio.isChipConnected())
    Serial.println("\n\nReceiver NF24 connected to SPI");
  else {
    Serial.println("\n\nNF24 is NOT connected to SPI");
    while (1)
      ;
  }

```

did you test the communication with any of the library examples?

your code is difficult to read - tidy it to remove some of the empty lines

EDIT: have a look at [Power Stability Issues with RF24 Radio Module](https://forum.arduino.cc/t/2-nrf24l01s-not-communicating-properly/1365921/22) by @gilshultz

---

<div class="post-metadata">

**Author:** ![van\_der\_decken](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/van_der_decken/32/1006976_2.png) [@van\_der\_decken](https://forum.arduino.cc/u/van_der_decken)\
**Post date:** [August 9, 2026, 5:30am UTC](https://forum.arduino.cc/t/nrf24l01-not-reading-info-properly-with-mega-board/1455098/3 "2026-08-09T05:30:27Z")

</div>

> [@user55551](#):
>
> I've checked the wiring about 50 times.

It might be helpful if you shared what pins on the two Arduinos that the nRF24L01s are hooked up to, don't you think?

---

<div class="post-metadata">

**Author:** ![user55551](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/user55551/32/1279350_2.png) [@user55551](https://forum.arduino.cc/u/user55551)\
**Post date:** [August 9, 2026, 5:39am UTC](https://forum.arduino.cc/t/nrf24l01-not-reading-info-properly-with-mega-board/1455098/4 "2026-08-09T05:39:36Z")

</div>

> [@horace](#):
>
> ```arduino
> if (radio.isChipConnected())
> Serial.println("\n\nReceiver NF24 connected to SPI");
> else {
> Serial.println("\n\nNF24 is NOT connected to SPI");
> while (1)
> ;
> 
> ```

I checked it once a while ago but that was before I cleaned up the power stability. I will check that first thing. I will also have a look at that linked forum and I will spend some time cleaning up my code. First time using this forum and this is actually my first project so sorry for anything I mess up, Thank you though

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [August 9, 2026, 5:39am UTC](https://forum.arduino.cc/t/nrf24l01-not-reading-info-properly-with-mega-board/1455098/5 "2026-08-09T05:39:38Z")

</div>

> [@user55551](#):
>
> turns to garbage and just 0s and numbers in the thousands. WHICH IT SHOULD NOT BE

Potentiometer, joystick horizontal and joystick vertical range is 0 to 1023 on a Nano.

This seems to be your voice command module library: [GitHub - DFRobot/DFRobot\_DF2301Q · GitHub](https://github.com/DFRobot/DFRobot_DF2301Q)

---

<div class="post-metadata">

**Author:** ![user55551](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/user55551/32/1279350_2.png) [@user55551](https://forum.arduino.cc/u/user55551)\
**Post date:** [August 9, 2026, 5:40am UTC](https://forum.arduino.cc/t/nrf24l01-not-reading-info-properly-with-mega-board/1455098/6 "2026-08-09T05:40:28Z")

</div>

Yeah sorry probably should have clarified, numbers in like the 17000's that are just completely random.

---

<div class="post-metadata">

**Author:** ![user55551](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/user55551/32/1279350_2.png) [@user55551](https://forum.arduino.cc/u/user55551)\
**Post date:** [August 9, 2026, 5:45am UTC](https://forum.arduino.cc/t/nrf24l01-not-reading-info-properly-with-mega-board/1455098/7 "2026-08-09T05:45:30Z")

</div>

Completely right My fault.

Controller (NANO) :  
CE -- D8  
CSN -- D9  
SCK --- D13  
MOSI -- D11  
MISO -- D12  
IRQ -- Currently Disconnected

Robot ( MEGA )  
CE -- D7  
CSN -- D8  
SCK --- D52  
MOSI -- D51  
MISO -- D50  
IRQ -- Currently Disconnected

---

<div class="post-metadata">

**Author:** ![user55551](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/user55551/32/1279350_2.png) [@user55551](https://forum.arduino.cc/u/user55551)\
**Post date:** [August 9, 2026, 6:06am UTC](https://forum.arduino.cc/t/nrf24l01-not-reading-info-properly-with-mega-board/1455098/8 "2026-08-09T06:06:38Z")

</div>

Looked at that link, I personally don' t think that power is the problem. Then again I'm not the expert here. I used a multimeter to check the voltage and got a steady 3.3v. Before I used the 3.3v pin with a capacitor and then I switched to the external power supply. The external power supply actually made it send but now its just wacky numbers. I added that little snippet of code and it said Spi is NOT connected on the robot code So I think thats the problem. I cleaned up the code a lot if you want the neater version I can send it. Thanks again helping me.

---

<div class="post-metadata">

**Author:** ![horace](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/horace/32/1014299_2.png) [@horace](https://forum.arduino.cc/u/horace)\
**Post date:** [August 9, 2026, 7:21am UTC](https://forum.arduino.cc/t/nrf24l01-not-reading-info-properly-with-mega-board/1455098/9 "2026-08-09T07:21:44Z")

</div>

> [@user55551](#):
>
> I added that little snippet of code and it said Spi is NOT connected on the robot code So I think thats the problem.

sounds to be the problem - check wiring

if it fails implement a program to test just the NRF24L01  
if it still fails disconnect all other devices (LCD, SENSORS, etc) - if it works add devices one by one testing as you go

if it still fails possibly the NRF24L01 is faulty?

---

<div class="post-metadata">

**Author:** ![aldan41](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/aldan41/32/1126592_2.png) [@aldan41](https://forum.arduino.cc/u/aldan41)\
**Post date:** [August 9, 2026, 12:44pm UTC](https://forum.arduino.cc/t/nrf24l01-not-reading-info-properly-with-mega-board/1455098/10 "2026-08-09T12:44:35Z")

</div>

assuming your 3.3v is reliable (I personaly put 100µF + 100nF as close to the NRF Pins), assuming CE and CSN pins are not in conflict with other devices requiring SPI/I2c.. if your NRF24 tests are OK ... think about what may make the NRF be unavailable when the messages come.. when an ACk is required... (do you receive the ack on the sender side? did you read the message from the buffer before another message comes... monitor these). Also test how fast your Loop runs . It reveal thing and tell you why your device was not available when the message come.. I had a case where the loop was too slow (delay's forgotten) or delay's in some functions called or heavy computing (solar/moon/ astronomical). With the NRF and other radio devices "loop" has to be as fast as possible!  
Just idea's from my small experience ! I have not read all the post, if I am repeating, I am sorry!

---

<div class="post-metadata">

**Author:** ![user55551](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/user55551/32/1279350_2.png) [@user55551](https://forum.arduino.cc/u/user55551)\
**Post date:** [August 9, 2026, 2:38pm UTC](https://forum.arduino.cc/t/nrf24l01-not-reading-info-properly-with-mega-board/1455098/11 "2026-08-09T14:38:41Z")

</div>

yeahhh so I accidently forgot to plug in the external power supply for the nrfs and when I did it said chip connected so that was my bad on that part. But I did triple check the wiring with the official SPI pins and they are all correct. My next theory is that its a lot of extra noise. My current setup is EXT power supply ----- 4 wires sharing 3v and ground (2 each) ---- breadboard with the wires --- 10uf Capacitor -- Jumper Wire ---- nrf module. I think the jumper wire could possibly be too long to hold a quiet path so that is the next thing I will check. I will return with results.

---

<div class="post-metadata">

**Author:** ![gilshultz](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gilshultz](https://forum.arduino.cc/u/gilshultz)\
**Post date:** [August 9, 2026, 2:57pm UTC](https://forum.arduino.cc/t/nrf24l01-not-reading-info-properly-with-mega-board/1455098/12 "2026-08-09T14:57:29Z")

</div>

since the externally power supply changed things, I am assuming that is on the transmitter. Use an external power supply on the other unit and be sure they are at least a meter apart.
