Go Down

Topic: NRF24L01 not sending properly - need hints / ideas (Read 804 times) previous topic - next topic

devdave

Jun 09, 2019, 10:54 pm Last Edit: Jun 09, 2019, 11:04 pm by devdave
Hello Arduino - Community,

since some days I try to make my NRF24L01 Modules work but they do not seem to send data properly.
Sometimes data is sent and received correct, sometimes i'm receiving 0, sometimes data is received too late and sometimes it's just receiving bullshit. When I'm using the Example Library -> Getting Started sketch, it always tells me "sending failed".

I'm using an Arduino Mega as sender ( CSN -> PIN 7, CE -> PIN 8 ), an Arduino Uno as receiver ( CSN -> PIN 8, CE -> PIN 7 ). Additionally , I soldered a 10µf Capacitor to both modules.
I'm powering both from a laboratory power supply with 3.30V.

This are the current sketches i'm using. The RF24.h library i'm using is this one: https://github.com/maniacbug/RF24

SENDER
Quote
#include <NintendoExtensionCtrl.h>
#include <SPI.h>
#include "RF24.h"

RF24 radio(8, 7);
unsigned long msg;


ClassicController classic;

void setup() {
  Serial.begin(115200);
  classic.begin();

  while (!classic.connect()) Serial.println("Classic Controller not detected!");

  Serial.begin(115200);
  radio.begin();
  radio.openWritingPipe(0xF0F0F0F0AA);
  Serial.println("Ready");
}

void loop() {
  boolean success = classic.update();  // Get new data from the controller

  if (success == true) {  // We've got data!
    int speed = classic.triggerR();
    unsigned long pulse;

    pulse = (2500 / 27 * speed);

    Serial.println(pulse);

    radio.write(&pulse, sizeof(unsigned long));
  }

  else {
    Serial.println("Controller Disconnected!");
    classic.reconnect();
  }
}
RECEIVER
Quote
#include <SPI.h>
#include "RF24.h"

RF24 radio(7, 8);
unsigned long msg;

void setup() {
  Serial.begin(115200);
  radio.begin();
  radio.openReadingPipe(0,0xF0F0F0F0AA);
  radio.startListening();
  Serial.println("Listening");
}


void loop() {
  if (radio.available()) {
    radio.read( &msg, sizeof(unsigned long));
    Serial.println(msg);
  }
}
I seriously don't know how to make the modules work or what to try.
I thought about some interference from the wiring / Arduino itself so I used longer wires to minimize this risk. But got no success.

Does anyone has any ideas how to solve this?

Many thanks in advance!

David

Romonaga

First off. There are 2 RF24 libs in the wild.

I prefer this one. https://tmrh20.github.io/RF24/

9 times out of 10 the issue is wiring.
The universe exists only because we are aware of it.
We want a few mad people now. See where the sane ones have landed us!

Go Up