NR24L01 problem when uses signal

You are jumping about all over the place too fast for me. You have not responded to my Reply #37

...R

The first bit was to clear most of the messages, so in case it received to many at time, it would not freeze with so many messages. The second is to create a delay to reduce the speed of the messages that are sent. I am trying to solve on problem at the time and right now the modules are not functional at all. I developed a small program to test the modules and it is giving me an output that it was not suppose to.

ddmdavid01:
The first bit was to clear most of the messages, so in case it received to many at time, it would not freeze with so many messages.

How could there be too many messages unless your Command code is inappropriate?

You have to design the code for the Command unit and the Car unit as a pair. Get the Command unit to send messages at a reasonable frequency.

The second is to create a delay to reduce the speed of the messages that are sent.

But that code is on the Car unit - why is it sending any messages?

I can't help feeling the main problem with your project is that you have not spent enough time thinking about how it should work and have dived into the details of programming much too soon. The logic of reliable communication can be thought out without needing to know anything about programming.

...R

Look I had a problem in the past and what happened was that if I put the robot to move continuosly, let's 20 seconds the connection would be lost and I had to switch off and on the robot to get back controll. Those bits were the ones which solved the problem and allowed me to have a reliable connection and keep controll. But right now I am just worried with the fact that my modules are not working anymore and do not know why!

When I cool down after realizing you were double posting I might look at this Thread again - but don't bank on it.

...R

Again, the problem is different I changed to another topic. Sorry for your confusion.

Hey Robin2.

Today I obtained new NRF24L01 modules in order to understand and changed the CE and the CSN pi, using the program in your tutorial (the first one). Here are the codes:

Of the UNO:

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

Of the mega:

// SimpleRx - the slave or the receiver

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

#define CE_PIN 9
#define CSN_PIN 53

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

The output of the receiver (the UNO) is this:

SimpleTx Starting
Data Sent Message 0  Tx failed
Data Sent Message 0  Acknowledge received
Data Sent Message 1  Tx failed
Data Sent Message 1  Acknowledge received
Data Sent Message 2  Tx failed
Data Sent Message 2  Acknowledge received
Data Sent Message 3  Tx failed
Data Sent Message 3  Acknowledge received
Data Sent Message 4  Tx failed
Data Sent Message 4  Acknowledge received
Data Sent Message 5  Tx failed
Data Sent Message 5  Acknowledge received
Data Sent Message 6  Tx failed

And one more thing is that the module in the mega gets really hot, even the new ones. Do you have any idea of what is happening?

Note:I am so sorry again. I thought that I had posted the last code, but no this was the previous one, thanks @Robin2.

ddmdavid01:
And one more thing is that the module in the mega gets really hot, even the new ones. Do you have any idea of what is happening?

You need to post a clear diagram (not Fritzing) showing exactly how you have everything connected.

The only time I had an nRF24 get hot it proved to have a complete short circuit between its Vcc and GND - in other words it was completely useless. But I have only had that one failure out of about 20 units.

...R

ddmdavid01:
the module in the mega gets really hot, even the new ones.

The fastest method to get them hot is to supply them with more than 3.3V,
did you measure the voltage on the NRF's VCC?

I used the 3.3 v, but unfortunately I do not have my multimeter to measure the voltage. Meanwhile I was gone some things happened. I changed the CE and the CSN pin and this is the current schematic:

For the mega:

Vcc => 3.3 v
Gnd => Gnd
CE => 9
CSN => 53
SCK => 52
MOSI => 51
MISO =>50

For the uno:

Vcc => 3.3 v
Gnd => Gnd
CE => 9
CSN => 10
SCK => 13
MOSI =>11
MISO => 12

Now it does not get hot, but the output is still the same. I think it is the arduino.

ddmdavid01:
For the mega:

Vcc => 3.3 v
Gnd => Gnd
CE => 9
CSN => 53
SCK => 52
MOSI => 51
MISO =>52

?

I am so sorry I got it wrong I already changed to the real schematic.

I did not know if you (Robin2) wanted this but this is the best I got.

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

Sorry, I can't read it. There is no need to list all the unused Mega pins.

...R

Here it is I hope this is better.

I just ask one thing, if you can not find answer it is fine, you already gave a lot of help and I appreciate that. I honestly think it is the arduino, considering that I used the same code over and over and have replaced the nRF24L01 and it still does not have a connection. I will replace it and report results.

In light of Reply #50 it would be nice to see the actual code that you uploaded to the Mega. And the output it produces.

Also, it seems like you edited Reply #49 in response to Reply #50. It would have been nice if you had acknowledged @Whandall's input by adding a note in Reply #49 to say that you had changed it.

...R

The code uploaded is in the post 46. It is still the same. I am sorry for not responding that I changed it, but I forgot then I thought on putting a respind but, because the 5 minute thing I forgot to post, but thanks Whandall

ddmdavid01:
The code uploaded is in the post 46. It is still the same.

Thanks.

In your Reply #49 you say that you are using Pins 9 for CE and 53 for CSN on the Mega, but your program code is using pins 7 and 8.

Because this is going on so long I am getting muddled between this and another Thread.

I can't recall if you have said whether you have managed to get communication working reliably between your Mega and your Uno just using my example code with nothing added and no changes apart from whatever is essential for the Mega.?

...R

I forgot to change the pins in the code given (thanks @Robin2 for the advise) I should have added a reply. I changed the pins in a desesperated atempt to put it working again, but I still have the same output. I honestly think there is something wrong with the arduino mega.