nRF24L01 issues (Drone Project)

Hello guys,
i’ve a problem with the nRF24L01 modules. In this project i’m currently using two Arduino (nano and Uno). Each one is connected to the nrf24l01 adapter powered by the 5v on the Arduino. I followed the circuit from this link https://forum.arduino.cc/index.php?topic=421081. I just added a servo module on the receiver and a joystick on the transmitter.
The problem is the following : the servo works for about 10 secs but later it doesn’t move anymore(i see that on the receiver code, radio.avaiable() return always false).
I noticed that removing the servo.write(), all works properly without stopping.
I’m struggling so much in these days, so thank you to anyone who could help with this.

The nrf24l01 adapter

RX code:

// SimpleRx - the slave or the receiver
#include <Servo.h> 
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

#define CE_PIN   9
#define CSN_PIN 10
#define pinServo 3 

const byte thisSlaveAddress[5] = {'R','x','A','A','A'};

RF24 radio(CE_PIN, CSN_PIN);
Servo servo ; 

int dataReceived ;[color=#dcddde][/color]
bool newData = false;

//===========

void setup() {

    Serial.begin(9600);

    Serial.println("SimpleRx Starting");
    servo.attach(pinServo) ; 
    radio.begin();
    radio.setDataRate( RF24_250KBPS );
    radio.openReadingPipe(1, thisSlaveAddress);
    radio.startListening();
}

//=============

void loop() {
    getData();
    showData();
}

//==============

void getData() {
    if ( radio.available() ) {
        radio.read( &dataReceived, sizeof(dataReceived) );
        newData = true;
    }
}

void showData() {
    if (newData == true) {
        Serial.print("Data received ");
        Serial.println(dataReceived);
        servo.write(dataReceived) ; 
        delay(5) ; 
        newData = false;
    }
}

TX code:

// SimpleTx - the master or the transmitter

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


#define CE_PIN   9
#define CSN_PIN 10

const byte slaveAddress[5] = {'R','x','A','A','A'};


RF24 radio(CE_PIN, CSN_PIN); // Create a Radio

int dataToSend ;



unsigned long currentMillis;
unsigned long prevMillis;
unsigned long txIntervalMillis = 100; // send once per second


void setup() {

    Serial.begin(9600);

    Serial.println("SimpleTx Starting");

    radio.begin();
    radio.setDataRate( RF24_250KBPS );
    radio.setPALevel(RF24_PA_HIGH) ;
    radio.setRetries(3,5); // delay, count
    radio.openWritingPipe(slaveAddress);
}

//====================

void loop() {
    currentMillis = millis();
    if (currentMillis - prevMillis >= txIntervalMillis) {
        send();
        prevMillis = millis();
    }
}

//====================

void send() {

    bool rslt;
    rslt = radio.write( &dataToSend, sizeof(dataToSend) );
        // Always use sizeof() as it gives the size as the number of bytes.
        // For example if dataToSend was an int sizeof() would correctly return 2

    Serial.print("Data Sent ");
    Serial.print(dataToSend);
    if (rslt) {
        Serial.println("  Acknowledge received");
        updateMessage();
    }
    else {
        Serial.println("  Tx failed");
    }
}

//================

void updateMessage() {
        // so you can see that new data is being sent
[color=#dcddde][/color]
    dataToSend = analogRead(A0) ;
    dataToSend = map(dataToSend , 0 , 1023 , 0, 180) ; 
    delay(10) ; 
}

I’m using the following library: https://github.com/nRF24/RF24

I cant see why it doenst work. Maybe try it without the adapter and 3.3V.
Also In my Drone Project I used another library and in the project folder, you can find an example for the nrf24, maybe this helps.

How is the servo powered?

It should NOT be drawing power from the Arduino 5v pin - it should have its own power supply with the GND connected to the Arduino GND.

I suspect it doesn't do any harm but you have a delay(10) in the TX program and a delay(5) in the Rx program and neither is necessary. It is not good practice to mix timing using delay() with timing using millis() and there should be no delay()s in the RX program - it should be able to listen all the time.

...R

PS ... you have started a Thread with a problem - the Exhibition / Gallery section is not the right place for questions so I have suggested to the Moderator to move you to the Networking section.

Topic moved here as I think that it will get more exposure than in the Networking section