1

I have troubles to connect a NRF24L01 transceiver to a Wemos D1 R2 board. I succeeded on an Arduino Uno. Does anyone know the pinout?

I used (same as with Uno):

D13 - SCK
D12 - MI
D11 - MO

D8 and D9 for CE and CSN

Code:

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

// NRF24 Radio
#define CE_PIN   'D8'
#define CSN_PIN  'D9'

RF24 radio(CE_PIN, CSN_PIN); // Create a Radio

// NRF24 Radio
radio.begin();
if (!radio.isChipConnected()) {
  Serial.println("ERROR: NRF24 Chip not connected");
} else {
  Serial.println("NRF24 Chip connected");
  radio.setDataRate( RF24_250KBPS );
  radio.setRetries(3,5); // delay, count
  radio.openWritingPipe(slaveAddress);
}

Result: ERROR: NRF24 Chip not connected

If I use:

#define CE_PIN   8
#define CSN_PIN  9

then Wemos crashes (reboot exception (4)) so I tried with D, but I get a warning, maybe related:

warning: multi-character character constant [-Wmultichar]
   22 | RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
      |            ^~~~~~
 warning: multi-character character constant [-Wmultichar]
   22 | RF24 radio(CE_PIN, CSN_PIN); // Create a Radio 
6
  • Does anyone knows the pinout? ... pinout of what?
    – jsotola
    Commented Apr 18, 2023 at 23:53
  • always format error messages as code ... fixed it for you
    – jsotola
    Commented Apr 18, 2023 at 23:57
  • 1
    strings are defined by double quote marks, eg. "abc123" ... single characters are defined by single quote marks, eg. 'e' ... two characters inside single quotes are illegal syntax, eg. 'D8' ... remove the single quotes in the two define statements .... you are doing RF24 radio('D8', 'D9');, when you should be doing RF24 radio(D8, D9);
    – jsotola
    Commented Apr 19, 2023 at 0:11
  • @jsotola Did not know that. Thanx!
    – FredV
    Commented Apr 20, 2023 at 8:05
  • FredV, answers go into the Answer box
    – Juraj
    Commented Apr 20, 2023 at 9:49

1 Answer 1

0

Select Wemos D1 R2/mini in Tools menu in IDE. Then you can use the Dx names of the pins. Don't put them in quotes.

Since D8 is CS pin at the Uno pin 10 location, you can't use it as CE. And because esp8266 has less pin than Atmega328 of Uno, there is no pin D9. I recommend you to use pins D1 and D2 for CE and CSN.

RF24 radio(D1, D2);

Here you can read how the Dx pins are mapped to esp8266 pins and what is the common function of the pins.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.