Using my NRF24 module!

Hi

I am using a NRF24 module and I want it to transmit some data like "Hello World" and other messages like that. But it doesn't seem to work. I attached the nrf24 to 2 arduino (mega, adafruit Metro/Uno). But the message doesn't seem to go through. Then I tried running Robins Test run and I found out that the Nrf24 transmitting module does work and the Nrf24 module on the receiver end works too. So I think there is a problem with the code. So do you know what is wrong with the code. i am going to link both the transmitter and receiver down below.

Transmitter code

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

RF24 radio(7, 8); // CE, CSN

const byte address[6] = "00001";

void setup() {
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
}

void loop() {
const char text[] = "Hello World";
radio.write(&text, sizeof(text));
delay(1000);
}

Receiver Code

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

RF24 radio(7, 8); // CE, CSN

const byte address[6] = "00001";

void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
}

void loop() {
if (radio.available()) {
char text[32] = "";
radio.read(&text, sizeof(text));
Serial.println(text);
}
}


<small>Code language: Arduino (arduino)</small>

Two things:

1.) RE-Edit your first posting that your code is presented as a code-section

2. read this nrf24 tutorial

best regards Stefan

I will take a SWAG and say it sounds like a power supply problem to me. I would guess the Arduino not an external power supply powers the nRF24L01. A Power Supply the Arduino is NOT!

I tried your code the 2 Unos with rf24 radio modules attached that I use for development. The code works fine.

Is that the connection diagnostic sketch, CheckConnection.ino?

Can you post clear photos of your wiring and a schematic.

Make sure the rf24 power supply can provide enough current. This is especially true for the high power (external antenna) modules. I use homemade adapters like these. They are powered by 5V and have a 3.3V regulator on the board. Robin2 also has suggested trying with a 2 AA cell battery pack.

If using the high powered radios make sure to separate them by a few meters. They may not work too close together. Try the lower power settings.

Reset the radios by cycling power to them after uploading new code. I have found that to help. They do not reset with the Arduino.

1 Like

I tried this but it didn't work

@groundFungus

I tried doing what you suggested but nothing seems to work.

I don't have my nrf24 modules with me right now but I will send a pic when i get them

hi I finally got my nrf24 to work all you need to do was to push the SPI Pins down.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.