NRF24L01 Problems?

Hello!

I've been trying to get these two chips to send pings to each other using Maniacbug's Library to no avail. I used the 'Gettingstarted' Code. I've tried a multitude of different things from capacitors, voltage regulators etc, yet they never make a connection.

I was using an Arduino UNO + a Nano, but I burnt out my uno and am left with the Nano. Before I receive another new Nano, I'd like to know if this singular NRF24 module is sending an acceptable debug, just so I know one module works on it's own before getting a connection between the two of them. (I have both the High power module and the lower module just incase, and they both give me the same debug)

STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1	 = 0xe7e7e7e7e7 0xf0f0f0f0d2
RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR		 = 0xe7e7e7e7e7
RX_PW_P0-6	 = 0x00 0x20 0x00 0x00 0x00 0x00
EN_AA		 = 0x3f
EN_RXADDR	 = 0x03
RF_CH		 = 0x4c
RF_SETUP	 = 0x07
CONFIG		 = 0x0f
DYNPD/FEATURE	 = 0x00 0x00
Data Rate	 = 1MBPS
Model		 = nRF24L01+
CRC Length	 = 16 bits
PA Power	 = PA_HIGH

What strikes me is that the RX address should be different to the TX address, or it's considered listening to itself and not other modules, this never changed even when I had another module present. Could I get some insight in this, sorry if I'm missing out any details.

This Simple nRF24L01+ Tutorial should get you started. Note that it does NOT work with the ManiacBug version of the RF24 library.

...R

In the process of acknowledging, the tx-address is placed in rx-pipe-0, this is normal behaviour.

Study the nRF24L01P_Product_Specification_1_0.pdf to understand the inner workings of the chip.

The Maniacbug library has some errors, I would suggest to use http://tmrh20.github.io/RF24/.

Alright, thanks a lot guys, I'll post back if I encounter any issues with the tutorial.

Hi again, I tried the tutorial you posted but to no avail. It still doesn't connect and I don't know what the problem could be, is there a way I can add get debug info from that tutorial code?

Frostburn:
Hi again, I tried the tutorial you posted but to no avail.

Post the exact code that you have uploaded to your Arduinos.

Are you completely 100% sure that you are using the TMRh20 version of the RF24 library.

...R

I definitely know I’m using TMRh20’s version, as I actually deleted maniacbugs version.

I tried the tutorial code as well as the getting started on TMRh20’s library

This is the current one (the tutorial one)

// 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

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;
}

And the receiver:

// SimpleRx - the slave or the receiver

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.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);

    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;
    }
}

One thing to note. There was a moment where it was sort of working the TMRh20’s getting started code, where the transmitter would say it sent signals, and the receiver would just show a spam of receiving random numbers. While I think there was a connection of some sort, it didn’t seem like it was sending the correct data across (as when I disconnected one of them, the sending failed)

You say you have an Uno and a Nano. I don’t have a Nano and I wonder if there are any differences in the pin connections.

Which program is on each Arduino?

…R

I don't see a 'radio.stopListening' before the 'radio.write' in the sender sketch. Maybe that happens automatically with a 'write', but not sure.

I've moved sketches freely between an Uno, Nano, and Pro Mini without problems as long as the pin numbers are the same. They all use the 328P chip but the compiler needs to know which board you're using.

Arctic_Eddie:
I don't see a 'radio.stopListening' before the 'radio.write' in the sender sketch.

The sender is never in listening mode.

...R

But what mode is it in when not initialized?

I'm actually just using two Arduino Nanos now, I'm pretty sure they function the same, as they give me the same debug as my previous Uno. So I think which code I put on which wouldn't matter.

EDIT: Typo

If you are using 2 Nanos it does not matter which has which program.

Has the Nano the same 3.3v supply as the Uno? Or they running completely on 3.3v? The nRF24s can use a lot of power (briefly) when transmitting.

Have you got 10µF capacitors across Vcc and Gnd for the nRF24?

...R

I'm using a separate 5v battery, with a 3.3 voltage regulator, 100uf on the voltage in, and 10uf on the voltage out, which I tested with a voltmeter to be 3.3v. I am powering both modules from that single voltage out, should I not do that and put 10uf capacitors on each module on its own?

A capacitor between 2 and 10 µF directly on the module pins worked best for me.

Often even powered by the 3.3V provided by my Nano-clones.

Thank you so much for all your help, after some tinkering, I finally got it fully working using the Nano's 3v3 output, I can't thank you enough for that suggestion. One final question, when I wire the NRF's up using an external voltage regulator it doesn't seem to work, even though I know the output is 3.3v, is there a special way of wiring it when using an external power source? I say this as I want to use the high power modules, which I've been told won't work of the Nano.

Frostburn:
One final question, when I wire the NRF’s up using an external voltage regulator it doesn’t seem to work,

Without seeing a diagram showing all the connections how can we comment?

A photo of a simple pencil drawing will probably be best - please don’t use Fritzing or send a photo of your hardware.

…R

Sorry for the delayed response, but I tried my best, please excuse the lack of quality

(http://i.imgur.com/HjWWbVL.jpg) If it’s too small

If anything is too obscure, I can provide details.

I can't see anything wrong with your wiring. I have had my nRF24 working with an almost identical setup.

What regulator chip are you using?

I am using an LD33 which I believe is identical to an LD1117. I have a 0.1µF cap across 5v and GND and 10µF across 3.3v and GND as recommended in the LD1117 datasheet. I think I also had a µF cap across Vcc and GND for the nRF24

...R

“Does not work” is a miserable description of the malfunction of a complex wireless 2 Arduino system.

The small capacitor should be as close to the nRF chip as possible,
looking at your drawing it seems you don’t place them there.