Go Down

Topic: Can't get nRF24L01 work. (Read 695 times) previous topic - next topic

alomar1997

Hi everbody,

I'm making a project in which two Arduino UNO are communicating via RF through the nrf24L01 modules. As I said, I have two Arduino UNO, a 1uF capacitor between GND-VCC on each module, an external power supply that gives 220VAC -- 3.3V 1A and I have used both popular libraries: TMR2h nrF24 an the normal one RF24-Master.

I'm not even trying to send/receive data because on the printDetails() I can clearly see that no addresses are given correctly due to it's values are fixed to 0x00 or even 0xff. As I read in a lot of forums It's suposed to be a pin connection but no way I tested and checked it many times. I'm a bit desperate because I've spent a lot of hours here and have no idea what else to check.

NOTE :
Initally I was following the tutorial https://www.youtube.com/watch?v=wlhuO82IZjQ&t=288s by Julian Ilett (I have the exactly the same connection pinout). The code I tested is the same in the video (the Joystick receiver/transmitter) but as long as It wasn't working I continued trying with basic example tests:

Maniacbuc library: https://github.com/maniacbug/RF24
Both codes attached.

The detailPrint() is:

/*******************/
RF24/examples/GettingStarted/

ROLE: Pong back

*** PRESS 'T' to begin transmitting to the other node

STATUS       = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1   

/********************/

Thanks.

alomar1997

Okay, now I've tried with the Arduino 3.3V and it seems that now I have (at least) an associated RX/TX address. The output on transmitter is:


RF24/examples/GettingStarted/

ROLE: Pong back

*** PRESS 'T' to begin transmitting to the other node

STATUS       = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1   

While on receiver:


RF24/examples/GettingStarted/

ROLE: Ping out

*** PRESS 'T' to begin transmitting to the other node

STATUS       = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1   


THANKS

youceforo

hello,

try this ( it is a good test).

make a at least 10 uf capacitor between vcc and ground .

alomar1997

I've recently started on this one: https://maniacbug.wordpress.com/2011/11/02/getting-started-rf24/. Same library same all. Detail print seem to be good at least but no way I have no idea why is printing the whole time:

*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK

Now sending 4045...failed.

Failed, response timed out.

Now sending 5747...failed.

Failed, response timed out.

Can you focus on this example as I think I'm going through the correct way? Otherwise I need more specific advertisments.

Btw, I just have a 22uF and a 47uF left. Would them be good for this purpose?

youceforo

hi,
if you have a chinese module you must use an extern alimentaion .you need a 3.3 v linaer regulator as  :
-AMS 1117 ,
-2000uf and 1000uf capacitors
 the first between  Vin and ground  and the second between  the Vout and ground .

I said you again don't test your nrf with sketh like a getting started ,if you want really know if your module work use the pratic test (boton and led)

Robin2

Have a look at this Simple nRF24L01+ Tutorial - the examples do work and they are as straightforward as I could make them.

It will be much easier to help if you try to get things going with code that I am familiar with.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

alomar1997

Hi Robin2,

I followed your tutorial earlier but now I've read it again and do it all again. Trying the SimpleTx/Rx.ino example the only thing I can see in output is: [SimpleRx Starting
]

Robin2

I followed your tutorial earlier but now I've read it again and do it all again. Trying the SimpleTx/Rx.ino example the only thing I can see in output is: [SimpleRx Starting
Post the actual code that YOU have uploaded to your two Arduinos and also post a photo of a pencil drawing showing how you have everything connected.
Post a sample of the output from both Arduinos.

Exactly what Arduinos are you using? Some of them don't have enough 3.3v power
Have you got 10µF capacitors across Vcc and GND for the nRF24s
Are you using nRF24s with the PCB antenna or the high-power version with the external antenna?

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

alomar1997

I post my code later. Here you have a brief schematic. Thanks!

alomar1997

Sorry, here you have the schematic attached. When it refers to the code it is the on you give me.

TX

Code: [Select]


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


RX
Code: [Select]


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


Thanks for your time.

Whandall

You can not supply the NRFs via a resistor voltage divider.

Ah, this is obviously some strange usage of the word 'safe' that I wasn't previously aware of. (D.Adams)

youceforo

this nrf power supply works very well for me

alomar1997

#12
Jul 18, 2017, 09:40 am Last Edit: Jul 18, 2017, 09:49 am by alomar1997
Hey, what about this regulator?

NOTE: Your 1117 regulator has a Vin of 5V and gives 3.3 or you have other input voltages.

Thanks and I hope this is the real problem.

youceforo

I don't know but if you will try it you must add high capacitors.

Robin2

People - please make your images visible on the forum so we don't have to download them - see this  Image Guide

Images from Reply #9















And from Reply #11



And from Reply #12




...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up