# Connecting between two NRF24s

**URL:** <https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080>\
**Category:** Programming\
**Created:** [July 6, 2021, 7:28am UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080 "2021-07-06T07:28:14Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![ymj1225](https://avatars.discourse-cdn.com/v4/letter/y/ebca7d/32.png) [@ymj1225](https://forum.arduino.cc/u/ymj1225)\
**Post date:** [July 6, 2021, 7:28am UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/1 "2021-07-06T07:28:14Z")

</div>

Sorry, I just got a problem  
I use this code and it still can't connect between two NRF24, but I tried you're checkconnection.ino it seem's that the arduino are connecting good with nrf24, did anyone know what's the problem?

 ![aaa](https://europe1.discourse-cdn.com/arduino/original/4X/a/a/7/aa7b0e6d3b6c725332ae2f99dce27800d1799a1f.jpeg)

```cpp
// SimpleTx - the master or the transmitter

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

#define CE_PIN 7
#define CSN_PIN 8

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

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

char dataToSend[10] = "Message 0";
char txNum = '0';

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

void setup() {

    Serial.begin(9600);

    Serial.println("SimpleTx Starting");

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

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

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
    txNum += 1;
    if (txNum > '9') {
        txNum = '0';
    }
    dataToSend[8] = txNum;
}

```

```cpp
// SimpleRx - the slave or the receiver

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

#define CE_PIN 7
#define CSN_PIN 8

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

RF24 radio(CE_PIN, CSN_PIN);

char dataReceived[10]; // this must match dataToSend in the TX
bool newData = false;

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

void setup() {

    Serial.begin(9600);

    Serial.println("SimpleRx Starting");
    radio.begin();
    radio.setDataRate( RF24_250KBPS );
    radio.openReadingPipe(1, Address);
    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);
        newData = false;
    }
}

```

I use this diagram to connect my nrf24

 ![nRF24L01_arduino](https://europe1.discourse-cdn.com/arduino/original/4X/a/d/1/ad15c67f13a42ba86f7cc96ddbd6e8513f75cfc6.png)  
Update:  
I edit my code to

```cpp
//tx
radio.begin();
    radio.setDataRate( RF24_250KBPS );
    radio.setPALevel(RF24_PA_MIN);
    radio.setRetries(3,5); // delay, count
    radio.openWritingPipe(Address);

```

```cpp
\\rx
Serial.println("SimpleRx Starting");
    radio.begin();
    radio.setDataRate( RF24_250KBPS );
    radio.setPALevel(RF24_PA_MIN);
    radio.openReadingPipe(0, Address);
    radio.startListening();

```

and message 0 to message 1

 ![bbb](https://europe1.discourse-cdn.com/arduino/original/4X/6/1/d/61d55731e116ec984fec17cf427d9217415292d0.jpeg)

I got the information from here:[Simple nRF24L01+ 2.4GHz transceiver demo - #2 by Robin2](https://forum.arduino.cc/t/simple-nrf24l01-2-4ghz-transceiver-demo/405123/2)

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [July 6, 2021, 7:36am UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/2 "2021-07-06T07:36:46Z")

</div>

@ymj1225  
Welcome.  
Please read the forum guidelines [How to get the best out of this forum](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966)

When you've read them please post your code in code tags \</\> as per the instructions. Posting an image of code is useless.

Please do not hijack other topics.

Thank you.

---

<div class="post-metadata">

**Author:** ![6v6gt](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/6v6gt/32/225488_2.png) [@6v6gt](https://forum.arduino.cc/u/6v6gt)\
**Post date:** [July 6, 2021, 7:40am UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/3 "2021-07-06T07:40:24Z")

</div>

After you have read the guidelines, post both the transmitter and receiver code you have tried.  
Also post a diagram of how you have connected the NRF24L01 devices to your Arduinos.  
If the code and wiring appear correct, then the most likely problem is insufficient power to the radio devices.

---

<div class="post-metadata">

**Author:** ![groundFungus](https://avatars.discourse-cdn.com/v4/letter/g/73ab20/32.png) [@groundFungus](https://forum.arduino.cc/u/groundFungus)\
**Post date:** [July 6, 2021, 8:33am UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/4 "2021-07-06T08:33:45Z")

</div>

The code has CE and CSN at pins 9 and 10. The diagram has CE and CSN at pins 7 and 8. Which?

Post a clear photo of your wiring.

---

<div class="post-metadata">

**Author:** ![ymj1225](https://avatars.discourse-cdn.com/v4/letter/y/ebca7d/32.png) [@ymj1225](https://forum.arduino.cc/u/ymj1225)\
**Post date:** [July 6, 2021, 8:35am UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/5 "2021-07-06T08:35:31Z")

</div>

I use the 9 and 10

---

<div class="post-metadata">

**Author:** ![groundFungus](https://avatars.discourse-cdn.com/v4/letter/g/73ab20/32.png) [@groundFungus](https://forum.arduino.cc/u/groundFungus)\
**Post date:** [July 6, 2021, 8:36am UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/6 "2021-07-06T08:36:31Z")

</div>

Why does the diagram show 7 and 8?

Bad data is worse than no data.

---

<div class="post-metadata">

**Author:** ![ymj1225](https://avatars.discourse-cdn.com/v4/letter/y/ebca7d/32.png) [@ymj1225](https://forum.arduino.cc/u/ymj1225)\
**Post date:** [July 6, 2021, 8:41am UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/7 "2021-07-06T08:41:55Z")

</div>

OK,sorry I change to CE=7 and CSN=8

---

<div class="post-metadata">

**Author:** ![ymj1225](https://avatars.discourse-cdn.com/v4/letter/y/ebca7d/32.png) [@ymj1225](https://forum.arduino.cc/u/ymj1225)\
**Post date:** [July 6, 2021, 9:56am UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/8 "2021-07-06T09:56:14Z")

</div>

I'm now getting this? the left one says failed but the right one has success?

 ![ccc](https://europe1.discourse-cdn.com/arduino/original/4X/a/2/9/a29ed81b2f216e21a4b3e12ac04a4b960180ed77.jpeg)

---

<div class="post-metadata">

**Author:** ![6v6gt](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/6v6gt/32/225488_2.png) [@6v6gt](https://forum.arduino.cc/u/6v6gt)\
**Post date:** [July 6, 2021, 10:05am UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/9 "2021-07-06T10:05:41Z")

</div>

The receiver got the message but the transmitter did not get the corresponding 'ack' back. That can be symptom of a power problem.

---

<div class="post-metadata">

**Author:** ![ymj1225](https://avatars.discourse-cdn.com/v4/letter/y/ebca7d/32.png) [@ymj1225](https://forum.arduino.cc/u/ymj1225)\
**Post date:** [July 6, 2021, 10:12am UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/10 "2021-07-06T10:12:26Z")

</div>

I'm using my laptop to connect my Arduino, the usb port output was 5v is this problem?

---

<div class="post-metadata">

**Author:** ![Whandall](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/whandall/32/222457_2.png) [@Whandall](https://forum.arduino.cc/u/Whandall)\
**Post date:** [July 6, 2021, 10:14am UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/11 "2021-07-06T10:14:31Z")

</div>

I think you need a better power supply,  
in your marginally working case, even a capacitor on the power pins could make it work.

---

<div class="post-metadata">

**Author:** ![ymj1225](https://avatars.discourse-cdn.com/v4/letter/y/ebca7d/32.png) [@ymj1225](https://forum.arduino.cc/u/ymj1225)\
**Post date:** [July 6, 2021, 10:21am UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/12 "2021-07-06T10:21:32Z")

</div>

Ok, I'll try it later thanks.

---

<div class="post-metadata">

**Author:** ![ymj1225](https://avatars.discourse-cdn.com/v4/letter/y/ebca7d/32.png) [@ymj1225](https://forum.arduino.cc/u/ymj1225)\
**Post date:** [July 6, 2021, 11:48am UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/13 "2021-07-06T11:48:18Z")

</div>

Oh, I use a 10uF capacitance and it works!!! thank you.

---

<div class="post-metadata">

**Author:** ![6v6gt](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/6v6gt/32/225488_2.png) [@6v6gt](https://forum.arduino.cc/u/6v6gt)\
**Post date:** [July 6, 2021, 12:23pm UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/14 "2021-07-06T12:23:00Z")

</div>

The NRF24L01 is 5volt pin compatible, but must be powered at 3.3 volts or less.  
A good solution for powering these is a purpose made adapter module:

> **[AZDelivery Kompitabel mit NRF24L01 Adapter für Kompatibel mit NRF24L01 RF...](https://www.amazon.de/AZDelivery-Adapter-for-NRF24L01-Parent/dp/B086TRSLH8)**
>
> AZDelivery Kompitabel mit NRF24L01 Adapter für Kompatibel mit NRF24L01 RF Wireless Transceiver Modul 2.4 GHz 3.3V mit 8 Pins inklusive E-Book! - Kostenloser Versand ab 29€. Jetzt bei Amazon.de bestellen!

 ![71yMkH5v3vL.SL1500](https://europe1.discourse-cdn.com/arduino/original/4X/8/0/a/80a4a3ceeeafb445b67858cdfaff742c502ae92b.jpeg)

---

<div class="post-metadata">

**Author:** ![Whandall](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/whandall/32/222457_2.png) [@Whandall](https://forum.arduino.cc/u/Whandall)\
**Post date:** [July 6, 2021, 5:08pm UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/15 "2021-07-06T17:08:03Z")

</div>

I'm glad it works now.

The 3.3V supply of Arduinos is very dependent on the model/make,  
and rarely enough for a standard NRF24L01+.  
Using one of the adapters that @6v6gt linked, solves that problem.

---

<div class="post-metadata">

**Author:** ![moaaz11](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@moaaz11](https://forum.arduino.cc/u/moaaz11)\
**Post date:** [July 9, 2021, 1:49pm UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/16 "2021-07-09T13:49:13Z")

</div>

ok then guys after all i need to use capicitor or an adapter and connect it to 3.3v  
right?

---

<div class="post-metadata">

**Author:** ![groundFungus](https://avatars.discourse-cdn.com/v4/letter/g/73ab20/32.png) [@groundFungus](https://forum.arduino.cc/u/groundFungus)\
**Post date:** [July 9, 2021, 2:48pm UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/17 "2021-07-09T14:48:07Z")

</div>

The adapter connects to 5V. The adapter has a 3.3V regulator on it's board.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [November 6, 2021, 2:48pm UTC](https://forum.arduino.cc/t/connecting-between-two-nrf24s/882080/18 "2021-11-06T14:48:23Z")

</div>

Closed on November 6, 2021, 2:48pm UTC

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