Intermittent nrf24l01+ traffic with RF24

I am struggling with the getting started example in the RF24 lib and cannot track down the source of the problem.

I have one Uno R3 and one Diecimila and two NRF24l01+ with chip antennas. I have soldered a 10uF capacitor between the ground and Vcc on both NRF24l01 and connected the directly to the Arduinos. I have used both USB power and external battery powered input for the Arduinos. I have checked that the Voltage is 3.3 V on the radios. I have turned of my wifi to exclude that interference.

A couple of days ago I actually got this example to work with exactly the same hardware but now I see this behavior:

  1. Switch A (UNO) to Transmitter: Now Sending 50125...failed Failed, response timed out Nothing gets out from the radio...

  2. Switch UNO to Receiver, Switch Diecimila (B) to Transmitter: First two messages sending OK, response OK, roundrip delay 23 and 25 Then: Sending fails, but Uno gets messages and responds, but the response is not received in Diecimila. A few transmits are successful.

Now sending 54467...failed. Failed, response timed out. Now sending 55744...ok...Failed, response timed out. Now sending 56962...failed. Failed, response timed out.

Any clues?

Hi

I found a 47uf capacitor was needed.

Regards

Phil

Hi, Did you try any smaller capacitor like 10uf before using the 47uf capacitor?

Regards Nicklas

Hi

Yes I tried several combinations of capacitor, I think it depends on the power supply and the voltage reg in use as to how well it deals with the power demands as they have to react very quickly.

10uf and 22uf often meant the transmission didn't work, 47uf and it worked 100% for me. A 100uf is probably a safe value if using unknown brands and to give a bit of leeway to the cap degrading over time.

It really depends on the voltage source. To rule it out, got for at least a 100uf, if problems still persist it probably isn't a power supply problem, but make sure you use a good quality 100uf as an older one I tried had aged too much and didn't work.

Regards

Phil

Follow up:
Using 100uF capacitors worked as a charm!

I still have a weird problem with the RF24 lib. In order to transmit successfully I have to call radio.startListening() between sending. Without that call, transmit always fails. Has anyone seen this before?

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

const int PHOTO_RESISTOR=0;  //PHOTO_RESISTOR on Analog Pin 0

int val = 0;      //variable to hold the analog reading from the PHOTO_RESISTOR
int previousVal = 0;
const int detectLimit = 60;
const int lowLimit = 1;
const int LED = 7;
const int BUTTON = 2;

// Radiostuff
#define CE_PIN   9
#define CSN_PIN 10
/*-----( Declare objects )-----*/
RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };


void setup()
{
  Serial.begin(57600);
  pinMode (LED, OUTPUT);
  digitalWrite(LED, HIGH);
  delay(3000);
  digitalWrite(LED, LOW);
  radio.begin();
  // optionally, increase the delay between retries & # of retries
  radio.setRetries(15,15);
  // improve reliability
  radio.setPayloadSize(8);  
  radio.setDataRate(RF24_250KBPS);
  radio.openWritingPipe(pipes[0]);
  radio.openReadingPipe(1,pipes[1]);
  radio.startListening();
}

void loop()
{
  val = analogRead(PHOTO_RESISTOR);
  if(previousVal <= lowLimit && val > detectLimit)
  {
    radio.stopListening();
    // Pulse detected - blink diod
    digitalWrite(LED, HIGH);
    bool ok = radio.write(&val, sizeof(int) );
    // Take the time, and send it.  This will block until complete            
    if (ok)
      Serial.println("ok...");
    else
      Serial.println("failed.\n\r");
      radio.startListening();
  }
  else if(val <= lowLimit)
  {
    digitalWrite(LED, LOW);
  }
  previousVal = val;

  delay(5);
}