2 XNRF24l01( communication problem)

Hello,

I found my self stuck with this problem and I think its hardware problem but before buying new one
I would like to be sure its hardware problem. So its goes.

This code:

/*This sketch receives 2 analog values through an nRF24L01 wireless module.
 */
 
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
 
int joystick[1];
 
RF24 radio(9,10);
const uint64_t pipe[] = {0xE8E8F0F0E1LL,0xF0F0F0F0D2LL};
 
void setup(void)
{
  pinMode(4,INPUT);
  pinMode(2,OUTPUT);
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(1,pipe[1]);
  radio.openWritingPipe(pipe[0]);
  radio.startListening();
  radio.printDetails();
}
 
void loop(void)
{
  if(digitalRead(4)==1){
    radio.stopListening();
    Serial.println(digitalRead(4));
    joystick[0]=1;
   
   bool ok = radio.write(joystick,sizeof(joystick));
   
   if (ok)Serial.println("OK");
   else Serial.println(" Nije ok");
   
   
    radio.startListening();
   delay(100);}
    
  if ( radio.available() )
    {
     radio.read( joystick, sizeof(joystick) );
      if(joystick[0]==1){
       if(digitalRead(2)==1)digitalWrite(2,LOW);
       else digitalWrite(2,HIGH);}
     
       Serial.println(joystick[0]);
    }
  else
    {
    Serial.println("No radio available");
    }
     delay(50); 
}

Is uploaded to UNO (1).

And this code is uploaded to UNO(2).

/*This sketch receives 2 analog values through an nRF24L01 wireless module.
 */
 
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
 
int joystick;
 
RF24 radio(9,10);
const uint64_t pipe[] = {0xE8E8F0F0E1LL,0xF0F0F0F0D2LL};
 
void setup(void)
{
  pinMode(4,INPUT);
  pinMode(2,OUTPUT);
  Serial.begin(9600);
  radio.begin();
  radio.setRetries(15,15);
  radio.openReadingPipe(1,pipe[0]);
  radio.openWritingPipe(pipe[1]);
  radio.startListening();
  radio.printDetails();
}
 
void loop(void)
{
  
  
    if(digitalRead(4)==1){
    radio.stopListening();
    Serial.println(digitalRead(4));
    joystick=1;
    
   bool ok = radio.write(&joystick,sizeof(joystick));
   
   if (ok)Serial.println("OK");
   else Serial.println(" Nije ok");
   
   radio.startListening();
 delay(100);}
    
  if ( radio.available() )
    {
     radio.read( &joystick, sizeof(joystick) );
    if(joystick==1){
       if(digitalRead(2)==1)digitalWrite(2,LOW);
       else digitalWrite(2,HIGH);}
       Serial.println(joystick);
    }
  else
    {
    Serial.println("No radio available");
    }
     delay(50); 
}

Problem is that UNO(1) cant see transmit information from UNO(2).
How do I check is UNO(2) transmitting at all? Or any other solution?

Thank you for reading.

Quick question... have you confirmed your wiring is all OK by running the ping pair example? Have you got 10uF capacitors across the power of the NRF24L01s?

this is what i get :frowning:

àÿ€‹’×þ×m:Jÿ‡oëËÿ9Æ!Pú§òÁÿ9ê†Eÿ™n–Ëÿ+ÎóPú¼²×üê†ÿ€AÃ×þ)Æ!Pú¥ÂÿÿêÆeÿ ’kÿ×méÿ‡Oéÿê†eÿ™î–ªÿêÆeÿ‡OÒËÿ–œñPú‡‡Òÿ9Æ Pú‡aéüê†eÿ€K’9ÿkäppø‰n–ªÿ×ié9ü™n–ÿ*ÎóPú‡‡Ò9üêàÿSùÝý9ê†Nÿ”Ñ—×ý9ê†Nÿ[Øù×ý×méü‰î’-ÿ×ié9ü€Û’ªÿkä0púÇo–-ÿ)Æ!Pú‡GòËÿ×ié9ü ’)ÿ*ÎóPú‡‡Öÿ-Æ¡Pú‡GÒÿ×méÿ O’ªÿ×m:Jÿ€I—×þ†¤ñpú: îÿêàÿ» ùkÿÊàpú› Ç×üÊàpú¸îÝý9ê†Nÿ”ƒñ×þ×méÿ”Ñ—kÿ×ié9ü ÏË9ÿ*΁Pú¸î×ü×ié9ü€Û’kÿ9Ç0pú‡ÏÉÿ–œñPú¸îÝý9Æ Pú Ÿ’kÿ)Æ!PúÇï–Ãÿ9Æ Pú‡o’«ÿ9Æ!Pú‡ÏÒ9ü×iéü [’9ÿ–¤ñpú¸Cìÿ9Æ Pú™n’9ÿÊàpú:ÇÝý–œñpú:Ïÿ9Ç pú Ÿ’ÿ–œñPú§ƒòÃÿ–œñPú‡GÒÿêà«ÿ:ˆîÿ9ê†Eÿ [’«ÿÊápú¼²ÿ×m:jÿ ú)ÿ*΁Pú‡Oɪÿ×ié1ü ’9ÿ×méÿSHù×ü–¤ñpú§ëÿ†¤ñpú§Ãëü–œñPúÇo’«ÿ–œñPú
´Î©’6'F pèñp:§ä¨
(*ö`(aÆ(:b¦D@CB“Xp b€ ÊqM:¡0b`Ä46à‡Ab D¢hdý÷ùáòúðÁáòÚõÁaòÿû‘óòXÓòÛP÷úñª@óXÓòÛ@÷
int joystick[1];

Why? A one element array offers no advantage over a scalar variable.

Why is the type int when the values to be held are 0 or 1?

Tried everything i could 've think of...Array,integer ...I'm planning to transmit bigger array but for now size 1 is ok for testing.

Just to mention codes are almost the same except for addreses for radio pipes. I tried switching codes between arduinos but same problem with same arduino UNO R3. The other one is UNO R2.

Is it possible that problem is in the libraries because it is working fine on R2 but not on R3.

Looks like you are getting garbage out of the serial monitor which would indicate a speed ore settings mismatch.

Did you try to get the ping pair working? Once you have that, you know most of the hard ware works. Then try reading your joystick to serial, once that works, send over the wireless devices.

Arduino UNO R3 is not transmitting in any case, tried all of them.
UNO R2 works perfectly. I guess i'll try to get another one and try with it. Will post if got any changes.

Have you tried it with the ping pair example? Have you checked your serial com settings against your sketch? (As in have you checked the serial monitor is also set to 9600?)

Ping pair is not working since i cant get R3 version to transmitt data.

Serial communication is working on both versions.

Im rechecking everthing for 20th time hoping to find something :slight_smile: Thanks for ideas where to look.

Well, you need to get ping pair working first.... Otherwise we could spend days looking at code that can't work because the hardware doesn't!

Make sure you have a 10uF capacitor across the power of the NRF24L01s.

220uF worked best for me.. No less than 100uF because the 3.3V Arduino source is a most poor 3.3V supply, At best.

Doc

@Docedison Interesting. I got 30 feet with the 10uF. How far did you get with 220uF? I also powered it with a 3 amp switching power regulator, and needed at least a 10uF on the power lines, possibly to remove noise on the power lines.

I have 100uF on both, changed microcontrollers, still same problem.
It is either bad reception on one side or bad transmition on the other side.

Using UNO R2 platform as transmitter, packets are recieved on UNO R3 platform, but not the other way.

Where do i need more power? While transmitting or recieving?

That is odd... They are both UNOs?

If you are using the ping pair example, you are grounding pin 7 on one of them? So if you swap which pair has the grounded pin, it stops working?

If so, set a different pin as the selection pin and try it again.

Are the antenna's at least 1 meter apart..
Were you able to pass the basic ping pair test after cycling power?
There is a Gotcha that you would have found in the purpose of the role pin, Had you spent the time to Google the project or for that matter searched the Arduino Data Base first...

...

What is the Gotcha? I got the ping pair working without issue.

I did ping pong test and this is what i get:

  1. UNO R3 in ping state and UNO R2 in pong state:

Serial output on UNO R3:

Got response 164969, round-trip delay: 4294819183

Now sending 17857...failed.

Failed, response timed out.

Now sending 19729...failed.

Failed, response timed out.

Now sending 21600...failed.

Failed, response timed out.

Now sending 23470...failed.

Got response 172449, round-trip delay: 4294819177

Now sending 25331...failed.

Got response 174319, round-trip delay: 4294819176

Now sending 27199...failed.

Got response 176190, round-trip delay: 4294819173

Now sending 29069...failed.

Failed, response timed out.

Now sending 30939...failed.

Failed, response timed out.

Now sending 32808...failed.

Failed, response timed out.
  1. switch postitions:

serial output on UNO R2:

Failed, response timed out.

Now sending 37730...failed.

Failed, response timed out.

Now sending 39600...failed.

Failed, response timed out.

Now sending 41469...failed.

Failed, response timed out.

Now sending 43339...failed.

Failed, response timed out.

Now sending 45209...failed.

Failed, response timed out.

Now sending 47080...failed.

Failed, response timed out.

Now sending 48951...failed.

Failed, response timed out.

Now sending 50821...failed.

Failed, response timed out.

Now sending 52690...failed.

Failed, response timed out.

not even one succesfull transmition.

Something is wrong there. Can you send a picture of the wiring?

Rechecking for I dont know which time :slight_smile:

UNO R2:

nrf pin 1 (GND) --> arduino gnd
nrf pin 2(+3.3V) --> arduino 3.3V
nrf pin 3(CE) -->arduino digital 9
nrf pin 4(CSN) -->arduino digital 10
nrf pin 5 (SCK) -->arduino digital 13
nrf pin 6(MOSI) -->arduino digital 11
nrf pin 7(MISO) -->arduino digital 12

UNO R3:

nrf pin 1 (GND) --> arduino gnd
nrf pin 2(+3.3V) --> arduino 3.3V
nrf pin 3(CE) -->arduino digital 9
nrf pin 4(CSN) -->arduino digital 10
nrf pin 5 (SCK) -->arduino digital 13
nrf pin 6(MOSI) -->arduino digital 11
nrf pin 7(MISO) -->arduino digital 12

that is not quite the same as a picture...