STUCK WITH NRF24L01 MODULE

I have searched literally everywhere for a guide, video, or post about how to learn the NRF24L01 library commands.I really want to learn how to use it but i can't since there is no where i can learn the commands.Any help or advice?

Using TMRh20's version of NRF24l01

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.

The TMRh20 library documentation is pretty good - one of the best documented Arduino libraries.

...R

Ive tried your tutorial multiple times before and after this post, all i get on the rx is "data received" being printed really fast, i checked then checkconnection.ino file you made but it is showing mostly 0s, please i really need help to make this work

snakeviper123:
, i checked then checkconnection.ino file you made but it is showing mostly 0s, please i really need help to make this work

Let's start with the basics.

Post the actual connection test program that YOU uploaded to your Arduino and also post the output that it produces.

...R

TX code

// SimpleTx - the master or the transmitter

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


#define CE_PIN 8
#define CSN_PIN 9

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

OUTPUT:
SimpleTx Starting
Data Sent Message 0 Tx failed
Data Sent Message 0 Tx failed
Data Sent Message 0 Tx failed
Data Sent Message 0 Tx failed
Data Sent Message 0 Tx failed
...

rx CODE

// SimpleRx - the slave or the receiver

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

#define CE_PIN 8
#define CSN_PIN 9

const byte thisSlaveAddress[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, 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);
        newData = false;
    }
}

output:
SimpleRx Starting
Data received Message 0
Data received Message 0
Data received Message 0
Data received Message 0

snakeviper123:
TX code

Please re-read my Reply #3 carefully.

...R

Sorry, my bad, here it is:

// 18 Mar 2018 - simple program to verify connection between Arduino
//      and nRF24L01+
//  This program does NOT attempt any communication with another nRF24

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

#include <printf.h>

#define CE_PIN   9
#define CSN_PIN 10

const byte thisSlaveAddress[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);
    printf_begin();

    Serial.println("CheckConnection Starting");
    Serial.println();
    Serial.println("FIRST WITH THE DEFAULT ADDRESSES after power on");
    Serial.println("  Note that RF24 does NOT reset when Arduino resets - only when power is removed");
    Serial.println("  If the numbers are mostly 0x00 or 0xff it means that the Arduino is not");
    Serial.println("     communicating with the nRF24");
    Serial.println();
    radio.begin();
    radio.printDetails();
    Serial.println();
    Serial.println();
    Serial.println("AND NOW WITH ADDRESS AAAxR  0x41 41 41 78 52   ON P1");
    Serial.println(" and 250KBPS data rate");
    Serial.println();
    radio.openReadingPipe(1, thisSlaveAddress);
    radio.setDataRate( RF24_250KBPS );
    radio.printDetails();
    Serial.println();
    Serial.println();
}


void loop() {

}

Output:

FIRST WITH THE DEFAULT ADDRESSES after power on
Note that RF24 does NOT reset when Arduino resets - only when power is removed
If the numbers are mostly 0x00 or 0xff it means that the Arduino is not
communicating with the nRF24

STATUS = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1 = 0x0000000000 0x0000000000
RX_ADDR_P2-5 = 0x00 0x00 0x00 0x00
TX_ADDR = 0x0000000000
RX_PW_P0-6 = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA = 0x00
EN_RXADDR = 0x00
RF_CH = 0x00
RF_SETUP = 0x00
CONFIG = 0x00
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = Disabled
PA Power = PA_MIN

AND NOW WITH ADDRESS AAAxR 0x41 41 41 78 52 ON P1
and 250KBPS data rate

STATUS = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1 = 0x0000000000 0x0000000000
RX_ADDR_P2-5 = 0x00 0x00 0x00 0x00
TX_ADDR = 0x0000000000
RX_PW_P0-6 = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA = 0x00
EN_RXADDR = 0x00
RF_CH = 0x00
RF_SETUP = 0x00
CONFIG = 0x00
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = Disabled
PA Power = PA_MIN

The fact that the Data Rate has not changed to 250kbps means that your Arduino is not communicating with its nRF24.

The most likely reason is because the wires are not connected correctly.

Next most likely reason is a bad connection on one of the wires.

And there is also the possibility that the nRF24 is faulty.

Make a simple pencil (or pen) drawing showing in detail how YOU have everything connected and post a photo of the drawing. Please do NOT post a photo of your hardware - it won't tell us anything.

I have just realised you have not told us what Arduino your have. I have been assuming it is an Uno.

...R

EDIT:
GREEN TO 9
YELLOW TO 8

and yes i am using an uno but i also use it on a nano aswell, but its not working on that either, and btw thank you for helping me so far, ive honestly been scratching my head 1 month straight on how to get the nrf24l01 working

Image from Reply #8 so we don't have to download it. See this Simple Image Posting Guide

...R

sooooo ,how do i fix my nrf24l01 now?

That does not look like a pencil drawing to me and I can't read the pin labels. Also it seems it is not even correct. Please just draw a diagram as requested, and make sure it is correct before posting.

Help us to help you.

Does your wiring match the diagram in my Tutorial?

...R


I rewired it to the exact same as your wiring in the tutorial but it still isnt working

sooo, what do i do now?

ok ,i have solved this, to anyone reading this post, this is how i did it.

  1. I used the nrf24l01 breakout board.
  2. 5V vcc from Arduino to breakout board vcc input.
  3. Remember to keep your ground pin plugged in while using it, one of my nrf24l01s that way.
  4. Use Robin's excellent nrf24l01 tutorial