Go Down

Topic: [Need Assistance] Can't make communication between two NRF24L01+PA+LNA modules (Read 204 times) previous topic - next topic

atsvetanov

I tried a few tutorials, but I didn't manage to do anything.

My setup is:

1x Uno
1x Nano
2x NRF24L01+PA+LNA
2x nrf24l01 adapter modules
1x USB HUB for the upload and reading serial outputs on both COMS.

Wiring on both is the same:

CE -> D9
CSV -> D8
SCK -> D12
MO -> D11
M1 -> D10
VCC -> 5V
GND -> GND

Code used:

For Transmitter (Nano)
Code: [Select]
//Include Libraries
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

//create an RF24 object
RF24 radio(9, 8);  // CE, CSN

//address through which two modules communicate.
const byte address[6] = "00001";

void setup()
{
  radio.begin();
 
  //set the address
  radio.openWritingPipe(address);
 
  //Set module as transmitter
  radio.stopListening();
}
void loop()
{
  //Send message to receiver
  const char text[] = "Hello World";
  radio.write(&text, sizeof(text));
 
  delay(1000);
}


For Receiver (Uno)
Code: [Select]
//Include Libraries
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

//create an RF24 object
RF24 radio(9, 8);  // CE, CSN

//address through which two modules communicate.
const byte address[6] = "00001";

void setup()
{
  while (!Serial);
    Serial.begin(9600);
 
  radio.begin();
 
  //set the address
  radio.openReadingPipe(0, address);
 
  //Set module as receiver
  radio.startListening();
}

void loop()
{
  //Read the data if available in buffer
  if (radio.available())
  {
    char text[32] = {0};
    radio.read(&text, sizeof(text));
    Serial.println(text);
  }
}


Both uploads are OK, but I don't get anything on the receiver COM output.

My aim is for the complete the first step: one module to send a message and the other one to receive it.

I'm still learning basics, so I though, I should ask the experts for help, thank you in advance.

Robin2

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.

A common problem with nRF24 modules is insufficient 3.3v current from the Arduino 3.3v pin. This seems to be a particular problem with the nano. The high-power nRF24s (with the external antenna) will definitely need an external power supply. At least for testing try powering the nRF24 with a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.

If you are using the high-power nRF24s (with the external antenna) make sure there is sufficient distance between the two nRF24s so that the signal does not overwhelm the receiver - try 3 metres separation. If you are new to nRF24s it may be better to start with a pair of low power modules with the pcb antenna.

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

atsvetanov

Hey, I had a lot of work and I could not retry testing, but I'm up for some new results.
I tried new wiring from the thread given above, plus new code, but nothing successful.

This time my setup is:
2x Nano
2x NRF24L01+PA+LNA
2x nrf24l01 adapter modules
1x USB HUB for the upload and reading serial outputs on both COMS.


My wiring is:
CE -> D9
CSN -> D10
SCK -> D13
MO -> D11
M1 -> D12
VCC -> 5V
GND -> GND


I tried the connection code, here is the output:

Same result on both pairs:
Code: [Select]
13:57:11.366 -> CheckConnection Starting
13:57:11.366 ->
13:57:11.366 -> FIRST WITH THE DEFAULT ADDRESSES after power on
13:57:11.434 ->   Note that RF24 does NOT reset when Arduino resets - only when power is removed
13:57:11.504 ->   If the numbers are mostly 0x00 or 0xff it means that the Arduino is not
13:57:11.606 ->      communicating with the nRF24
13:57:11.640 ->
13:57:11.640 -> STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
13:57:11.707 -> RX_ADDR_P0-1 = 0xe7e7e7e7e7 0x4141417852
13:57:11.741 -> RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
13:57:11.775 -> TX_ADDR = 0xe7e7e7e7e7
13:57:11.809 -> RX_PW_P0-6 = 0x00 0x20 0x00 0x00 0x00 0x00
13:57:11.877 -> EN_AA = 0x3f
13:57:11.877 -> EN_RXADDR = 0x03
13:57:11.912 -> RF_CH = 0x4c
13:57:11.912 -> RF_SETUP = 0x07
13:57:11.946 -> CONFIG = 0x0e
13:57:11.946 -> DYNPD/FEATURE = 0x00 0x00
13:57:11.981 -> Data Rate = 1MBPS
13:57:12.015 -> Model = nRF24L01+
13:57:12.015 -> CRC Length = 16 bits
13:57:12.050 -> PA Power = PA_MAX
13:57:12.085 ->
13:57:12.085 ->
13:57:12.085 -> AND NOW WITH ADDRESS AAAxR  0x41 41 41 78 52   ON P1
13:57:12.153 ->  and 250KBPS data rate
13:57:12.153 ->
13:57:12.153 -> STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
13:57:12.220 -> RX_ADDR_P0-1 = 0xe7e7e7e7e7 0x4141417852
13:57:12.289 -> RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
13:57:12.323 -> TX_ADDR = 0xe7e7e7e7e7
13:57:12.357 -> RX_PW_P0-6 = 0x00 0x20 0x00 0x00 0x00 0x00
13:57:12.392 -> EN_AA = 0x3f
13:57:12.392 -> EN_RXADDR = 0x03
13:57:12.392 -> RF_CH = 0x4c
13:57:12.427 -> RF_SETUP = 0x27
13:57:12.427 -> CONFIG = 0x0e
13:57:12.461 -> DYNPD/FEATURE = 0x00 0x00
13:57:12.495 -> Data Rate = 250KBPS
13:57:12.495 -> Model = nRF24L01+
13:57:12.530 -> CRC Length = 16 bits
13:57:12.564 -> PA Power = PA_MAX
13:57:12.564 ->
13:57:12.564 ->


BTW. 
They are separated from each other about 20 cm.
I've plugged them both in one usb hub, so I can read both serial monitor.
Is that a problem?

Robin2

BTW.
They are separated from each other about 20 cm.
I've plugged them both in one usb hub, so I can read both serial monitor.
Is that a problem?
Your connection test shows that communication is working properly.

Having two Arduinos with nRF24s connected to the same PC is not a problem.

It may be a problem having the two high-power nRF24s so close together - but I don't have any personal experience with them. My projects are all short-range projects with the low-power nRF24s with the PCB antennas.

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

atsvetanov


Actually I moved a bit the antennas and it started working. Lol.
Overall, I used the first "simple tx & rx" code from your thread.
Back in rails, thanks for the support.

Robin2

Actually I moved a bit the antennas and it started working. Lol.
I am curious to know how far you needed to separate the antennas to get the system working.

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

Go Up