1

I am having trouble getting this module to work using the tmrh20 lib. I am using these modules with two arduino mega and a 3.3V external power supply. I also placed 10 uF in parallel with the modules power pin. I would really appreciate any comments or suggustions.

In the code below all I am trying to do is turn on a led. Here are my pin assignment for both arduinos CE -> 7 CSN -> 8 SCK -> 52 MOSI -> 51 MISO -> 50 IRQ -> unconnected

Transmitter

//#include <DigitalIO.h>
#include <SPI.h>
#include "RF24.h"
#include <printf.h>
RF24 radio(7,8);
const uint64_t pipe = 0xE8E8F0F0E1LL;
unsigned long msg = 375983;

void setup() {
    Serial.begin(115200);
    printf_begin();
    Serial.println("Transmitter");
    pinMode(9, INPUT);
    radio.begin();
    radio.setChannel(108);
    radio.openWritingPipe(pipe);
    radio.startListening();
    radio.printDetails();
}

void loop() {
  radio.stopListening();
  if (digitalRead(9) == HIGH)
  {
    while (!radio.write(&msg, sizeof(msg))){
      radio.write(&msg, sizeof(msg));
}
  Serial.println("Sending.....");
  }
  else {
    Serial.println("Awaiting Input....");
  }
  delay(500);

}

print detail report

STATUS = 0xff RX_DR=1 TX_DS=1 MAX_RT=1 RX_P_NO=7 TX_FULL=1
RX_ADDR_P0-1 = 0xffffffffff 0xffffffffff
RX_ADDR_P2-5 = 0x7f 0xff 0x7f 0xff
TX_ADDR = 0x0000000000
RX_PW_P0-6 = 0xff 0x7f 0xff 0x7f 0xff 0xff
EN_AA = 0xff
EN_RXADDR = 0xff
RF_CH = 0xff
RF_SETUP = 0xff
CONFIG = 0xff
DYNPD/FEATURE = 0x7f 0xff
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = Disabled
PA Power = PA_MAX

Receiver

//#include <DigitalIO.h>
#include <SPI.h>
#include "RF24.h"
#include <printf.h>
RF24 radio(7,8);
const uint64_t pipe = 0xE8E8F0F0E1LL;
unsigned long msg;

void setup() {
    Serial.begin(115200);
    printf_begin();
    Serial.println("Receiver");
    pinMode(9, OUTPUT);
    radio.begin();
    radio.setChannel(108);
    radio.openReadingPipe(0,pipe);
    radio.printDetails();

}

void loop() {
   radio.startListening();
   digitalWrite(9, LOW);
  if(radio.available()){
    while(radio.available())
    {
    radio.read(&msg, sizeof(msg));
    Serial.println("Incoming...");
    delay(500);
    Serial.println(msg);
    }
  }
  else{
    Serial.println("No Msg");
  }
  radio.stopListening();
  Serial.println(msg);
  if (msg == 375983){
    digitalWrite(9, HIGH);
    Serial.println(msg);
  }
  delay(500);
}

print detail report

STATUS = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1 = 0x0000000000 0x0000000000
RX_ADDR_P2-5 = 0x00 0x00 0x00 0x00
TX_ADDR = 0x0000000000
RX_PW_P0-6 = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA = 0x00
EN_RXADDR = 0x00
RF_CH = 0x00
RF_SETUP = 0x00
CONFIG = 0x00
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = Disabled
PA Power = PA_MIN

UPDATE: Transmitter PrintDetail

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

Results form tmrh20 Getting Started Example

First Arduino

Sent 8340224, Got response 0, Round-trip delay 547172 microseconds
Now sending
Sent 9889124, Got response 0, Round-trip delay 511072 microseconds
Now sending
Sent 11401920, Got response 0, Round-trip delay 43348 microseconds
Now sending
Sent 12446992, Got response 0, Round-trip delay 635580 microseconds
Now sending
Sent 14084352, Got response 0, Round-trip delay 1620788 microseconds
Now sending
Sent 16706968, Got response 0, Round-trip delay 1227548 microseconds
Now sending
Sent 18936340, Got response 0, Round-trip delay 145372 microseconds

Second Arduino

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

The second arduino is not printing anything on the serial monitor, no matter what I enter.

  • Bad wiring. Double, no, triple check the wiring and modules. – Avamander Mar 13 '16 at 14:18
  • 1
    The output on both the transmitter and the receiver clearly state the nRF24 module are not properly connected and the SPI is not communicating with it. – Roberto Lo Giacco Apr 3 '16 at 22:39
1

(not enough point to comment, so here's a potential answer) I had enormous troubles getting these things to work reliably. I tried all kinds of caps over the power supply. In the end I went for a 1$ piggy back board that takes 5v input and regulates to 3.3V. It also has the right pin female header to fit the nfr nicely. Since then I've had no issues. I also did a bit of experimentation and found that the RX side was the side giving problems.

  • Number one reason they don't work is bad wiring, wrong CE/CSN or whatever and they don't work. – Avamander May 8 '16 at 13:25
  • Well, in my case I checked the wiring several times. After obtaining the 3.3v boards, I did extensive testing to see what factor made the difference. My results are noted above. Whilst your mileage might vary, my tip for those still having issues is to try using these boards. – mjk May 10 '16 at 4:44
  • Yes that is one way. But it's easier to decouple with 1000uF electrolytic capacitor. Just as I did when I found my Mega's regulator noisy. – Avamander May 10 '16 at 7:18
  • At first I tries this too, using different cap sizes, including 1000uF, but to no avail.I know that filter caps are often suggested, and maybe often work, but these boards did the trick for me. – mjk May 14 '16 at 6:42
0

Try these:

  • Set pin 9 on the TX side as a pulled-up input i.e. pinMode(9, INPUT_PULLUP); Connect one end of the switch to GND and the other to pin 9. Then in your code, test for a button press like this: if (digitalRead(9) == LOW){...}
  • Use a byte array for holding the address instead of the 64-bit int you're using.
  • Remove the stopListening() call in your RX loop(); there is no need for it since all its doing is receiving.
  • Remove the 500 ms delays in the RX loop() just in the unlikely case that its causing you to lose bytes
  • I have implement the changes you suggested. Still does not work. – guow3 Mar 8 '16 at 20:01
  • @guow3 any changes in printDetails()? Update your post if there are any changes. I also forgot to include something in my answer. Editing now... – TisteAndii Mar 8 '16 at 20:09
  • Only the transmitter printdetail report changed. The receiver remained the same. – guow3 Mar 8 '16 at 21:33
  • @guow3 have u tried using the library examples? If they work, then modify them to send your long integer instead – TisteAndii Mar 8 '16 at 21:40
  • 1
    The output on the receiver clearly states the nRF24 module is not properly connected and the SPI is not communicating with it. – Roberto Lo Giacco Apr 3 '16 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.