NRF24L01 + ESP8266 and Arduino communication problems

Hello all, I'm working on a project where an ESP8266 (NODE MCU) acts as a base module for a group of arduino modules communicating via the NRF transceiver. Basically the Arduinos send the ESP data which then is sent to a server through the wifi chip on the ESP.

I have successfully gotten the ESP to act as a receiver and the Arduino (one for now, testing only) as the transmitter. But not in reverse. Any time I try to get the ESP to receive anything it simply doesn't, and I can't figure out why.

I have been working with this tutorial by Robin2 (thanks a million btw, helped me so much). And I got a barebones communication between the two working one way but not the other.

Here is the Arduino code acting as the Transmitter

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
byte address[6] = "one";
int moist = 5;

//int ackData[2] = {-1,-1};


void setup() {
  Serial.begin(9600);
  
  radio.begin();
  radio.setDataRate( RF24_250KBPS );
  
  //radio.enableAckPayload();

  radio.setRetries(3,5); // delay, count
  radio.openWritingPipe(address);
  
  radio.stopListening();


  
}
void loop() {

  int moist = analogRead(A1);
radio.write( &moist, sizeof(moist) ); //send moisture sensor readout

delay(1000);
}

And here is the ESP8266 code acting as the Receiver

//RADIO
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(2, 15); // CE, CSN
byte address[6] = "one";
//RADIO


//int ackData[2] = {109, -40};

void setup(void) {
  pinMode(2,OUTPUT);
  Serial.begin(9600);
//RADIO
 radio.begin();
 radio.setDataRate( RF24_250KBPS );
 radio.openReadingPipe(1, address);
 
 //radio.enableAckPayload();

 radio.startListening();
 
 //radio.writeAckPayload(1, &ackData, sizeof(ackData)); 
//RADIO


}



void loop(void) {

  
//RADIO
 if (radio.available()) {
    //char text[32] = "";
    int text = 0;
    radio.read(&text, sizeof(text));
    Serial.println(text);
    
    digitalWrite(2,LOW); // blink led to physically show reception
    delay(200);
    digitalWrite(2,HIGH);   
  }
//RADIO



}

The acknowledge code is commented out because that breaks all functionality of the communication and sends a line of numbers that don't make sense but do change when I change the value of the moisture sensor. That is a problem for later though. I'm trying to just get the ESP to SEND information and the Arduino to RECEIVE it.

I have verified multiple times that the wiring is good, the CE and CSN pins are changed when I switch the code and roles for the boards. I don't get a single error. So I'm at a loss here.

If anyone can provide some insight or help or tell me I am blind and missed a huge piece please let me know.

Thank you for your time

Edit: its the NODE MCU, thanks ieee488 I forgot

Which specific ESP8266 module are you using?
The ESP8266 is an IC.

Are you sure of the pins of your ESP8266 module?

Oh gosh I completely forgot, you're right.
It's been added now thank you

Dean_Bean:
I have been working with this tutorial by Robin2 (thanks a million btw, helped me so much). And I got a barebones communication between the two working one way but not the other.

Stick with the code in my Tutorial with no change that is not essential until you get the communication working.

Sorry, I have never tried to get an nRF24 working with an ESP8266.

If you are having a problem getting the NodeMCU to transmit then my first suspicion would be inadequate power for the nRF24. You have not said how you have everything wired up. Try using a pair of AA alkaline cells (3v) to power the nRF24 with the battery GND connected to the ESP8266 GND. Have you got a 10µF capacitor across Vcc and GND for the nRF24?

On the other hand, if the Arduino can send a message to the NodeMCU and get an acknowledgement it suggests that the NodeMCU is able to transmit.

...R

Damn! That was it! All I needed was more power!

So I plugged the ESP into a better power supply and it immediately worked great! The first example is working both ways now which is great. Second example is working only one way now which is still good.

In the sketch where arduino is the transmitter and ESP as the receiver everything works great.

Then in the sketch with arduino as receiver and ESP as transmitter things are like 80% perfect.

In the com port it shows the ackdata being received but it's not exactly what I think it should be:

07:57:37.408 -> Data Sent Message 1  Acknowledge data -262471576, -252645136
07:57:37.443 -> 
07:57:38.418 -> Data Sent Message 2  Acknowledge data -262537113, -252645136
07:57:38.451 -> 
07:57:39.408 -> Data Sent Message 3  Tx failed
07:57:40.425 -> Data Sent Message 3  Acknowledge data -262602650, -252645136
07:57:40.459 -> 
07:57:41.408 -> Data Sent Message 4  Acknowledge data -262668187, -252645136
07:57:41.442 -> 
07:57:42.430 -> Data Sent Message 5  Acknowledge data -262733724, -252645136
07:57:42.463 -> 
07:57:43.413 -> Data Sent Message 6  Acknowledge data -262143891, -252645136
07:57:43.446 -> 
07:57:44.429 -> Data Sent Message 7  Acknowledge data -262209428, -252645136

But either way thanks for helping with the big issue, I can't believe it was just a matter of power! Thank you!