Arduino x nrf24+

Hello, im new to the Nrf24 modules my question is can the Arduino Leonardo run the Nrf24+ modul?

Info:
TX: Arduino Leonardo
RX: Arduino Nano (every)

TX code (just a test code):

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

RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001";

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

void loop() {
  const char text[] = "Hello";
  bool report = radio.write(&text, sizeof(text));
  
  if (report) {
    Serial.println("Message sent successfully");
  } else {
    Serial.println("Message sending failed");
  }
  
  delay(1000);
}

RX code (just a test code):

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

RF24 radio(9, 10); // 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] = {0};
    radio.read(&text, sizeof(text));
    Serial.println(text);
  } else {
    Serial.println("No message received");
  }
  
  delay(1000);
}

Welcome to the forum

Yes.

Which pins exactly have you got the module connected to ?

MISO PB3
MOSI PB2
SCK PB1
CE 9
CSN 10

+3,3v +10uf capazitor

Which pins, as marked on the Leo, is the module connected to ?

Yes, the Arduino can control it without a problem, but no, it should not be used to power it. Drawing more than 50 mA from the 3.3V pin can cause the onboard regulator to overheat or become unstable, potentially damaging the board. Use an external power source for powering devices that require more current. Check this link for more details: nRF24L01 – Arduino Interfacing, Circuits, Codes, PA + LNA
Power Stability Issues with RF24 Radio Modules

As described in the RF24 Common Issues Guide, radio modules, especially the PA+LNA versions, are highly reliant on a stable power source. The 3.3V output from Arduino is not stable enough for these modules in many applications. While they may work with an inadequate power supply, you may experience lost packets or reduced reception compared to modules powered by a more stable source.

Symptoms of Power Issues:

  • Radio module performance may improve when touched, indicating power stability issues.
  • These issues are often caused by the absence of a capacitor, a common cost-saving omission by some manufacturers.

Temporary Patch :

  • Add Capacitors: Place capacitors close to the VCC and GND pins of the radio module. A 10uF capacitor is usually sufficient, but the exact value can depend on your circuit layout.
  • Use Low ESR Capacitors: Capacitors with low Equivalent Series Resistance (ESR) are recommended, as they provide better power stability and performance.

Adding the appropriate capacitors can greatly improve the reliability of your RF24 module by ensuring a stable power supply, thus minimizing packet loss and enhancing overall performance. A separate power supply for the radios is the best solution.

There is no link to the part being used so I took a SWAG:
nRF24L01 Features
2.4GHz RF transceiver Module
Operating Voltage: 3.3V
Nominal current: 50mA
Range : 50 – 200 feet
Operating current: 250mA (maximum)
Communication Protocol: SPI
Baud Rate: 250 kbps - 2 Mbps.
Channel Range: 125
Maximum Pipelines/node : 6
Low cost wireless solution:

The Leonardo has this regulator: LP2985-33DBVR which is rated at 150mA. The 50mA limit sounds more applicable to some boards, e.g. Nano, where the 3.3v is derived from the USB UART chip.

ok, thx

the connections I used for a NRF24L10 to a Leonardo were

// Leonardo connections 
// Leonardo ICSP SCK  pin 15 to NRF24L10_pin SCK
// Leonardo ICSP MISO pin 14 to NRF24L10_pin MISO
// Leonardo ICSP MOSI pin 16 to NRF24L10_pin MOSI
// Leonardo pin 10 to NRF24L10 CSN
// Leonardo pin 9  to NRF24L10 CE
// Leonardo GND and 3.3V to NRF24L10  GND and VCC

it is a good idea after calling radio.begin() to check if the SPI connection worked

void setup() {
  Serial.begin(115200);
  delay(2000);
  Serial.println("\n\nLeonardo > NRF24L01 transmit text");
  radio.begin();
  if (radio.isChipConnected())
       Serial.println("Transmitter NF24 connected to SPI");
  else Serial.println("NF24 is NOT connected to SPI");

have a look at nrf24l01-not-working-on-leonardo