Can't use nrf24l01+ with arduino

I have tried so many times but Its not working at all.
Here are my codes and connections.
Nano connection:
CE 7
CSN 8
SCK 13
MOSI 11
MISO 12

Mega connection:
CE 8
CSN 53
SCK 52
MOSI 51
MISO 50

Transmitter:

#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.openWritingPipe(address);
  radio.setDataRate(RF24_2MBPS); // Set the speed of the transmission to the quickest available
  radio.setChannel(114); // Use a channel unlikely to be used by Wifi, Microwave ovens etc
  radio.setPALevel(RF24_PA_MAX); // Set radio Tx power to MAX
  radio.setRetries(15,15);
  radio.stopListening();
}

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

Receiver:

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

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

const byte address[6] = "00001";

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setDataRate(RF24_2MBPS); // Set the speed of the transmission to the quickest available
  radio.setChannel(114); // Use a channel unlikely to be used by Wifi, Microwave ovens etc
  radio.setPALevel(RF24_PA_MAX); // Set radio Tx power to MAX
  radio.setRetries(15,15);
  radio.startListening();
}

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

The connection for Transmitter:

The connection for Receiver:

Here is the Receiver Output:

Here is the mega connection check with nrf:

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

I cannot follow your pictures can you post an annotated schematic showing how it is wired be sure all power, ground and power sources are shown. Be sure the units are at least a meter/yard apart. If you do not feel like drawing a schematic do not use the Arduino as a power source. Here are a few simple rules that have been posted many times:
Gil's Crispy Critter Rules, they apply to processor hardware:
Rule #1. A Power Supply the Arduino is NOT!
Rule #2. Never Connect Anything Inductive to an Arduino!
Rule #3 Don't connecting or disconnecting wires with power on.
Rule #4 Do not apply power to any pin unless you know what you are doing.
LaryD's Corollarys
Coro #1 when first starting out, add a 220R resistor in series with both Input and Output pins.
Coro #2 buy a DMM (Digital Multi-meter) to measure voltages, currents and resistance.
Violating these rules tends to make crispy critters out of Arduinos.


as I m using a adapter so connected the vcc of the adapter with 5v of the arduino that supplies 3.3v with ams1117.
and CSN to 53 rather than 8

?????
Per your schematic you are using the Arduino as a power supply.

yes.
from arduino 5v pin

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