Connection problem between Node MCU and NRF24L01 Transceiver Module

Hello there,
Myself Tony

I am trying to make wireless communication between Arduino UNO and the NodeMCU using the NRF24L01 Transceiver module connected to both the boards. The aim of the code is to turn ON the LED connected to the NODEMCU (acts as a receiver) when the button is pressed on the Arduino UNO(acts as a transmitter). Now the problem starts, the code works very well when I use Arduino Nano as the receiver instead of NodeMCU, But when I use the same code with the NODEMCU, it doesn't receive any data from the UNO. I searched a lot on the internet and tried various combinations of pin configuration for CE and CSN pins of NRF24L01 but none of them worked. I used the Node MCU because I want to connect the project to the internet for future use. I am attaching the code below for both the transmitter and the receiver. Please Please help me. I am tired of trying many times. Hope you guys will figure this out.

Transmitter Code For Arduino UNO

#include <SPI.h>
#include <RF24.h>
#include <nRF24L01.h>
int Trigger = 3;  // Sets Digital Pin D3 as the Trigger Input Pin. (External Button attached)

RF24 radio(7,8);   // Declaring CE and CSN pins.
const byte address[] = "Sensor1";  // Sets the Address of pipeline for sending the Data. This should be the same for both the transmitter and the receiver.
                                  
             
bool Trigger_Value ;  // the value returned by digitalRead(4) is stored here

void setup()
{
  Serial.begin(9600);
  
  radio.begin();  // Initializes the operations of the chip .
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();  // Starts sending the data through the above address pipeline . 
  pinMode(Trigger, INPUT); // Declares Trigger as an input.

}
                                                                          

void loop()
{
  Trigger_Value = digitalRead(Trigger);  // Stores the Trigger input value in the "Trigger_Value" variable.
  
  // Sending the "Trigger_Value" and Sizeof(Trigger_Value) Data to Receiver.
  radio.write(&Trigger_Value, sizeof(Trigger_Value));
  
  Serial.println("");
  
  Serial.print("Trigger_Value = ");
  Serial.print(Trigger_Value);
  Serial.print("      ");
  
  Serial.print("Size of Trigger_Value = ");
  Serial.println(sizeof Trigger_Value);
    
}

Receiver Code For Arduino Nano (Works Perfectly)

#include <SPI.h>
#include <RF24.h>
#include <nRF24L01.h>
# define Alarm D3  // Sets Digital Pin D3 as the Alarm Output Pin. 

RF24 radio(7,8); // declaring CE and CSN pins for Arduino Boards
const byte address[] = "Sensor1"; // Sets the Address of pipeline for sending the Data. This should be same for both the transmitter and the receiver.

bool Trigger_Value = 0; // Stores the received data from the Transmitter that the Trigger gives.

void setup()
{
  Serial.begin(9600);
  
  radio.begin(); // Initializes the operations of the chip
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening(); // Starts receiving the data from the above address pipeline .
  
  pinMode(Alarm, OUTPUT); // declares Alarm as an output .
  
}


void loop()
{
  while(radio.available()){  

    // Receiving the "Trigger_Value" and Sizeof(Trigger_Value) Data from the Transmitter.
    radio.read(&Trigger_Value, sizeof(Trigger_Value)); 
    
    digitalWrite(Alarm, Trigger_Value);
    Serial.println("");
  
    Serial.print("Trigger_Value = ");
    Serial.print(Trigger_Value);
    Serial.print("      ");
  
    Serial.print("Size of Trigger_Value = ");
    Serial.println(sizeof Trigger_Value);
  }

}

Receiver Code For Node MCU (Not Working)

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

# define Alarm D3  // Sets Digital Pin D3 as the Alarm Output Pin. 

RF24 radio(2,4); // declaring CE and CSN pins for Node MCU
const byte address[] = "Sensor1"; // Sets the Address of pipeline for sending the Data. This should be the same for both the transmitter and the receiver.

bool Trigger_Value; // Stores the received data from the Transmitter that the Trigger gives.

void setup()
{
  Serial.begin(9600);
  
  radio.begin(); // Initializes the operations of the chip
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening(); // Starts receiving the data from the above address pipeline .
  
  pinMode(Alarm, OUTPUT); // declares Alarm as an output .
  
}


void loop()
{
   
  
  while(radio.available()){  

    // Receiving the "Trigger_Value" and Sizeof(Trigger_Value) Data from the Transmitter.
    radio.read(&Trigger_Value, sizeof(Trigger_Value)); 
    
    digitalWrite(Alarm, Trigger_Value);
    Serial.println("");
  
    Serial.print("Trigger_Value = ");
    Serial.print(Trigger_Value);
    Serial.print("      ");
  
    Serial.print("Size of Trigger_Value = ");
    Serial.println(sizeof Trigger_Value);
  }

}

First, I tried the Node MCU code without the Internet but still it is not working. Please help me out !!

Please post a schematic showing the complete wiring of the rf24 module to the NodeMCU.

I suggest that you try the CheckConnection.ino sketch from post #30 of Robin2's simple rf24 tutorial to check the physical connection between the rf24 module and the NodeMCU. Run the sketch and post the serial monitor output.

How is the rf24 module powered? The 3.3V of the NodeMCU may not have the capability to supply sufficient current to the rf24 module. The number one cause of the rf24 modules not working is insufficient current. Try powering the module with a 2 AA cell in series (3V) battery pack.

The wiring of the NRF24L01 Module with NodeMCU is as follows"

MISO connects to pin D6 of the NodeMCU
MOSI connects to pin D7 of the NodeMCU
SCK connects to pin D5 of the NodeMCU
CE connects to pin D4 of the NodeMCU
CSN connects to pin D2 of the NodeMCU
GND and VCC of the NRF24L01 are connected to GND and 3.3V of the NodeMCU.

The Serial Monitor Output of CheckConnection.ino sketch from post #30 of Robin2's simple rf24 tutorial with the above pin connections is as follows:

CheckConnection Starting

FIRST WITH THE DEFAULT ADDRESSES after power on
Note that RF24 does NOT reset when Arduino resets - only when power is removed
If the numbers are mostly 0x00 or 0xff it means that the Arduino is not
communicating with the nRF24

SPI Speedz = 10 Mhz
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xe7e7e7e7e7 0x4141417852
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xe7e7e7e7e7
RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x07
CONFIG = 0x0e
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1 MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX
ARC = 0

AND NOW WITH ADDRESS AAAxR 0x41 41 41 78 52 ON P1
and 250KBPS data rate

SPI Speedz = 10 Mhz
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xe7e7e7e7e7 0x4141417852
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xe7e7e7e7e7
RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x27
CONFIG = 0x0e
DYNPD/FEATURE = 0x00 0x00
Data Rate = 250 KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX
ARC = 0

The RF24L01 is powered by the 3.3 V of Node MCU, I also tried some other power sources but the result was the same. What should I do now?

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